Closed srid closed 9 years ago
To clarify, I would like to know if I can avoid having to hardcode the register enumeration here:
(global-set-key
(kbd "C-M-j")
(defhydra hydra-jump-to-register ()
"scroll"
("j" (lambda () (interactive) (jump-to-register ?i)) "Srid.org" :color blue)
("p" (lambda () (interactive) (jump-to-register ?p)) "Productive.org" :color blue)
("w" (lambda () (interactive) (jump-to-register ?w)) "Work.org" :color blue)))
i.e., can the hydra automatically populate the actions based what's in the emacs register?
Please let me know if there is a better place to ask this kind of questions instead of opening a GitHub issue.
A Github issue is the place to ask, since it's very easy to paste snippets here and it generates sort of a FAQ.
Here's something you can try:
(global-set-key
(kbd "C-M-j")
(defhydra hydra-bmk ()
("i" (find-file "~/.emacs.d/Srid.org") "Srid")
("p" (find-file "~/Dropbox/Notes/Productive.org") "Productive")
("w" (find-file "~/Dropbox/Notes/Work.org") "Work")))
See my post on how
I'm dealing with bookmarks. I think that approach is more flexible
than using defhydra
.
Ah, yes. This is what I ended up doing just now before seeing your comment, except I had to wrap find-file with lambda and (interactive).
I'm currently have bookmarks for frequently accessed files:
Is this something I can use a hydra for (to save keystrokes)? Specifically I want to invoke
C-M-j
and hitp
orw
to directly go to the file. Please let me know if there is a better place to ask this kind of questions instead of opening a GitHub issue.