From f188b0185e7ace193b1c5501c5520578b4216ea0 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Mon, 13 Jun 2022 17:02:55 +0200 Subject: [PATCH] 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). --- lisp/help.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 -- 2.39.2