all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Ship Mints <shipmints@gmail.com>
To: Stefan Kangas <stefankangas@gmail.com>
Cc: Michael Heerdegen <michael_heerdegen@web.de>,
	Eli Zaretskii <eliz@gnu.org>,
	73098@debbugs.gnu.org, Stefan Monnier <monnier@iro.umontreal.ca>
Subject: bug#73098: setopt float warning unexpected
Date: Fri, 13 Sep 2024 11:11:18 -0400	[thread overview]
Message-ID: <CAN+1HboWuLnisWh2qzzwQ85TzpmN790me9MrvQjsfd0gxvVi+A@mail.gmail.com> (raw)
In-Reply-To: <CADwFkmmznOB=S6gKGx741BksO5ZKd1KSpuAEwLa6O7wbCFyD+w@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1807 bytes --]

Happy for the thoughtful feedback.

Perhaps, some expanded advice in the docstring for setopt?

"Set VARIABLE/VALUE pairs with enforced types, and return the final VALUE.

This is like setq, but is meant for user options instead of
plain variables.  This means that setopt will execute any
custom-set form associated with VARIABLE, and strictly ensure
that VALUE is of the type declared by the user option.

Example: If the user option is declared to accept a `float',
set the option to 2.0, not to 2 which is considered an `integer'.

Note: Many user options accept more complex types than a scalar
float and that may pose a challenge to address when setting them
in elisp using setopt.

If you encounter a discrepancy that cannot be addressed by amending
the type specified by a setopt call, and you can deem the desired
type compatible nonetheless, use setq. If the user option has an
associated \"setter\" you may invoke it manually using ???"

Then there's the twist that some options force content checks, not just
type checks. An example of a user option that is intended to be overridden
with custom entries is tab-bar-format. The setopt type checker will barf on
entries not strictly in the tab-bar-format pre-populated list despite the
type being a normal hook.


On Wed, Sep 11, 2024 at 6:53 PM Stefan Kangas <stefankangas@gmail.com>
wrote:

> Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of
> text editors" <bug-gnu-emacs@gnu.org> writes:
>
> > I tend to agree.  If the type doesn't accept the value, you can use
> > something lower-level than `setopt`, while you argue with the maintainer
> > to try and get them to change their type.
> >
> > IMO, the whole point of `setopt` is to check the value against the type.
>
> +1
>

[-- Attachment #2: Type: text/html, Size: 3551 bytes --]

  reply	other threads:[~2024-09-13 15:11 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-07 13:14 bug#73098: setopt float warning unexpected Ship Mints
2024-09-08  6:06 ` Eli Zaretskii
2024-09-08 10:59   ` Ship Mints
2024-09-08 11:08     ` Eli Zaretskii
2024-09-08 11:15       ` Ship Mints
2024-09-09 15:11         ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-09 15:28           ` Eli Zaretskii
2024-09-09 15:35             ` Ship Mints
2024-09-09 16:40               ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-09 16:38             ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-09 17:37               ` Eli Zaretskii
2024-09-09 17:46                 ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-09 19:02                   ` Eli Zaretskii
2024-09-09 22:41             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-10  8:22               ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-10 11:58                 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-10 11:36               ` Eli Zaretskii
2024-09-11 22:53               ` Stefan Kangas
2024-09-13 15:11                 ` Ship Mints [this message]
2024-09-13 15:28                   ` Eli Zaretskii
2024-09-13 17:14                     ` Ship Mints
2024-09-13 18:27                       ` Drew Adams via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-14  9:35                       ` Eli Zaretskii
2024-09-13 19:09                   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-09-13 19:26                     ` Ship Mints
2024-09-13 19:38                       ` Ship Mints
2024-09-14  6:15                         ` Eli Zaretskii
2024-09-14 12:33                           ` Ship Mints
2024-09-08 11:39     ` Andreas Schwab
2024-09-08 12:28       ` Ship Mints

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=CAN+1HboWuLnisWh2qzzwQ85TzpmN790me9MrvQjsfd0gxvVi+A@mail.gmail.com \
    --to=shipmints@gmail.com \
    --cc=73098@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=michael_heerdegen@web.de \
    --cc=monnier@iro.umontreal.ca \
    --cc=stefankangas@gmail.com \
    /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.