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

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

[elpa] externals/transient eff2245b73 4/8: Never use cl-defgeneric to de


From: Jonas Bernoulli
Subject: [elpa] externals/transient eff2245b73 4/8: Never use cl-defgeneric to define the default method
Date: Fri, 6 Dec 2024 17:05:57 -0500 (EST)

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

    Never use cl-defgeneric to define the default method
---
 lisp/transient.el | 25 +++++++++++++++++--------
 1 file changed, 17 insertions(+), 8 deletions(-)

diff --git a/lisp/transient.el b/lisp/transient.el
index 4af1f48bda..229c1bf06e 100644
--- a/lisp/transient.el
+++ b/lisp/transient.el
@@ -2152,7 +2152,9 @@ EDIT may be non-nil."
   "Setup the CHILDREN of GROUP.
 If the value of the `setup-children' slot is non-nil, then call
 that function with CHILDREN as the only argument and return the
-value.  Otherwise return CHILDREN as is."
+value.  Otherwise return CHILDREN as is.")
+
+(cl-defmethod transient-setup-children ((group transient-group) children)
   (if (slot-boundp group 'setup-children)
       (funcall (oref group setup-children) children)
     children))
@@ -3326,9 +3328,8 @@ Use `transient-default-value' to determine the default 
value."
 
 ;;;; Default
 
-(cl-defgeneric transient-default-value (_)
-  "Return the default value."
-  nil)
+(cl-defgeneric transient-default-value (obj)
+  "Return the default value.")
 
 (cl-defmethod transient-default-value ((obj transient-prefix))
   "Return the default value as specified by the `default-value' slot.
@@ -3342,6 +3343,10 @@ that.  If the slot is unbound, return nil."
         default)
     nil))
 
+(cl-defmethod transient-default-value ((_   transient-suffix))
+  "Return nil."
+  nil)
+
 ;;;; Read
 
 (cl-defgeneric transient-infix-read (obj)
@@ -3822,14 +3827,18 @@ If no prefix matches, return nil."
 ;;; History
 
 (cl-defgeneric transient--history-key (obj)
-  "Return OBJ's history key.
-If the value of the `history-key' slot is non-nil, then return
-that.  Otherwise return the value of the `command' slot."
+  "Return OBJ's history key.")
+
+(cl-defmethod transient--history-key ((obj transient-prefix))
+  "If the value of the `history-key' slot is non-nil, return that.
+Otherwise return the value of the `command' slot."
   (or (oref obj history-key)
       (oref obj command)))
 
 (cl-defgeneric transient--history-push (obj)
-  "Push the current value of OBJ to its entry in `transient-history'."
+  "Push the current value of OBJ to its entry in `transient-history'.")
+
+(cl-defmethod transient--history-push ((obj transient-prefix))
   (let ((key (transient--history-key obj)))
     (setf (alist-get key transient-history)
           (let ((args (transient-get-value)))



reply via email to

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