This conversation prompted me.
Here is a minimal menu “system” I quickly put together.
You can combine different capture functions in the way you like. In fact… they don’t have to be capture functions (e.g. git-status
).
The presentation of the menu is minimalistic, which I prefer to the standard org-capture
's menu style, or hydra
(it’s a bit too much to learn for me).
See it in the minibuffer at the bottom?
I do not know what exactlyl happens if you have “too many” items, or it can extend vertically (perhaps with \n
).
See the code below. You should be able to easily adapt it with your own set of commands.
usls-new-note
is my custom version of Prot’s USLS.
;; Idea taken from project.el package
(defvar my/switch-commands)
;; Set `my/swithc-command' in the way you like.
(setq my/switch-commands '((?f "Fleeting" (lambda () (org-roam-capture nil "f")))
(?p "Personal" (lambda () (org-roam-find-file-immediate nil)))
(?w "Work" usls-new-note)))
(defun my/keymap-prompt ()
"Return a prompt for a switching dispatch menu."
(mapconcat
(pcase-lambda (`(,key ,label))
(format "[%s] %s"
(propertize (key-description `(,key)) 'face 'bold)
label))
my/switch-commands
" "))
(defun my/capture-prompt ()
"My capture prompt. Set `my/switch-commands' to define your own menu."
(interactive)
(let ((choice
(assq (read-event (my/keymap-prompt)) my/switch-commands)))
(funcall (nth 2 choice))))
I took the idea from this commit of project.el
– built-in project management package (talked about here for example). The latest commit mirrored in GitHub has already had improvement from the code base I have in my local, so it seems to be getting some traction for upcoming Emacs version 28.