[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)))
- [elpa] externals/transient updated (c9d46a40ee -> 005e50bf46), Jonas Bernoulli, 2024/12/06
- [elpa] externals/transient 314f9863d0 3/8: manual: Document transient-save-history, Jonas Bernoulli, 2024/12/06
- [elpa] externals/transient fbd6aade63 6/8: Update some doc-strings, Jonas Bernoulli, 2024/12/06
- [elpa] externals/transient 3771e1d58c 5/8: transient-default-value: Remove transient-suffix method, Jonas Bernoulli, 2024/12/06
- [elpa] externals/transient 2f76ce107c 2/8: manual: Document in transient-show-common-commands "Essential Options", Jonas Bernoulli, 2024/12/06
- [elpa] externals/transient 8e1cf1ed16 1/8: manual: Move two more options to "Essential Options", Jonas Bernoulli, 2024/12/06
- [elpa] externals/transient eff2245b73 4/8: Never use cl-defgeneric to define the default method,
Jonas Bernoulli <=
- [elpa] externals/transient fe5fd3904f 7/8: Update manual, Jonas Bernoulli, 2024/12/06
- [elpa] externals/transient 005e50bf46 8/8: Release version 0.8.0, Jonas Bernoulli, 2024/12/06