I chose to use the "apps" key (on keyboards with two Windows keys, it's the key to the right of the right Windows key, with a little menu symbol on it) since I did not use that for anything in Emacs.
Here is how to try this little hack out (FYI the key/command combinations below are just examples and not the actual keys and commands I wanted to use):
(defvar my-favorties-map (make-sparse-keymap "Favorites"))
(define-key global-map (kbd "<apps>") my-favorties-map)
(define-key my-favorties-map (kbd "f")
(cons "Find file"
'find-file))
(define-key my-favorties-map (kbd "s")
(cons "Save current buffer"
'save-buffer))
(define-key my-favorties-map (kbd "i")
(cons "Kill buffer"
'kill-buffer))
After evaluating the above, when typing the "apps" key, the following "menu" will be displayed in the echo minibuffer:
Favorites: i = Kill buffer, Save current buffer, Find file
It does what I want, although it is a little bit peculiar in how it decides for what bindings it will show X = Command for, and not. Seems that if the name of the menu item/command begins with the same letter/key that is bound to the command, it will not show it.
So, there it is, an instant little text based menu for executing favorite commands.
Enjoy!
No comments:
Post a Comment