summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Bernoulli <jonas@bernoul.li>2023-11-27 17:32:28 +0100
committerJonas Bernoulli <jonas@bernoul.li>2023-11-27 17:32:28 +0100
commit99e03ca0dab9a01426947426267fa4cb2d904cff (patch)
tree43d15630953660516040f65f0df35dd1fea13797
parent957c9e3c3a67a769759ceba174ae161352bf170d (diff)
Fix color lookup for non-suffixes
There actually is a binding for [nil], in `transient--predicate-map', and it's not always what we need when determining the color (and thus pre-command) for non-suffixes (via `transient--separator-line').
-rw-r--r--lisp/transient.el21
1 files changed, 12 insertions, 9 deletions
diff --git a/lisp/transient.el b/lisp/transient.el
index ca3f02b..7b43df9 100644
--- a/lisp/transient.el
+++ b/lisp/transient.el
@@ -2526,9 +2526,10 @@ nil) then do nothing."
(setq this-command 'transient-undefined)))
transient--stay))
-(defun transient--get-pre-command (cmd &optional suffix-only)
- (or (lookup-key transient--predicate-map (vector cmd))
- (and (not suffix-only)
+(defun transient--get-pre-command (&optional cmd enforce-type)
+ (or (and (not (eq enforce-type 'non-suffix))
+ (lookup-key transient--predicate-map (vector cmd)))
+ (and (not (eq enforce-type 'suffix))
(transient--resolve-pre-command
(oref transient--prefix transient-non-suffix)
t))))
@@ -3535,10 +3536,11 @@ have a history of their own.")
(defun transient--separator-line ()
(and (eq transient-mode-line-format 'line)
window-system
- (let ((face
- `(,@(and (>= emacs-major-version 27) '(:extend t))
- :background ,(or (face-foreground (transient--key-face) nil t)
- "#gray60"))))
+ (let ((face `(,@(and (>= emacs-major-version 27) '(:extend t))
+ :background
+ ,(or (face-foreground (transient--key-face nil 'non-suffix)
+ nil t)
+ "#gray60"))))
(concat (propertize "__" 'face face 'display '(space :height (1)))
(propertize "\n" 'face face 'line-height t)))))
@@ -3889,12 +3891,13 @@ If the OBJ's `key' is currently unreachable, then apply the face
(funcall face)
face)))
-(defun transient--key-face (&optional cmd)
+(defun transient--key-face (&optional cmd enforce-type)
(or (and transient-semantic-coloring
(not transient--helpp)
(not transient--editp)
(or (and cmd (get cmd 'transient-face))
- (get (transient--get-pre-command cmd) 'transient-face)))
+ (get (transient--get-pre-command cmd enforce-type)
+ 'transient-face)))
(if cmd 'transient-key 'transient-key-noop)))
(defun transient--key-unreachable-p (obj)