From: Lars Ingebrigtsen Date: Mon, 13 Jun 2022 15:02:55 +0000 (+0200) Subject: Allow saying \\=`M-x ...' in a doc string X-Git-Tag: emacs-29.0.90~1910^2~31 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=f188b0185e7ace193b1c5501c5520578b4216ea0;p=emacs.git 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). --- 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