From: Stefan Kangas Date: Wed, 3 Aug 2022 14:08:17 +0000 (+0200) Subject: Add face to mouse buttons in command substitutions X-Git-Tag: emacs-29.0.90~1447^2~501 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=95856c515464cfaf90d3fa9104b55dbcce9ac586;p=emacs.git Add face to mouse buttons in command substitutions * lisp/help.el (substitute-command-keys): Add help-key-binding face to mouse buttons in literal key substitutions. * test/lisp/help-tests.el (help-tests-substitute-command-keys/literal-key-sequence): Expand test for above change. --- diff --git a/lisp/help.el b/lisp/help.el index 1c1ce1618ca..f58d252bae2 100644 --- a/lisp/help.el +++ b/lisp/help.el @@ -1182,6 +1182,7 @@ Otherwise, return a new string." (let ((k (buffer-substring-no-properties (+ orig-point 2) end-point))) (when (or (key-valid-p k) + (string-match-p "\\`mouse-[1-9]" k) (string-match-p "\\`M-x " k)) (goto-char orig-point) (delete-char 2) diff --git a/test/lisp/help-tests.el b/test/lisp/help-tests.el index 5c935965f78..7f30b27b00d 100644 --- a/test/lisp/help-tests.el +++ b/test/lisp/help-tests.el @@ -93,7 +93,9 @@ (with-substitute-command-keys-test (test "\\`C-m'" "C-m") (test "\\`C-m'\\`C-j'" "C-mC-j") - (test "foo\\`C-m'bar\\`C-j'baz" "fooC-mbarC-jbaz"))) + (test "foo\\`C-m'bar\\`C-j'baz" "fooC-mbarC-jbaz") + (test "\\`M-x next-line'" "M-x next-line") + (test "\\`mouse-1'" "mouse-1"))) (ert-deftest help-tests-substitute-command-keys/literal-key-sequence-ignore-invalid () "Ignore any invalid literal key sequence."