[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/transient 2872b4a661 045/366: transient-init-value: Def
From: |
Jonas Bernoulli |
Subject: |
[elpa] externals/transient 2872b4a661 045/366: transient-init-value: Define for transient-prefix |
Date: |
Tue, 25 Jan 2022 18:54:25 -0500 (EST) |
branch: externals/transient
commit 2872b4a6619f973ef5d4bd56753dae67a4e0343c
Author: Jonas Bernoulli <jonas@bernoul.li>
Commit: Jonas Bernoulli <jonas@bernoul.li>
transient-init-value: Define for transient-prefix
---
lisp/transient.el | 41 +++++++++++++++++++++--------------------
1 file changed, 21 insertions(+), 20 deletions(-)
diff --git a/lisp/transient.el b/lisp/transient.el
index 355be2442a..c441903ecc 100644
--- a/lisp/transient.el
+++ b/lisp/transient.el
@@ -1352,19 +1352,14 @@ EDIT may be non-nil."
(defun transient--init-objects (name layout params)
(setq transient--prefix
- (let* ((proto (get name 'transient--prefix))
- (clone (apply #'clone proto
- :prototype proto
- :level (or (alist-get
- t (alist-get name transient-levels))
- transient-default-level)
- params))
- (value (oref proto value)))
- (if (functionp value)
- (oset clone value (funcall value))
- (when-let ((saved (assq name transient-values)))
- (oset clone value (cdr saved))))
- clone))
+ (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--layout
(or layout
(let ((levels (alist-get name transient-levels)))
@@ -1962,15 +1957,21 @@ implementation, which is a noop.")
(cl-defgeneric transient-init-value (_)
"Set the initial value of the object OBJ.
-This function is called for all suffix commands, but unless a
-concrete method is implemented this falls through to the default
-implementation, which is a noop. In other words this usually
-only does something for infix commands, but note that this is
-not implemented for the abstract class `transient-infix', so if
-your class derives from that directly, then you must implement
-a method."
+This function is called for all prefix and suffix commands.
+
+For suffix commands (including infix argument commands) the
+default implementation is a noop. Classes derived from the
+abstract `transient-infix' class must implement this function.
+Non-infix suffix commands usually don't have a value."
nil)
+(cl-defmethod transient-init-value ((obj transient-prefix))
+ (let ((value (oref obj value)))
+ (if (functionp value)
+ (oset obj value (funcall value))
+ (when-let ((saved (assq (oref obj command) transient-values)))
+ (oset obj value (cdr saved))))))
+
(cl-defmethod transient-init-value ((obj transient-switch))
(oset obj value
(car (member (oref obj argument)
- [elpa] externals/transient 2033ac1ed9 031/366: transient-mode-line-format: New option, (continued)
- [elpa] externals/transient 2033ac1ed9 031/366: transient-mode-line-format: New option, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient 08b4778890 033/366: Make it trivial to use "q" to quit again, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient 9429cb628a 035/366: transient-scroll-down: Fix pasto, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient 7e45a57ec8 030/366: No longer depend on lv to display the transient buffer, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient 625683c9ea 029/366: transient--pre-exit: Don't reselect original window, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient a2dada29c8 034/366: manual: Add a FAQ, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient a2222d294c 038/366: transient-base-map: New parent of other shared keymaps, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient b1da0cab5d 040/366: Remove my personal key bindings, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient bbf81297c6 041/366: Prevent infix commands from being added to command-history, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient a6295fa7ee 042/366: Declare that prefix and suffix commands are for interactive use only, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient 2872b4a661 045/366: transient-init-value: Define for transient-prefix,
Jonas Bernoulli <=
- [elpa] externals/transient a47ae9499b 049/366: transient-{set, save}: Support exiting the transient, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient 9e30038d2d 051/366: transient-set-level: Limit when it is called, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient 544b3bb864 057/366: Support automatically disabling incompatible arguments, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient 28aac32e82 058/366: Fix previous commit, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient 4f7ee36899 060/366: transient-infix-set: Bugfixes, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient 7a7c3e15b6 065/366: transient-show-popup: Support even suppressing one-line summary, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient d7a1e81440 067/366: transient-show-popup: Update documentation, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient 5a360bb206 090/366: Remove conflicting suffix when inserting new suffix, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient 4ce1868e62 091/366: Fix replacing a suffix with another suffix bound to same key, Jonas Bernoulli, 2022/01/25
- [elpa] externals/transient 52fb9a6c07 093/366: transient--insert-suffix: Cosmetics, Jonas Bernoulli, 2022/01/25