This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-03-30
Channels
- # aleph (2)
- # announcements (8)
- # babashka (12)
- # beginners (34)
- # calva (36)
- # cherry (3)
- # cider (1)
- # clj-kondo (11)
- # clj-otel (6)
- # cljdoc (31)
- # clojure (121)
- # clojure-conj (1)
- # clojure-czech (2)
- # clojure-europe (109)
- # clojure-nl (1)
- # clojure-norway (5)
- # clojure-uk (3)
- # cursive (3)
- # datahike (1)
- # datomic (9)
- # deps-new (6)
- # docker (5)
- # emacs (21)
- # fulcro (4)
- # hoplon (16)
- # introduce-yourself (2)
- # london-clojurians (5)
- # lsp (87)
- # malli (17)
- # missionary (1)
- # nbb (27)
- # off-topic (257)
- # pathom (4)
- # portal (42)
- # practicalli (1)
- # rdf (3)
- # releases (2)
- # shadow-cljs (49)
- # slack-help (3)
- # timbre (2)
I have to say, M-x find-grep-dired
is amazing and I can't believe I only just recently discovered it. Hope others benefit from it!
I confirm. find-name-dired
and find-grep-dired
are incredibly underrated commands. https://www.gnu.org/software/emacs/manual/html_node/emacs/Dired-and-Find.html
What's crazy about them is that the output is a Dired buffer. You can, for example, search for matching files and start renaming them. Total and complete bananas.
I bet if you ask someone using a "ITJUSTWORKS™" IDE, they'd be mumbling something about that in three-hundred and fifty years of them being a programmer they never had to do that. More reasonable ones would probably say something like: "I'd just write a bash/python/awk one-liner. Yeah, I don't mind that it's 700 chars long..."
I mean you get it right? It's a effing Dired buffer. You can for example search for matching files, then mark some of them (even using regexp again) and say for example compress them into a .zip. Or copy them somewhere else, etc.
Yes, that is really nice thanks. There is also embark - embark-export can do similar things. For instance using consult-find, then exporting into a dired buffer.
I took note a few weeks ago of this conversation, only today I stumbled on a suitable use case. AWESOME, just awesome. Thanks for mentioning it
One of the ideas that keep popping up whenever I have to touch a large .edn file, is to make imenu navigable across the keys in the map. I swear, if it keeps bothering me, I will try to write a function that does that. Or maybe someone already did?
clojure-lsp could support that under documentSymbols for .edn files, pretty useful and fits the feature indeed
also, clojure-lsp has all the necessary analysis of each keyword of the edn, so would be way easier than an adhoc elisp function and would be possible to be used OOTB on other editors :)
I guess code folding could be an alternative way to achieve something similar (more quickly navigate to keys). Not that I have that working…
Chris, code folding hides the nested keys. I want something that works like imenu in Org-mode.
> clojure-lsp has all the necessary analysis of each keyword of the edn Can you send me relevant pieces (maybe in the code)? I'll put that in my backlog and hopefully try to experiment with that at some point.
Sure, https://github.com/clojure-lsp/clojure-lsp/blob/de391efb86307203cfa98ab73e7d34733677a6fb/lib/src/clojure_lsp/feature/document_symbol.clj#L52 that does that, currently it only check for var-definitions in the ns, but we could check if it's a edn file, return that idea of yours
Not exactly what you're asking but I added this hacky regex to my imenu to get a very simple version of all root level keywords in an edn file (add-to-list 'imenu-generic-expression '(nil "^.?.?\\(:[^ ]+\\).*$" 1) t)
Maybe use it as an inspiration and say if you find a proper solution 🙂
https://github.com/dakra/dmacs/blob/b6a038340dfc9d521ca4aee0529ae7b3ff4616e5/init.org?plain=1#L5589-L5593
Oh, nice @UFAP0C8KU. But I also wish you didn't show me that, because now I may not have that itch to figure out a way that works for nested keys too.
And you may wanna wrap it, like this:
(when (string= "edn" (file-name-extension (or (buffer-file-name) "")))
(add-to-list 'imenu-generic-expression '(nil "^.?.?\\(:[^ ]+\\).*$" 1) t))
Good suggestion. I was a bit surprised that edn doesn't have it's own mode like lisp-data-mode
.
But it turns out that I actually like the same regex in my cljs files as well.
With re-frame I have something like
(rf/reg-event-db
:foo/bar
(fn-traced [db [_ foo]]
...
and now :foo/bar
appears in my imenu alongside the normal defn
functions.FYI @U0G75ARHC I https://twitter.com/ericdallo/status/1647340150429458433?s=20 in clojure-lsp :) Thanks for the suggestion!