Associating Emacs keys with a few keystrokes

I would like to open my five (or so) favorite two-keystroke files in emacs. I am thinking of F9-a for file a, F9-b for file b, etc.

I have an org-mode program on F5 (instead of the "default" Ca), so I pressed F5-a for today's agenda. I would like to have the same for my org file, my contacts file, etc.

Is there a way (or rather, which way) to make F9 open a submenu with a list of my favorite files to select another keystroke?

+3
source share
2 answers

This setting does what you ask for, at least in terms of layouts. This is actually not a popup menu.

(setq my-file-menu-keymap
      (let ((keymap (make-sparse-keymap)))
        (dolist (pair '(("a" . "~/.emacs")
                        ("b" . "~/.phones")
                        ("c" . "~/org/daily.org")))
          (define-key keymap (car pair)
            `(lambda () (interactive) (find-file ,(cdr pair)))))
        keymap))

(global-set-key (kbd "<f9>") my-file-menu-keymap)

( , ). SO (. cycle-special- ).

+6

, . , , , 5.

+1

All Articles