Remote Clerk workshop for Scicloj-adjacent people (2022-10)

..

Clojureverse thread visual-tools-meeting-14-clerk-workshop/9423
Setup instructions workshop-202210-scicloj/workshop/setup.md
Slack channel #visual-tools-meeting-14-clerk-workshop
Zoom Link TBD, keep an eye on the channel 👆
Time 18:00-19:30 Oslo time

X: Hey Teodor, I’m just curious about what this is meant to be.

T: Hi :)

There’s going to be a Clerk workshop, these are my prep notes. The notes are on the internet because that’s easy for me, and if I want to share them with others, that’s easy. And I find that writing about my process helps me learn and remember. I believe in learning in public.

X: Okay. But it’s not official or anything?

T: Nope — just third party commentary.

Thanks to Martin Kavalar and Daniel Slutsky, this is happening! I’m not representing any official entity here.

The amazing folks making Clerk decided to host a workshop for Scicloj-adjacent people.

This is just my notes as we go along. This page should probably be a Clerk notebook. But I’m not comfortable putting Clerk notebooks on play.teod.eu (“play”) quite yet.

So this is in Org-mode - for now. But I DEFINITELY want to be able to build play-pages with Clerk. I just have to figure out how - and find a good why.

Q: should I use the clerk file watcher or not?

Sort of confusing that there’s both:

  1. A command to start Clerk as a file watcher
  2. and a nudge towards just “setting up that editor hotkey”

A: I’ll dig into my old hotkey setup and see how that works.

Here we go, my own old clerk mess:

;;; teod. Key bindings
(progn
  (defun clerk-show ()
    (interactive)
    (save-buffer)
    (let ((filename (buffer-file-name)))
      (when filename
        (cider-interactive-eval
         (concat "(nextjournal.clerk/show! \"" filename "\")")))))

  (defun teod/clerk-show ()
    (interactive)
    (message "running show")
    (let
        ((filename
          (buffer-file-name)))
      (when filename
        (cider-interactive-eval
         (concat "(nextjournal.clerk/show! \"" filename "\")")))))

  (defun teod/clerk-autoshow ()
    (interactive)
    (message "RUnning autoshow")
    (add-hook 'after-save-hook 'teod/clerk-show 0 't))

  (comment
   (define-minor-mode +clerk-auto-mode
     "Minor mode for automatically showing the current buffer with clerk"
     :init-value nil
     (prog
       (teod/clerk-autoshow)
       (clojure-mode)))))

;; lots of elided stuff

(map! :g "<f8>" #'teod-play-page-find
      ;; ...
      :g "C-æ" #'clerk-show
      ;; ...
      )

A: I have some old stuff.

Let’s see if that old stuff “just works” with the Clerk demo material.

Also! I think I just want to fork the repo so that I can change it. 🤔 But I also don’t want more complexity than I need. 🤔 Code is hard.

Decision: fork and have the fork ready, but run code directly in upstream repo for now. Revisit if this causes problems.

okay - moving forward.

Not sure exactly what “prep” I’m meant to do. Edit: right, they said so:

Work through the exercises in the workshop/exercices directory

Okay, gonna do just that. I was a bit confused by the “setup” title. But this is really technical setup and homework to finish before the workshop.

<interlude> - i REALLY want “paste screenshot into org document”. But I don’t want to dump lots of pictures in here. So in reality, I want a versioned blob store backed by R2 or something. With a nice Emacs interface. Hmm. Perhaps it’s time for static.teod.eu. ? Or cdn.teod.eu. ? Hmm. </interlude>

Back to work. workshop/exercises it is. Ooooh, this is nice, just a bucket of Clojure files. Simple, mmmm.

 494 2022-10-20 09:30 ex_1_viewer_selection.clj
2.0K 2022-10-20 09:30 ex_2_table_viewer.clj
1.1K 2022-10-20 09:30 ex_3_viewer_presentation.clj
 820 2022-10-20 09:30 ex_4_viewer_require.clj
1.4K 2022-10-20 09:30 ex_5_visibility.clj
 494 2022-10-20 09:30 ex_6_caching.clj

All similary sized. I’ll just start up top.

14:35: aaaand I got sidetracked today too. Seems like (A) I’m not able to do programming stuff for hours and hours, and (B) my schedule wasn’t completely open after all.