diff options
author | Stefan Kangas <stefan@marxist.se> | 2021-11-22 06:44:10 +0100 |
---|---|---|
committer | Stefan Kangas <stefan@marxist.se> | 2021-11-22 06:44:10 +0100 |
commit | 1aef1a6673bc29784effe10d2e01e62b49c0112c (patch) | |
tree | f8c0e96c0d36d4a1606740aadb2d427901423424 /test/lisp | |
parent | 5fcff0d2cbe33faef8bbb753a5f02fb26b1d7e5c (diff) | |
download | emacs-1aef1a6673bc29784effe10d2e01e62b49c0112c.tar.gz emacs-1aef1a6673bc29784effe10d2e01e62b49c0112c.tar.bz2 emacs-1aef1a6673bc29784effe10d2e01e62b49c0112c.zip |
Add new format for literal key sequences to substitute-command-keys
* lisp/help.el (substitute-command-keys): Add new format "\\`f'" for
literal key sequences. (Bug#50804)
* doc/lispref/help.texi (Keys in Documentation): Document the above
new substitution.
* test/lisp/help-tests.el
(help-tests-substitute-command-keys/literal-key-sequence):
(help-tests-substitute-command-keys/literal-key-sequence-errors): New
tests.
(help-tests-substitute-key-bindings/face-help-key-binding): Extend test.
Diffstat (limited to 'test/lisp')
-rw-r--r-- | test/lisp/help-tests.el | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/lisp/help-tests.el b/test/lisp/help-tests.el index 982750f479e..281d97ee929 100644 --- a/test/lisp/help-tests.el +++ b/test/lisp/help-tests.el @@ -88,6 +88,25 @@ (test "\\[emacs-version]\\[next-line]" "M-x emacs-versionC-n") (test-re "\\[emacs-version]`foo'" "M-x emacs-version[`'‘]foo['’]"))) +(ert-deftest help-tests-substitute-command-keys/literal-key-sequence () + "Literal replacement." + (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"))) + +(ert-deftest help-tests-substitute-command-keys/literal-key-sequence-errors () + (should-error (substitute-command-keys "\\`'")) + (should-error (substitute-command-keys "\\`c-c'")) + (should-error (substitute-command-keys "\\`<foo bar baz>'"))) + +(ert-deftest help-tests-substitute-key-bindings/face-help-key-binding () + (should (eq (get-text-property 0 'face (substitute-command-keys "\\[next-line]")) + 'help-key-binding)) + (should (eq (get-text-property 0 'face (substitute-command-keys "\\`f'")) + 'help-key-binding))) + + (ert-deftest help-tests-substitute-command-keys/keymaps () (with-substitute-command-keys-test (test-re "\\{minibuffer-local-must-match-map}" |