Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
Already on GitHub? Sign in to your account
dynamically created hydras? #164
Comments
|
If you want to stick to your data structure, maybe like this: (eval `(defhydra hydra-foo (:columns 3)
"cljr"
,@(mapcar (lambda (x)
(list (car x) (cadr x) (caddr x)))
cljr--all-helpers))) |
|
Also look at |
benedekfazekas
commented
Sep 1, 2015
|
thx for the help. will give these a try |
joostkremers
commented
Sep 14, 2015
|
@benedekfazekas Sorry to barge in here, but as the maintainer of |
benedekfazekas
commented
Sep 14, 2015
|
I have to disappoint you I am afraid. I played a bit with @abo-abo's sample code and then gave up and did not have time to go back. so current hydra code in |
squiter
commented
Oct 20, 2016
|
I don't know if this is a right place to write my doubt but I want to create hydras dynamically by projects. |
|
@squiter Just write out the hydra that you need by hand. If you have a few more that fit the same template, use the eval trick above. If you give an example, perhaps I can help you. |
squiter
commented
Oct 21, 2016
|
@abo-abo thanks for your response!
Thank you again! |
stig
commented
Feb 16, 2017
•
|
I'm trying to use the eval trick above, and it works but is not 100% ideal. This works (auxiliary functions omitted): (eval `(defhydra sb/hydra-select-themes (:hint nil :color pink)
"Select Theme"
,@(sb/hydra-load-theme-heads (sb/sort-themes (custom-available-themes)))
("DEL" (sb/disable-all-themes))
("RET" nil "done" :color blue)))
(bind-keys ("C-c w t" . sb/hydra-select-themes/body))However, that means that if I install a new theme it won't show up in this hydra until I manually re-eval the config snippet, or restart Emacs. That's not ideal. So I wanted to rewrite it to something like this, hoping that the Hydra would be re-created at the point when I invoke it: (bind-keys ("C-c w t" .
(eval `(defhydra sb/hydra-select-themes (:hint nil :color pink)
"Select Theme"
,@(sb/hydra-load-theme-heads (sb/sort-themes (custom-available-themes)))
("DEL" (sb/disable-all-themes))
("RET" nil "done" :color blue)))))However, if I try to launch the Hydra now I get the following error:
Is there a work-around for this? I've tried wrapping the eval in a Can anyone help with a work-around for this case? Update: FWIW the complete code is here: https://github.com/stig/dot-files/blob/master/emacs.d/Themes.org#hydra-theme-switching Update 2: Using #137 (comment) as a reference I finally managed to get it working with the aid of (bind-keys ("C-c w t" .
(lambda ()
(interactive)
(call-interactively
(eval `(defhydra sb/hydra-select-themes (:hint nil :color pink)
"Select Theme"
,@(sb/hydra-load-theme-heads (sb/sort-themes (custom-available-themes)))
("DEL" (sb/disable-all-themes))
("RET" nil "done" :color blue))))))) |
|
@stig So now it works for you? Because I don't see why it should not work if Still, I recommend to simply use |
stig
commented
Feb 17, 2017
|
@abo-abo yeah, it works now. I don't know what |
Available from the |
benedekfazekas commentedSep 1, 2015
hi,
this is more like a question than an issue. we decided to use hydras to improve discoverability for clojure refactor see: clojure-emacs/clj-refactor.el#214 (comment). however, would be nice to be able to generate hydras as we have a nice datastructure (and helper functions) which could power that, see: https://github.com/clojure-emacs/clj-refactor.el/blob/new-all-helpers-structure/clj-refactor.el#L293-L373
I have seen the conditional hydra on the wiki but that is not exactly what we need. Any advice how to generate hydra docstring and heads dynamically?