summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Bernoulli <jonas@bernoul.li>2023-11-24 18:00:02 +0100
committerJonas Bernoulli <jonas@bernoul.li>2023-11-24 18:00:02 +0100
commit0509c90e5363ebc51b91cc9ebe1a7d7dab93b632 (patch)
tree378b931f48463034b102ecdb042a228ed4878588
parent9c00fae15811805493e78501eacf6a0d61d95216 (diff)
transient--key-face: New function
Replacing `transient--colorize-key'.
-rw-r--r--lisp/transient.el17
1 files changed, 8 insertions, 9 deletions
diff --git a/lisp/transient.el b/lisp/transient.el
index b9cdbb2..ccc7c5b 100644
--- a/lisp/transient.el
+++ b/lisp/transient.el
@@ -3742,22 +3742,16 @@ When `transient-enable-popup-navigation' is non-nil then format
(setq suf (string-replace " " "" suf)))
(concat (propertize pre 'face 'transient-unreachable-key)
(and (string-prefix-p (concat pre " ") key) " ")
- (transient--colorize-key suf cmd)
+ (propertize suf 'face (transient--key-face cmd))
(save-excursion
(and (string-match " +\\'" key)
(propertize (match-string 0 key)
'face 'fixed-pitch))))))
((transient--lookup-key transient-sticky-map (kbd key))
- (transient--colorize-key key cmd))
+ (propertize key 'face (transient--key-face cmd)))
(t
(propertize key 'face 'transient-unreachable-key))))
- (transient--colorize-key key cmd))))
-
-(defun transient--colorize-key (key command)
- (propertize key 'face
- (or (and (transient--semantic-coloring-p)
- (transient--suffix-color command))
- 'transient-key)))
+ (propertize key 'face (transient--key-face cmd)))))
(cl-defmethod transient-format-key :around ((obj transient-argument))
"Handle `transient-highlight-mismatched-keys'."
@@ -3875,6 +3869,11 @@ If the OBJ's `key' is currently unreachable, then apply the face
(funcall face)
face)))
+(defun transient--key-face (&optional cmd)
+ (or (and (transient--semantic-coloring-p)
+ (transient--suffix-color cmd))
+ 'transient-key))
+
(defun transient--key-unreachable-p (obj)
(and transient--redisplay-key
(let ((key (oref obj key)))