summaryrefslogtreecommitdiff
path: root/lisp/help.el
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2022-06-13 17:02:55 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2022-06-13 17:02:55 +0200
commitf188b0185e7ace193b1c5501c5520578b4216ea0 (patch)
treef2765bbf3a04c206d2b91eccf73586f71c0334e6 /lisp/help.el
parent5faa0bfdda012d049ddfa24f119ca33e16b026a7 (diff)
downloademacs-f188b0185e7ace193b1c5501c5520578b4216ea0.tar.gz
Allow saying \\=`M-x ...' in a doc string
* lisp/help.el (substitute-command-keys): Allow saying \\=`M-x foo' in doc strings (and have it be fontified as a key binding).
Diffstat (limited to 'lisp/help.el')
-rw-r--r--lisp/help.el3
1 files changed, 2 insertions, 1 deletions
diff --git a/lisp/help.el b/lisp/help.el
index 9928b28fb6e..766bae0845c 100644
--- a/lisp/help.el
+++ b/lisp/help.el
@@ -1173,7 +1173,8 @@ Otherwise, return a new string."
(let ((k (buffer-substring-no-properties orig-point (point))))
(cond ((= (length k) 0)
(error "Empty key sequence in substitution"))
- ((not (key-valid-p k))
+ ((and (not (string-match-p "\\`M-x " k))
+ (not (key-valid-p k)))
(error "Invalid key sequence in substitution: `%s'" k))))
(add-text-properties orig-point (point)
'( face help-key-binding