I am writing a small window navigation and manipulation package. Windows are numbered very much like WindowNumberingMode.
To make this concrete I have a series of commands:
"C-, 1" ; Move focus to (select) window #1
.. ; ..
"C-, 9" ; Move focus to (select) window #9
"C-, m 1" ; Move current buffer and focus to window #1
.. ; ..
"C-, m 9" ; Move current buffer and focus to window #9
"C-, x 1" ; Exchange current buffer and focus with window #1
.. ; ..
"C-, x 9" ; Exchange current buffer and focus with window #9
.. ; ..
At the time that I type "C-,"
I would like to offer visual prompts (similar to switch-window):
Can I do this and continue collecting the remainder of my key-sequence? Do I need "C-,"
to switch to a new minor-mode?
ace-window
package gives this or similar functionality. You can study that package to see how it implements it. – Kaushal Modi Sep 17 '15 at 14:15Do I need "C-," to switch to a new minor-mode?
Yes. – Jordon Biondo Sep 17 '15 at 14:57C-,
would be bound to the hydra body, and1
,9
... would be hydra heads. See:pre
and:post
to set up visual hints. – François Févotte Sep 17 '15 at 18:43C-x C-x a
is the same as pressingC-c a
. – François Févotte Sep 18 '15 at 07:11set-transient-map
(oroverriding-terminal-local-map
directly), to get the effect you want (an action possibly followed by additional keys with actions), butC-h k
will still not show what you want to show. – Drew Sep 18 '15 at 14:51set-transient-map
looks promising. Assuming that they are looking for disjoint sets of keys, does emacs handle properly multiple requests toset-transient-map
frompre-command-hook
functions? IOW were I to useset-transient-map
would I be setting myself up for collision with other packages? – John Yates Sep 18 '15 at 20:38set-transient-map
. You can find examples of its use. I don't think there should be a problem with multiple requests, whether frompre-command-hook
or otherwise - they are handled sequentially, after all. But give it a try, to see. – Drew Sep 18 '15 at 21:30C-h f keymapp
and the Elisp manual, node Format of Keymaps. IOW, this is one possibility for(keymapp f)
:(and (symbolp f) (fboundp f) (keymapp (symbol-function f)))
– Drew Sep 18 '15 at 21:35keymapp
. Again, see that Elisp manual node. The notion of keymap includes this case. – Drew Sep 19 '15 at 04:26