branch: externals/transient
commit cc0fa80530b02493f73b870032bfcdd1435286cd
Author: Jonas Bernoulli <jo...@bernoul.li>
Commit: Jonas Bernoulli <jo...@bernoul.li>

    transient--post-command: Redisplay after universal argument
    
    We want to redisplay the transient buffer after an universal argument
    so that suffix descriptions can reflect whether that is the case or
    not.
    
    If `this-command' is the current transient prefix, then we have
    already taken care of updating the transient buffer elsewhere, so
    we do not update here.
    
    However, because `prefix-command-preserve-state' changes the value the
    values of `this-command' and `real-this-command' to the previous
    command, in our case potentially the transient prefix argument itself,
    we often ended up not updating transient buffer after a universal
    argument.
    
    We can fix that by updating if `prefix-arg' is non-nil.
    
    We cannot use `current-prefix-arg' for that purpose because it is set
    too late (in `command-execute').
    
    If that gets fixed, then we likely still would not be able to rely on
    `current-prefix-arg' and `prefix-command-preserve-state-hook' would
    have to be used record that a universal argument is in effect.
---
 lisp/transient.el | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/lisp/transient.el b/lisp/transient.el
index 8b48100c12..c0df497c06 100644
--- a/lisp/transient.el
+++ b/lisp/transient.el
@@ -2242,7 +2242,19 @@ value.  Otherwise return CHILDREN as is."
     (transient--debug 'post-command)
     (transient--with-emergency-exit
       (cond (transient--exitp (transient--post-exit))
-            ((eq this-command (oref transient--prefix command)))
+            ;; If `this-command' is the current transient prefix, then we
+            ;; have already taken care of updating the transient buffer...
+            ((and (eq this-command (oref transient--prefix command))
+                  ;; ... but if `prefix-arg' is non-nil, then the values
+                  ;; of `this-command' and `real-this-command' are untrue
+                  ;; because `prefix-command-preserve-state' changes them.
+                  ;; We cannot use `current-prefix-arg' because it is set
+                  ;; too late (in `command-execute'), and if it were set
+                  ;; earlier, then we likely still would not be able to
+                  ;; rely on it and `prefix-command-preserve-state-hook'
+                  ;; would have to be used record that a universal
+                  ;; argument is in effect.
+                  (not prefix-arg)))
             ((let ((old transient--redisplay-map)
                    (new (transient--make-redisplay-map)))
                (unless (equal old new)

Reply via email to