all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Jonas Bernoulli <jonas@bernoul.li>
Cc: emacs-devel@gnu.org
Subject: Re: [elpa] externals/transient 667ce2b287 18/23: Use transient-default-value in transient-init-value(suffix)
Date: Wed, 25 Dec 2024 09:14:54 -0500	[thread overview]
Message-ID: <jwv1pxvg8b5.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <20241222134440.C5563C5C27C@vcs3.savannah.gnu.org> (Jonas Bernoulli via's message of "Sun, 22 Dec 2024 08:44:40 -0500 (EST)")

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




       reply	other threads:[~2024-12-25 14:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <173487507772.3820862.14263838078882905942@vcs3.savannah.gnu.org>
     [not found] ` <20241222134440.C5563C5C27C@vcs3.savannah.gnu.org>
2024-12-25 14:14   ` Stefan Monnier [this message]
2024-12-26 14:34     ` [elpa] externals/transient 667ce2b287 18/23: Use transient-default-value in transient-init-value(suffix) Jonas Bernoulli
2024-12-27 18:06       ` Stefan Monnier
2024-12-27 19:09         ` Jonas Bernoulli
2024-12-28  3:15           ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwv1pxvg8b5.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    --cc=jonas@bernoul.li \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.