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

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

[elpa] externals/transient c8d0a17eba 207/366: transient--init-prefix: N


From: Jonas Bernoulli
Subject: [elpa] externals/transient c8d0a17eba 207/366: transient--init-prefix: New function
Date: Tue, 25 Jan 2022 18:54:41 -0500 (EST)

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

    transient--init-prefix: New function
    
    By calling this function directly one can get the value of the
    transient without actually invoking the transient prefix command.
---
 lisp/transient.el | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/lisp/transient.el b/lisp/transient.el
index fe348a641a..980f8321de 100644
--- a/lisp/transient.el
+++ b/lisp/transient.el
@@ -1645,15 +1645,7 @@ value.  Otherwise return CHILDREN as is."
     children))
 
 (defun transient--init-objects (name layout params)
-  (setq transient--prefix
-        (let ((proto (get name 'transient--prefix)))
-          (apply #'clone proto
-                 :prototype proto
-                 :level (or (alist-get
-                             t (alist-get name transient-levels))
-                            transient-default-level)
-                 params)))
-  (transient-init-value transient--prefix)
+  (setq transient--prefix (transient--init-prefix name params))
   (setq transient--layout
         (or layout
             (let ((levels (alist-get name transient-levels)))
@@ -1673,6 +1665,16 @@ value.  Otherwise return CHILDREN as is."
                          (list def)))))
           (cl-mapcan #'s transient--layout))))
 
+(defun transient--init-prefix (name &optional params)
+  (let ((obj (let ((proto (get name 'transient--prefix)))
+               (apply #'clone proto
+                      :prototype proto
+                      :level (or (alist-get t (alist-get name 
transient-levels))
+                                 transient-default-level)
+                      params))))
+    (transient-init-value obj)
+    obj))
+
 (defun transient--init-child (levels spec)
   (cl-etypecase spec
     (vector  (transient--init-group  levels spec))



reply via email to

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