2023-01-27 Poor man's hydra For the longest time I used the excellent Hydra-package[1]. With Hydra it is possible the reintroduce modal editing into modeless Emacs. Once activated you can use a single key press or a chain of single key presses to call whatever Emacs function. Here is the most simple example from the GitHub page: (defhydra hydra-zoom (global-map "<f2>") "zoom" ("g" text-scale-increase "in") ("l" text-scale-decrease "out")) Once the F2-key is pressed you can repeatedly adjust the font scale by pressing "g" or "l" (not the we would need that since we have text-scale-adjust). Now, I don't like modal editing but I also don't want to assign different keybindings for all my often used commands. So I used hydra to create a simple modal menu. This way I only need to bind one keybinding to the hydra-menu and not a bazillion of the them for every single function I want to call. Here is an example of this menu with hydra: (defhydra sulaco/hydra-menu (:columns 1) "Select" ("e" gnus "Gnus (Email)" :exit t) ("g" elpher "Elpher (Gopher)" :exit t) ("r" elfeed "Elfeed (RSS)" :exit t) ("s" (switch-to-buffer "*scratch*") "Scratchpad" :exit t) ("x" (shell-command "xset dpms force off") "Monitor off" :exit t)) (define-key global-map (kbd "<f1>") 'sulaco/hydra-menu/body) That's all fine and dandy but some time later I stumbled upon some elisp snippet which would achieve nearly the same without the need for the Hydra-package. Applied to my custom menu it looks like this: (defun sulaco/hydra-menu () (interactive) (let ((keymap (make-sparse-keymap))) (define-key keymap (kbd "e") 'gnus) (define-key keymap (kbd "g") 'elpher) (define-key keymap (kbd "r") 'elfeed) (define-key keymap (kbd "s") (lambda () (interactive) (switch-to-buffer "*scratch*"))) (define-key keymap (kbd "x") (lambda () (interactive) (shell-command "xset dpms force off"))) (message "[modal menu]") (set-temporary-overlay-map keymap))) (define-key global-map (kbd "<f1>") 'sulaco/hydra-menu) It's not exactly the same. For once it lacks all of the options that hydra offers and it definitely does not look as nice but it's just good enough for me. So now I finally can M-x package-delete RET hydra RET. Another 17 femtoseconds shaved off of my Emacs startup time!!!1 :^) Footnotes _________ [1] https://github.com/abo-abo/hydra