Fork me on GitHub
#emacs
<
2023-01-02
>
teodorlu09:01:18

Hi! I've got a Clojure CLI that can emit lines of EDN. I want to select one of those lines with Vertico. Then use :uuid and :title from that line to call another CLI command. Any suggestions on how to model the data on the Emacs lisp side? Have anyone of you done anything similar? Sample data in thread.

teodorlu09:01:14

$ ./play.clj relations :from files :to lines | shuf | head -n 4
{:slug "bitemporal-worldview", :title "A bitemporal worldview", :readiness :wtf-is-this, :lang :en}
{:slug "dots", :title "dots", :readiness :wtf-is-this, :author-url "", :created "2022-07-24", :builder :no-op, :lang :en}
{:slug "attention-later", :title "attention-later", :readiness :wtf-is-this, :uuid "0be4b1f7-e4dd-4209-981b-797795be7533", :author-url "", :created "2022-12-19", :lang :en}
{:slug "attention-design", :title "attention design", :readiness :wtf-is-this, :author-url "", :created "2022-07-14", :uuid "0cc48734-e933-44cb-a4e8-2678f125f6df", :lang :en}

teodorlu09:01:50

> Deprecated > This library is no longer maintained as I consider it replaced by https://github.com/clojure-emacs/parseedn.

Ellis09:01:14

First result that came up for "emacs lisp edn", but there ya go

πŸ‘ 2
teodorlu09:01:52

Gotcha. So you'd just work with EDN all the way, no conversion to Emacs lisp lists and symbols and strings?

Ellis09:01:37

Have to parse it to an elisp data structure for completing-read but then you can call the shell-command with the selected item

πŸ’― 2
teodorlu09:01:57

Makes sense, think I'll try that. Thank you! πŸ™Œ

πŸ™Œ 2
teodorlu10:01:03

parseedn.el is looking absolutely great! It even includes serialization. 😁 https://github.com/clojure-emacs/parseedn/blob/main/parseedn.el

πŸŽ‰ 2
prnc12:01:34

Hello πŸ‘‹ Has anyone come across a way to fold/un-fold all the top level forms in the buffer except for comment blocks? (any hs-minor-mode config, any other package, a custom function?)

Benjamin15:01:51

I took this https://www.emacswiki.org/emacs/hide-region.el and updated it. Then here is a command. The resulting visuals are slightly clunky still I suppose.

(defun hide-all-toplevel-forms-except-comments ()
  "Undo it with `hide-region-unhide' (use universal argument)."
  (interactive)
  (save-excursion
    (goto-char (point-min))
    (while (not (eobp))
      (forward-list)
      (unless (save-excursion
                (beginning-of-defun)
                (looking-at-p "(comment"))
        (let ((bounds (bounds-of-thing-at-point 'defun)))
          (hide-region-hide (car bounds) (cdr bounds)))))))

Benjamin15:01:43

actually when I mull over your use case maybe you want to say narrow-to-defun or similar inside your comment block

prnc18:01:10

Hi @U02CV2P4J6S thank you for replying! I think this might the kind of thing I’m looking forβ€”need to see if I can adapt it to my needs πŸ˜‰

catjam 2