From 95856c515464cfaf90d3fa9104b55dbcce9ac586 Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Wed, 3 Aug 2022 16:08:17 +0200 Subject: [PATCH] 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. --- lisp/help.el | 1 + test/lisp/help-tests.el | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) 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." -- 2.39.5