Closed luxbock closed 9 years ago
An amaranth body can only have blue and amaranth heads. Red ones don't
really make sense. Also note that split-window
isn't a command, so
it's better to use sexp-style call for it.
The following works fine for me:
(defhydra hydra-test (global-map "C-w" :color amaranth)
"window"
("k" windmove-up "move-up" :color blue)
("j" windmove-down "move-down")
("s" (split-window) "split" :color blue)
("q" nil "quit"))
Although it's a bit strange using amaranth here: you're locked into no-quit mode only after C-w j. This code will lock you in right after C-w.
(global-set-key
(kbd "C-w")
(defhydra hydra-window (:color amaranth)
"window"
("h" windmove-left "left")
("j" windmove-down "down")
("k" windmove-up "up")
("l" windmove-right "right")
("s" (split-window) "split")
("q" nil "cancel")))
Ah I see!
I think trying to define a body that uses amaranth with red heads should probably throw an error instead of passing for anyone else who might not have read the docs carefully enough. Being stuck in amaranth-mode with no way out can be rather frustrating.
Actually, it's OK to do it, it's just redundant. I'm not actually getting an error for this code:
(defhydra hydra-window (global-map "C-w" :color amaranth)
"window"
("k" windmove-up "move-up" :color blue)
("j" windmove-down "move-down" :color red)
("s" (split-window) "split" :color blue))
I can press C-w jjs and it exits fine.
It appears to have been an issue with my older Emacs version (24.3). With this version the code above would lock me into amaranth state with no option of getting out. After I upgraded things appear to work fine.
OK, I can reproduce it now, thanks. I'll try to fix this soon. The issue didn't come up for me, since the Hydra quitting code has three versions depending on Emacs version.
Should be fixed now. If you still have a 24.3 around, try to check.
Starting with
emacs -Q
:I load the following and create a few split-windows with
C-w s
, which works fine. I can move windows up withC-w k
just fine as well, but as soon as I useC-w j
to try move down a window, the command executes but I get stuck in the amaranth mode with no way to get out. Neitherq
orC-g
help either, so the only way I was able quit was by restarting Emacs.