]> git.eshelyaron.com Git - emacs.git/commitdiff
Allow saying \\=`M-x ...' in a doc string
authorLars Ingebrigtsen <larsi@gnus.org>
Mon, 13 Jun 2022 15:02:55 +0000 (17:02 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Mon, 13 Jun 2022 15:02:55 +0000 (17:02 +0200)
* 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

index 9928b28fb6ebed186ced3a0879751c40b10e7185..766bae0845cd331b21aa272c7a599bf4e3fb0089 100644 (file)
@@ -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