Function: hui:menu-choose
hui:menu-choose is a byte-compiled function defined in hui-mini.el.
Signature
(hui:menu-choose MENU &optional MENU-ALIST DOC-FLAG HELP-STRING-FLAG)
Documentation
Prompt for the first capitalized item char from MENU or optional MENU-ALIST.
Return the Lisp form associated with the selected item, which may be another menu.
The character may be entered in lowercase. If chosen by direct selection with the Assist Key, return any help string for item, else return the action form for the item.
Two additional optional arguments may be given when documentation for a menu item should be shown rather than menu display. DOC-FLAG non-nil means show documentation for any item that is selected by the user. HELP-STRING-FLAG non-nil means show only the first line of the documentation, not the full text.
Source Code
;; Defined in ~/.emacs.d/elpa/hyperbole-20260822.1645/hui-mini.el
(defun hui:menu-choose (menu &optional menu-alist doc-flag help-string-flag)
"Prompt for the first capitalized item char from MENU or optional MENU-ALIST.
Return the Lisp form associated with the selected item, which may be
another menu.
The character may be entered in lowercase. If chosen by direct
selection with the Assist Key, return any help string for item,
else return the action form for the item.
Two additional optional arguments may be given when documentation for
a menu item should be shown rather than menu display. DOC-FLAG
non-nil means show documentation for any item that is selected by the
user. HELP-STRING-FLAG non-nil means show only the first line of the
documentation, not the full text."
(let* ((menu-line (hui:menu-line menu-alist))
(set:equal-op 'eq)
(select-char (string-to-char hui:menu-select))
(exit-char (string-to-char hui:menu-exit-hyperbole))
(quit-char (string-to-char hui:menu-quit))
(abort-char (string-to-char hui:menu-abort))
(help-char (string-to-char hui:menu-help))
(top-char (string-to-char hui:menu-top))
(item-keys (hui:menu-item-keys menu-alist))
;; 0 matches an empty string return, no selection
(keys (apply #'list 0 1 select-char exit-char quit-char abort-char
help-char top-char item-keys))
(key 0)
(hargs:reading-type 'hmenu))
(while (not (memq (setq key (upcase
(string-to-char
(hui:menu-read-from-minibuffer
"" menu-line hui:menu-mode-map nil t))))
keys))
(beep t)
(setq hargs:reading-type 'hmenu)
(discard-input))
;; Here, the minibuffer has been exited, and `key' has been set to one of:
;; a menu item first capitalized character code;
;; a menu command character code;
;; 1 for in the menu prefix area (moves to top menu);
;; 0 for at the end of the menu (does nothing).
(cond ((eq key exit-char)
(set--this-command-keys (hui:menu-this-command-keys
hui:menu-exit-hyperbole))
(setq this-command #'hui:menu-exit-hyperbole)
nil)
((eq key quit-char)
(set--this-command-keys (hui:menu-this-command-keys hui:menu-quit))
(setq this-command #'hui:menu-quit)
nil)
((eq key 0)
nil)
((eq key abort-char)
(beep t)
(set--this-command-keys (hui:menu-this-command-keys hui:menu-abort))
(setq this-command #'hui:menu-abort)
nil)
((eq key help-char)
(hui:menu-display-help (hui:menu-get-help-string nil menu-alist))
(set--this-command-keys (hui:menu-this-command-keys hui:menu-help))
(setq this-command #'hui:menu-help)
(cons 'menu menu))
((and (eq key 1) (listp (car menu-alist))
(stringp (caar menu-alist))
(string-match "^Hy[.0-9]*[a-zA-Z0-9]*>$" (caar menu-alist)))
;; RET pressed on Hyperbole top-level menu prefix, reload
;; Smart Key handlers and minibuffer menus to reflect any updates.
(hmouse-update-smart-keys)
(set--this-command-keys (hui:menu-this-command-keys hui:menu-quit))
(setq this-command #'hmouse-update-smart-keys)
nil)
((memq key (list 1 top-char))
(setq hui:menu-keys (hui:menu-this-command-keys hui:menu-top))
'(menu . hyperbole))
((and (eq key select-char)
(save-excursion
(if (search-backward " " nil t)
(progn (skip-chars-forward " ")
;; Get the next following capital letter
(let (case-fold-search)
(setq key
(if (looking-at "[^ \t\nA-Z]*[A-Z]")
(char-before (match-end 0))
(following-char))))
nil) ;; Drop through.
t))))
(t (hui:menu-item key doc-flag help-string-flag nil menu-alist)))))