Open mcp292 opened 4 years ago
Works as expected for me. Here's the code I tried:
(defhydra hydra-zoom (global-map "C-M-v")
"zoom"
("g" text-scale-increase "in")
("l" text-scale-decrease "out"))
Thanks for trying it out. Let me be more clear. This does not work:
(defhydra hydra-zoom (global-map "C-M")
"zoom"
("g" text-scale-increase "in")
("l" text-scale-decrease "out"))
Whereas this does:
(defhydra hydra-zoom (global-map "C-c")
"zoom"
("g" text-scale-increase "in")
("l" text-scale-decrease "out"))
Thing is C-M is not a valid key prefix in Emacs, while C-c is. For example, when you press C-c, Emacs will display C-c-
in the Echo Area, as to wait for the complete key sequence.
Whereas when you press C-M, nothing happens.
Here's a solution to get the same behavior as you wanted:
(defhydra hydra-zoom (global-map "")
"zoom"
("C-M-g" text-scale-increase "in")
("C-M-l" text-scale-decrease "out"))
It requires to put "C-M" in each head, but in the end the behavior is the same.
Oh, that makes sense since it's two modifiers. Thanks for the solution! This is what I came up with before changing the bindings:
(defhydra dumb-jump-hydra (global-map "C-M-g" :body-pre (dumb-jump-go))
"dumb jump"
("g" dumb-jump-go "go to declaration")
("b" dumb-jump-back "back"))
Style 1 does not work with
C-M
sequence. Seems to be becauseC-M
sequences becomeC-M-letter
and Style 1 expectsC-M letter
.