Skip to content

Instantly share code, notes, and snippets.

@mmarshall540
Created January 18, 2026 21:40
Show Gist options
  • Select an option

  • Save mmarshall540/8c5a7f5fcd08511ea3ada6e2cb977411 to your computer and use it in GitHub Desktop.

Select an option

Save mmarshall540/8c5a7f5fcd08511ea3ada6e2cb977411 to your computer and use it in GitHub Desktop.
Using the tmm-menubar
(setopt completions-format 'one-column
tmm-completion-prompt nil
tmm-mid-prompt " → "
tmm-shortcut-style '(downcase)
tmm-shortcut-words nil)
(define-keymap
:keymap global-map
;; Improve the #tmm Options menu shortcuts by removing some entries:
"<menu-bar> <options> <cua-mode>" nil ; let "Customize Emacs" use "c"
"<menu-bar> <options> <cua-emulation-mode>" nil ; "
"<menu-bar> <options> <save>" nil ; let "Show/Hide" use "s"
"<menu-bar> <options> <save-desktop>" nil ; "
"<menu-bar> <options> <save-place>" nil ; "
;; Make Gnus open in a new frame when called from the #tmm menu.
"<menu-bar> <tools> <gnus>" '("Read Net News" . gnus-other-frame))
(keymap-set minibuffer-local-map "M-`" 'my/tmm-back-to-top)
;; Remove the useless parenthetical from the minibuffer-prompt.
(defun my/tmm-add-prompt-ad ()
(goto-char (point-min))
(when (looking-at "Menu bar (up/down to change, PgUp to menu): ")
(let ((inhibit-read-only t))
(forward-word 2)
(delete-region (point) (search-forward ")"))
(goto-char (minibuffer-prompt-end)))))
(advice-add 'tmm-add-prompt :after 'my/tmm-add-prompt-ad)
;; This is a hack that causes the `colwidth' local variable to get a
;; value of 37 so that TMM's keybinding hints will align properly.
(defun my/tmm-get-keymap-advice (oldfunc &rest r)
"OLDFUNC is `tmm-get-keymap' and R is its arguments."
(cl-letf (((symbol-function 'min)
(lambda (&rest _) 37)))
(apply oldfunc r)))
(advice-add 'tmm-get-keymap :around 'my/tmm-get-keymap-advice)
;; Command for jumping back to top-level menu
(defun my/tmm-back-to-top ()
"Quit the current TMM menu and reopen the top-level TMM menu."
(interactive)
(put 'quit 'error-message "")
(run-at-time nil nil
(lambda ()
(put 'quit 'error-message "Quit")
;; Make sure vertico-multiform-mode treats this as an
;; interactive call to `tmm-menubar'.
(setq this-command 'tmm-menubar) ; #vertico
(tmm-menubar)))
(abort-minibuffers))
(defun my/completions-hooks ()
(setq cursor-type nil)
(setq-local mode-line-format nil)
(setq-local indicate-empty-lines nil))
(add-hook 'completion-list-mode-hook 'my/completions-hooks)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment