* Re: [elpa] externals/transient 667ce2b287 18/23: Use transient-default-value in transient-init-value(suffix)
[not found] ` <20241222134440.C5563C5C27C@vcs3.savannah.gnu.org>
@ 2024-12-25 14:14 ` Stefan Monnier
0 siblings, 0 replies; only message in thread
From: Stefan Monnier @ 2024-12-25 14:14 UTC (permalink / raw)
To: Jonas Bernoulli; +Cc: emacs-devel
Hi Jonas,
> --- a/lisp/transient.el
> +++ b/lisp/transient.el
> @@ -3331,9 +3331,13 @@ Use `transient-default-value' to determine the default value."
> (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-suffix))
> + "Non-infix suffixes usually don't have a value.
> +Call `transient-default-value' but because that is a noop for
> +`transient-suffix', this function is effectively also a noop."
> + (let ((value (transient-default-value obj)))
> + (unless (eq value eieio--unbound)
> + (oset obj value value))))
>
> (cl-defmethod transient-init-value ((obj transient-argument))
> "Extract OBJ's value from the value of the prefix object."
> @@ -3379,6 +3383,11 @@ that. If the slot is unbound, return nil."
> default)
> nil))
>
> +(cl-defmethod transient-default-value ((_ transient-suffix))
> + "Return `eieio--unbound' to indicate that there is no default value.
> +Doing so causes `transient-init-value' to skip setting the `value' slot."
> + eieio--unbound)
> +
> ;;;; Read
>
> (cl-defgeneric transient-infix-read (obj)
Why use `eieio--unbound` (i.e. a variable internal to EIEIO) rather than
your own magic placeholder?
IOW, is there a good reason to break the abstraction here?
Stefan
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-12-25 14:14 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <173487507772.3820862.14263838078882905942@vcs3.savannah.gnu.org>
[not found] ` <20241222134440.C5563C5C27C@vcs3.savannah.gnu.org>
2024-12-25 14:14 ` [elpa] externals/transient 667ce2b287 18/23: Use transient-default-value in transient-init-value(suffix) Stefan Monnier
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).