diff options
| -rw-r--r-- | helpful.el | 10 | ||||
| -rw-r--r-- | test/helpful-unit-test.el | 11 |
2 files changed, 17 insertions, 4 deletions
@@ -980,7 +980,8 @@ vector suitable for `key-description', and COMMAND is a smbol." ;; Text of the form \\[foo-command] (rx "\\[" (group (+ (not (in "]")))) "]") (lambda (it) - (let* ((symbol-name (match-string 1 it)) + (let* ((button-face (if (>= emacs-major-version 28) 'help-key-binding 'button)) + (symbol-name (match-string 1 it)) (symbol (intern symbol-name)) (key (where-is-internal symbol keymap t)) (key-description @@ -991,7 +992,8 @@ vector suitable for `key-description', and COMMAND is a smbol." key-description 'helpful-describe-exactly-button 'symbol symbol - 'callable-p t))) + 'callable-p t + 'face button-face))) str t t)) @@ -1632,7 +1634,9 @@ Includes keybindings for aliases, unlike (push (format "%s %s" (propertize map 'face 'font-lock-variable-name-face) - key) + (if (>= emacs-major-version 28) + (propertize key 'face 'help-key-binding) + key)) (if (eq map 'global-map) global-lines mode-lines))))) (setq global-lines (-sort #'string< global-lines)) (setq mode-lines (-sort #'string< mode-lines)) diff --git a/test/helpful-unit-test.el b/test/helpful-unit-test.el index 664454b..0f5177b 100644 --- a/test/helpful-unit-test.el +++ b/test/helpful-unit-test.el @@ -293,7 +293,16 @@ symbol (not a form)." (get-text-property 0 'button formatted))) ;; If we have quotes around a key sequence, we should not propertize ;; it as the button styling will no longer be visible. - (-let [formatted (helpful--format-docstring "`\\[set-mark-command]'")] + (-let* ((emacs-major-version 28) + (formatted (helpful--format-docstring "`\\[set-mark-command]'"))) + (should + (string-equal formatted "C-SPC")) + (should + (eq + (get-text-property 0 'face formatted) + 'help-key-binding))) + (-let* ((emacs-major-version 27) + (formatted (helpful--format-docstring "`\\[set-mark-command]'"))) (should (string-equal formatted "C-SPC")) (should |
