Fork me on GitHub
#clerk
<
2023-10-15
>
Carsten Behring19:10:52

I published here some Emacs functions which make the usage of the clerk tap-inspector more comfortable. https://github.com/behrica/clerk-mode My goal was to have an interactive Clerk viewer selection inside of Emacs, so I can render values from namespaces without any reference to Clerk, not even metadata., like:

(ns vega)

{:$schema ""
    :data {:values [{:build 1 :result "PASSED"}
                    {:build 2 :result "PASSED"}
                    {:build 3 :result "FAILED"}
                    {:build 4 :result "FAILED"}
                    {:build 5 :result "SKIPPED"}
                    {:build 6 :result "PASSED"}
                    {:build 7 :result "PASSED"}
                    {:build 8 :result "FAILED"}
                    {:build 9 :result "PASSED"}
                    {:build 10 :result "PASSED"}
                    {:build 11 :result "SKIPPED"}
                    {:build 12 :result "PASSED"}
                    {:build 13 :result "PASSED"}
                    {:build 14 :result "FAILED"}
                    {:build 15 :result "PASSED"}
                    {:build 16 :result "SKIPPED"}]}
    :description "Bump chart"
    :encoding {:order {:field "build" :type "quantitative"}
               :x {:field "build" :type "quantitative"}
               :y {:field "result" :type "nominal"}}
    :mark {:point true :type "line"}}

(map
 bean
 (System/getProperties))
The function clerk/tap-last-sexp-with-viewer asks the user interactively (via completion !) which of the current Clerk viewers should be used to tap+render the sexp at point. This allows then for example to choose the vega-lite viewer. This overall allows to use Clerk tap-viewer with any Clojure code base. So far we still need to add "clerk" to the deps.edn. (at least in a :dev alias or on command-line) But as soon as Clojure 1.12 add it's add-lib support is there, we can even add Clerk dynamically while working on a non-clerk aware code base while still having rich value rendering via Clerk one key stroke away.

👀 1
mkvlr06:10:22

if you don’t always need a custom viewer one thing to think about is supporting the universal argument to opt into viewer selection

Carsten Behring19:10:21

Maybe it would be nice if the tap-inspector could gain a interactive viewer selection per result cell ? So we could have "automatic tapping and rendering " of "raw values" (without the Clerk specific metadata for viewer selection), and a user can "switch" the viewer interactively in the Browser.