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

    magit--history-push: Add optional SLOT argument
    
    This is useful for transients that use different
    value slots depending on context.
---
 lisp/transient.el | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/lisp/transient.el b/lisp/transient.el
index 10787e13ee..88d6820d66 100644
--- a/lisp/transient.el
+++ b/lisp/transient.el
@@ -2242,12 +2242,12 @@ which is not the same as nil."
 
 ;;; History
 
-(defun transient--history-push ()
-  (let* ((obj transient--prefix)
-         (cmd (oref obj command))
-         (val (transient-args))
-         (hst (cons val (delete val (alist-get cmd transient-history)))))
-    (setf (alist-get cmd transient-history) hst)))
+(defun transient--history-push (&optional slot)
+  (unless slot
+    (setq slot (oref transient--prefix command)))
+  (setf (alist-get slot transient-history)
+        (let ((args (transient-args)))
+          (cons args (delete args (alist-get slot transient-history))))))
 
 (cl-defgeneric transient--history-init (obj)
   "Initialize OBJ's `value' slot.

Reply via email to