[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master ebfec5c119: Allow substitute-command-keys to include menus in \{.
From: |
Lars Ingebrigtsen |
Subject: |
master ebfec5c119: Allow substitute-command-keys to include menus in \{...} output |
Date: |
Fri, 13 May 2022 09:54:47 -0400 (EDT) |
branch: master
commit ebfec5c119e5758de0ec9ba1136f3e17268da5c3
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>
Allow substitute-command-keys to include menus in \{...} output
* doc/lispref/help.texi (Keys in Documentation): Document it.
* lisp/help.el (substitute-command-keys): Add an argument to
include menus in the \{...-map} output (bug#24236).
---
doc/lispref/help.texi | 5 ++++-
lisp/help.el | 20 ++++++++++++--------
2 files changed, 16 insertions(+), 9 deletions(-)
diff --git a/doc/lispref/help.texi b/doc/lispref/help.texi
index f029a1c97c..9b2d63dcbd 100644
--- a/doc/lispref/help.texi
+++ b/doc/lispref/help.texi
@@ -390,7 +390,7 @@ quotes. You can customize it freely according to your
personal
preference.
@end defopt
-@defun substitute-command-keys string &optional no-face
+@defun substitute-command-keys string &optional no-face include-menus
@vindex help-key-binding@r{ (face)}
This function scans @var{string} for the above special sequences and
replaces them by what they stand for, returning the result as a string.
@@ -440,6 +440,9 @@ RET minibuffer-complete-and-exit
C-g abort-recursive-edit
"
+The keymap description will normally exclude menu items, but it
+@var{include-menus} is non-@code{nil}, include them.
+
@group
(substitute-command-keys
"To abort a recursive edit from the minibuffer, type \
diff --git a/lisp/help.el b/lisp/help.el
index 3c0370fee1..d9f364e1ad 100644
--- a/lisp/help.el
+++ b/lisp/help.el
@@ -1090,7 +1090,7 @@ strings done by `substitute-command-keys'."
:version "29.1"
:group 'help)
-(defun substitute-command-keys (string &optional no-face)
+(defun substitute-command-keys (string &optional no-face include-menus)
"Substitute key descriptions for command names in STRING.
Each substring of the form \\\\=[COMMAND] is replaced by either a
keystroke sequence that invokes COMMAND, or \"M-x COMMAND\" if COMMAND
@@ -1100,11 +1100,13 @@ unless the optional argument NO-FACE is non-nil.
Each substring of the form \\\\=`KEYBINDING' will be replaced by
KEYBINDING and use the `help-key-binding' face.
-Each substring of the form \\\\={MAPVAR} is replaced by a summary of
-the value of MAPVAR as a keymap. This summary is similar to the one
-produced by ‘describe-bindings’. The summary ends in two newlines
-(used by the helper function ‘help-make-xrefs’ to find the end of the
-summary).
+Each substring of the form \\\\={MAPVAR} is replaced by a summary
+of the value of MAPVAR as a keymap. This summary is similar to
+the one produced by ‘describe-bindings’. This will normally
+exclude menu bindings, but if the optional INCLUDE-MENUS argument
+is non-nil, also include menu bindings. The summary ends in two
+newlines (used by the helper function ‘help-make-xrefs’ to find
+the end of the summary).
Each substring of the form \\\\=<MAPVAR> specifies the use of MAPVAR
as the keymap for future \\\\=[COMMAND] substrings.
@@ -1253,9 +1255,11 @@ Otherwise, return a new string."
(t
;; Get the list of active keymaps that precede this one.
;; If this one's not active, get nil.
- (let ((earlier-maps (cdr (memq this-keymap (reverse
active-maps)))))
+ (let ((earlier-maps
+ (cdr (memq this-keymap (reverse active-maps)))))
(describe-map-tree this-keymap t (nreverse earlier-maps)
- nil nil t nil nil t))))))))
+ nil nil (not include-menus)
+ nil nil t))))))))
;; 2. Handle quotes.
((and (eq (text-quoting-style) 'curve)
(or (and (= (following-char) ?\`)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master ebfec5c119: Allow substitute-command-keys to include menus in \{...} output,
Lars Ingebrigtsen <=