This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-03-06
Channels
- # babashka (60)
- # beginners (36)
- # clj-kondo (29)
- # clojure (91)
- # clojure-dev (18)
- # clojure-europe (12)
- # clojure-nl (1)
- # clojure-norway (11)
- # clojure-uk (5)
- # clojuredesign-podcast (8)
- # clojurescript (40)
- # core-typed (74)
- # data-science (8)
- # datomic (9)
- # emacs (22)
- # events (5)
- # fulcro (56)
- # gratitude (3)
- # hyperfiddle (11)
- # lsp (6)
- # malli (36)
- # meander (23)
- # off-topic (50)
- # polylith (4)
- # portal (10)
- # reitit (4)
- # schema (1)
- # shadow-cljs (66)
- # squint (3)
- # tools-deps (16)
Is it possible to extend logic of what imenu
considers function definitions? I'd like to jump between re-frame subscription and event handlers (for example, re-frame.core/reg-sub :foobar
) via imenu as well.
This is just a guess, but perhaps you could try defining your own matchers in https://www.gnu.org/software/emacs/manual/html_node/elisp/Imenu.html#index-imenu_002dgeneric_002dexpression?
no idea how that works if you also use something like lsp-mode
at the same time which also populates the imenu :man-shrugging:
> I'd like to jump between re-frame subscription and event handlers
(defun add-reframe-regs-to-imenu ()
(add-to-list
'imenu-generic-expression
'("re-frame" "^(*reg-\\(event-db\\|sub\\|sub-raw\\|fx\\|event-fx\\|event-ctx\\|cofx\\)[ \n]+\\([^\t \n]+\\)" 2)
t)))
(add-hook 'clojurescript-mode #'add-reframe-regs-to-imenu)

I love being able to automate a complex series of commands in emacs as a keyboard macro and then do C-u 10 f4
to just do them again and again and again (put in whatever number you want for 10)

I like that if you put M-0 C-x e
it will repeat until it get's an error (like from isearch-forward
or whatever)
10 @ a
for Evil assuming q a ,,, q
was used to create the macro
It works well in combination with narrowing if you want to restrict it to part of a buffer.
Narrowing for the win... best feature of Emacs ❤️
I think one of the things that gets missed when comparing editing in things like vi(m)/emacs to things like vs code is the composability of the editing and movement commands into things like macros in a convenient way. It's one of the reasons I couldn't get on with when trying eclipse / intelij / etc ...
does vim let you record macros? That start record, do it, stop record, try using it, do it again is pretty essential to me
being able to turn a recorded macro into a function is great too https://www.masteringemacs.org/article/keyboard-macros-are-misunderstood#:~:text=To%20persist%20it%2C%20you%20can,insert%20it%20in%20your%20init.
well ... in vim, you enter / exit command mode
which you could consider as record a macro
and then there's a key-press which is do the last thing again
I couldn't get on with the modal editing thing, so I use vanilla emacs shortcuts (which are generally supported by things like readline - so all command line tools like mysql
or pgsql
, or you can use rlwrap
) ... so my preference is to start recording and save it ... but sometimes I wish that I'd started recording a while ago and have to view-lossage
and copy and paste it into edit-last-kbd-macro
... instead of just starting again 😉
Good link on keyboard macros ... I hadn't spotted C-x C-k l
before ... that's less copy/pasta error prone 😉
@U0525KG62 yes, in Evil normal mode, q
followed by another character starts recording, e.g. q a
to capture all the key presses until q
is presses again in normal mode.
Then @
to replay a keyboard macro, so @ a
will replay the macro once, 10 @ a
to replay the macro 10 times.
They keyboard macro supports more than the .
dot repeat feature of Evil.
I love doing macros with s-expression movements sometimes, like a case statement or sometimes just to align keys and values
I also love taking things out into snippets, for example here's my basic snippet to write a defn
with a Malli schema
# -*- mode: snippet -*-
# name: malli defn
# key: mdefn
# --
(defn $1
"$2"
{:malli/schema [:=>
[:cat $3]
$4]}
[$5]
$6)