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

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

[elpa] externals/transient b3f3aa034a 09/25: transient-init-value: Defin


From: Jonas Bernoulli
Subject: [elpa] externals/transient b3f3aa034a 09/25: transient-init-value: Define noop method for transient-suffix
Date: Tue, 3 Dec 2024 14:35:01 -0500 (EST)

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

    transient-init-value: Define noop method for transient-suffix
    
    Previously this was handled by the default method we used to create
    with `cl-defgeneric'.  If no method is defined for a third-party class
    directly deriving from `transient-infix' this now results in a useful
    error.
---
 lisp/transient.el | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/lisp/transient.el b/lisp/transient.el
index 8a82587e14..f9bdc08b2d 100644
--- a/lisp/transient.el
+++ b/lisp/transient.el
@@ -3190,16 +3190,13 @@ such as when suggesting a new feature or reporting an 
issue."
 ;;; Value
 ;;;; Init
 
-(cl-defgeneric transient-init-value (_)
+(cl-defgeneric transient-init-value (obj)
   "Set the initial value of the object OBJ.
 
 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)
+Third-party subclasses of `transient-infix' must implement a primary
+method.")
 
 (cl-defmethod transient-init-value :around ((obj transient-prefix))
   "If bound, then call OBJ's `init-value' function.
@@ -3223,6 +3220,10 @@ Otherwise call the primary method according to object's 
class."
               (cdr saved)
             (transient-default-value obj)))))
 
+(cl-defmethod transient-init-value ((_   transient-suffix))
+  "Non-infix suffixes usually don't have a value, so this is a noop."
+  nil)
+
 (cl-defmethod transient-init-value ((obj transient-argument))
   (oset obj value
         (let ((value (oref transient--prefix value))



reply via email to

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