Function: minor-mode-menu-from-indicator
minor-mode-menu-from-indicator is an interactive and byte-compiled
function defined in mouse.el.gz.
Signature
(minor-mode-menu-from-indicator INDICATOR)
Documentation
Show menu for minor mode specified by INDICATOR.
Interactively, INDICATOR is read using completion.
If there is no menu defined for the minor mode, then create one with
items Turn Off and Help.
Probably introduced at or before Emacs version 27.1.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/mouse.el.gz
;; Provide a mode-specific menu on a mouse button.
(defun minor-mode-menu-from-indicator (indicator)
"Show menu for minor mode specified by INDICATOR.
Interactively, INDICATOR is read using completion.
If there is no menu defined for the minor mode, then create one with
items `Turn Off' and `Help'."
(interactive
(list (completing-read
"Minor mode indicator: "
(describe-minor-mode-completion-table-for-indicator))))
(let* ((minor-mode (lookup-minor-mode-from-indicator indicator))
(mm-fun (or (get minor-mode :minor-mode-function) minor-mode)))
(unless minor-mode (error "Cannot find minor mode for `%s'" indicator))
(let* ((map (cdr-safe (assq minor-mode minor-mode-map-alist)))
(menu (and (keymapp map) (lookup-key map [menu-bar]))))
(setq menu
(if menu
(mouse-menu-non-singleton menu)
(if (fboundp mm-fun) ; bug#20201
`(keymap
,(format "%s - %s" indicator
(capitalize
(string-replace
"-" " " (format "%S" minor-mode))))
(turn-off menu-item "Turn off minor mode" ,mm-fun)
(help menu-item "Help for minor mode"
(lambda () (interactive)
(describe-function ',mm-fun)))))))
(if menu
(popup-menu menu)
(message "No menu available")))))