[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/transient 99e03ca0da 3/4: Fix color lookup for non-suff
From: |
Jonas Bernoulli |
Subject: |
[elpa] externals/transient 99e03ca0da 3/4: Fix color lookup for non-suffixes |
Date: |
Mon, 27 Nov 2023 13:19:29 -0500 (EST) |
branch: externals/transient
commit 99e03ca0dab9a01426947426267fa4cb2d904cff
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>
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').
---
lisp/transient.el | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
diff --git a/lisp/transient.el b/lisp/transient.el
index ca3f02bb97..7b43df9952 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)