emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/transient 8098d17518 13/41: transient--make-predicate-m


From: Jonas Bernoulli
Subject: [elpa] externals/transient 8098d17518 13/41: transient--make-predicate-map: Fix handling of transient-suffix
Date: Sun, 12 Nov 2023 20:04:08 -0500 (EST)

branch: externals/transient
commit 8098d175189b2f0f4c9057548d7cab24ca558dc4
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>

    transient--make-predicate-map: Fix handling of transient-suffix
    
    The value of the prefix's `transient-suffix' slot has to be handled
    differently for different types of suffixes.  It makes little sense
    to use a predicate as value, and a boolean should be used instead.
    
    In the past a predicate had to be used, so we have no choice but to
    continue to support that, and for uniform suffixes it may still make
    sense to use a predicate.  Also substitute some known predicates based
    on the suffix type.
    
    - Infixes must disregard the default transient behavior specified
      for all suffixes of the current prefix.
    
      For a select few infixes a different behavior might make sense.
      If so, then that must be specified for those infixes individually.
    
    - Sub-prefixes must honor the default transient behavior specified for
      all suffixes of the current outer prefix, but to do that they have
      to use predicates different from those used for regular suffixes.
    
    The default transient behavior is interpreted more restrictively than
    the transient behavior explicitly specified for a single suffix, to
    limit surprising behavior but still allow funky behavior if one really
    wants that.
---
 lisp/transient.el | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/lisp/transient.el b/lisp/transient.el
index df2b349e61..1e83c33eef 100644
--- a/lisp/transient.el
+++ b/lisp/transient.el
@@ -1782,9 +1782,14 @@ of the corresponding object."
          ((not (lookup-key transient-predicate-map (vector cmd)))
           (define-key map (vector cmd)
             (pcase (list kind default)
+              (`(prefix ,(or 'transient--do-stay 'transient--do-call))
+               #'transient--do-recurse)
+              ('(prefix   t) #'transient--do-recurse)
               (`(prefix  ,_) #'transient--do-replace)
-              (`(,_     nil) #'transient--do-exit)
-              (`(,_     ,do) do)))))))
+              (`(infix   ,_) #'transient--do-stay)
+              ('(suffix   t) #'transient--do-call)
+              ('(suffix nil) #'transient--do-exit)
+              (`(suffix ,do) do)))))))
     map))
 
 (defun transient--make-redisplay-map ()



reply via email to

[Prev in Thread] Current Thread [Next in Thread]