GNU bug report logs -
#73098
setopt float warning unexpected
Previous Next
Reported by: Ship Mints <shipmints <at> gmail.com>
Date: Sat, 7 Sep 2024 13:16:01 UTC
Severity: normal
Done: Eli Zaretskii <eliz <at> gnu.org>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 73098 in the body.
You can then email your comments to 73098 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#73098
; Package
emacs
.
(Sat, 07 Sep 2024 13:16:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Ship Mints <shipmints <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Sat, 07 Sep 2024 13:16:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
This one bit me yesterday on Emacs 29.3 as I was revising my init file (for
the thousandth time this week).
As setopt becomes more widely recommended, people will likely encounter
situations like the below where they expect constant numeric types to be
coerced.
(defcustom temp-float "Float"
"Float type."
:type 'float)
(setopt temp-float 2.0) ; works
(setopt temp-float 2) ; Warning (emacs): Value '2' does not match type float
-Stephane
P.S. I reported a bug to Prot as some much more complex modus defcustom
type definitions seem either themselves broken or setopt needs some work to
accommodate them.
[Message part 2 (text/html, inline)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#73098
; Package
emacs
.
(Sun, 08 Sep 2024 06:08:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 73098 <at> debbugs.gnu.org (full text, mbox):
> From: Ship Mints <shipmints <at> gmail.com>
> Date: Sat, 7 Sep 2024 09:14:54 -0400
>
> This one bit me yesterday on Emacs 29.3 as I was revising my init file (for the thousandth time this week).
>
> As setopt becomes more widely recommended, people will likely encounter situations like the below where they
> expect constant numeric types to be coerced.
>
> (defcustom temp-float "Float"
> "Float type."
> :type 'float)
>
> (setopt temp-float 2.0) ; works
> (setopt temp-float 2) ; Warning (emacs): Value '2' does not match type float
If you are going to allow integer values, shouldn't :type be 'number,
not 'float? The documentation of 'float says:
‘float’
The value must be floating point.
"Must be floating point." The value 2 isn't.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#73098
; Package
emacs
.
(Sun, 08 Sep 2024 11:01:01 GMT)
Full text and
rfc822 format available.
Message #11 received at 73098 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Yessir. I was talking about users' likely expectations for type coercion.
There are cases in elisp where numeric type coercion is the default,
e.g., (= 2.0 2) is t. I expected it to be so here, too.
If you feel this is moot, then so be it.
On Sun, Sep 8, 2024 at 2:07 AM Eli Zaretskii <eliz <at> gnu.org> wrote:
> > From: Ship Mints <shipmints <at> gmail.com>
> > Date: Sat, 7 Sep 2024 09:14:54 -0400
> >
> > This one bit me yesterday on Emacs 29.3 as I was revising my init file
> (for the thousandth time this week).
> >
> > As setopt becomes more widely recommended, people will likely encounter
> situations like the below where they
> > expect constant numeric types to be coerced.
> >
> > (defcustom temp-float "Float"
> > "Float type."
> > :type 'float)
> >
> > (setopt temp-float 2.0) ; works
> > (setopt temp-float 2) ; Warning (emacs): Value '2' does not match type
> float
>
> If you are going to allow integer values, shouldn't :type be 'number,
> not 'float? The documentation of 'float says:
>
> ‘float’
> The value must be floating point.
>
> "Must be floating point." The value 2 isn't.
>
[Message part 2 (text/html, inline)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#73098
; Package
emacs
.
(Sun, 08 Sep 2024 11:10:02 GMT)
Full text and
rfc822 format available.
Message #14 received at 73098 <at> debbugs.gnu.org (full text, mbox):
> From: Ship Mints <shipmints <at> gmail.com>
> Date: Sun, 8 Sep 2024 06:59:31 -0400
> Cc: 73098 <at> debbugs.gnu.org
>
> Yessir. I was talking about users' likely expectations for type coercion. There are cases in elisp where numeric
> type coercion is the default, e.g., (= 2.0 2) is t. I expected it to be so here, too.
>
> If you feel this is moot, then so be it.
Let's see if there are other opinions.
But basically, you'd like 'float to be an alias for 'number, right?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#73098
; Package
emacs
.
(Sun, 08 Sep 2024 11:17:02 GMT)
Full text and
rfc822 format available.
Message #17 received at 73098 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
I'm suggesting that there will be noise from people who convert from a
working (setq some-package-option 2) to (setopt some-package-option 2).
This is not a request to change the elisp type system, it is a request to
consider if setopt's / customize internals should be relaxed to the
equivalent of #'= for these simple cases.
On Sun, Sep 8, 2024 at 7:09 AM Eli Zaretskii <eliz <at> gnu.org> wrote:
> > From: Ship Mints <shipmints <at> gmail.com>
> > Date: Sun, 8 Sep 2024 06:59:31 -0400
> > Cc: 73098 <at> debbugs.gnu.org
> >
> > Yessir. I was talking about users' likely expectations for type
> coercion. There are cases in elisp where numeric
> > type coercion is the default, e.g., (= 2.0 2) is t. I expected it to be
> so here, too.
> >
> > If you feel this is moot, then so be it.
>
> Let's see if there are other opinions.
>
> But basically, you'd like 'float to be an alias for 'number, right?
>
[Message part 2 (text/html, inline)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#73098
; Package
emacs
.
(Sun, 08 Sep 2024 11:40:03 GMT)
Full text and
rfc822 format available.
Message #20 received at 73098 <at> debbugs.gnu.org (full text, mbox):
On Sep 08 2024, Ship Mints wrote:
> There are cases in elisp where numeric type coercion is the default,
> e.g., (= 2.0 2) is t. I expected it to be so here, too.
That's because the function accepts a number, not a float. If you want
to accept any kind of number, just say so.
--
Andreas Schwab, schwab <at> linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1
"And now for something completely different."
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#73098
; Package
emacs
.
(Sun, 08 Sep 2024 12:30:02 GMT)
Full text and
rfc822 format available.
Message #23 received at 73098 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
100% correct...when one controls the code base in question. For the many
packages out there with strict types in their defcustom definitions and
with many/most users using setq over customize, there will be lots of
surprise for simple cases like this when they try setopt. Perhaps more
vocal advisories for package authors to provide updates (though many seem
fallow), and for users might be sufficient without resorting to monkey
patching. Most, I suspect, will just revert to setq and ignore custom type
validations. Most don't even check for the presence of setters and I've
assisted many in my circles with their resulting heisenbugs.
On Sun, Sep 8, 2024 at 7:39 AM Andreas Schwab <schwab <at> linux-m68k.org> wrote:
> On Sep 08 2024, Ship Mints wrote:
>
> > There are cases in elisp where numeric type coercion is the default,
> > e.g., (= 2.0 2) is t. I expected it to be so here, too.
>
> That's because the function accepts a number, not a float. If you want
> to accept any kind of number, just say so.
>
> --
> Andreas Schwab, schwab <at> linux-m68k.org
> GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1
> "And now for something completely different."
>
[Message part 2 (text/html, inline)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#73098
; Package
emacs
.
(Mon, 09 Sep 2024 15:11:02 GMT)
Full text and
rfc822 format available.
Message #26 received at 73098 <at> debbugs.gnu.org (full text, mbox):
Ship Mints <shipmints <at> gmail.com> writes:
> I'm suggesting that there will be noise from people who convert from a
> working (setq some-package-option 2) to (setopt some-package-option
> 2). This is not a request to change the elisp type system, it is a
> request to consider if setopt's / customize internals should be
> relaxed to the equivalent of #'= for these simple cases.
How about adding an option letting the user disable the type checking of
some options?
Michael.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#73098
; Package
emacs
.
(Mon, 09 Sep 2024 15:29:01 GMT)
Full text and
rfc822 format available.
Message #29 received at 73098 <at> debbugs.gnu.org (full text, mbox):
> From: Michael Heerdegen <michael_heerdegen <at> web.de>
> Cc: Eli Zaretskii <eliz <at> gnu.org>, 73098 <at> debbugs.gnu.org
> Date: Mon, 09 Sep 2024 17:11:40 +0200
>
> Ship Mints <shipmints <at> gmail.com> writes:
>
> > I'm suggesting that there will be noise from people who convert from a
> > working (setq some-package-option 2) to (setopt some-package-option
> > 2). This is not a request to change the elisp type system, it is a
> > request to consider if setopt's / customize internals should be
> > relaxed to the equivalent of #'= for these simple cases.
>
> How about adding an option letting the user disable the type checking of
> some options?
Like what? Would we accept, for example, a string where the type is
'symbol'? Or any value where type is 'boolean'?
And I'm also not sure we want this: presumably, if the defcustom's
author specified a type, they meant it, no?
Which is why I asked for opinions (but for now got only yours).
Stefan, WDYT?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#73098
; Package
emacs
.
(Mon, 09 Sep 2024 15:38:02 GMT)
Full text and
rfc822 format available.
Message #32 received at 73098 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Perhaps an alternative macro `setopt-relaxed"? Documentation should suggest
contacting package authors to request improvements (it's a very slow
process to get misspecified packages updated and not all authors mean what
they say when they themselves don't use the customize system--this group
must know this all too well).
On Mon, Sep 9, 2024 at 11:28 AM Eli Zaretskii <eliz <at> gnu.org> wrote:
> > From: Michael Heerdegen <michael_heerdegen <at> web.de>
> > Cc: Eli Zaretskii <eliz <at> gnu.org>, 73098 <at> debbugs.gnu.org
> > Date: Mon, 09 Sep 2024 17:11:40 +0200
> >
> > Ship Mints <shipmints <at> gmail.com> writes:
> >
> > > I'm suggesting that there will be noise from people who convert from a
> > > working (setq some-package-option 2) to (setopt some-package-option
> > > 2). This is not a request to change the elisp type system, it is a
> > > request to consider if setopt's / customize internals should be
> > > relaxed to the equivalent of #'= for these simple cases.
> >
> > How about adding an option letting the user disable the type checking of
> > some options?
>
> Like what? Would we accept, for example, a string where the type is
> 'symbol'? Or any value where type is 'boolean'?
>
> And I'm also not sure we want this: presumably, if the defcustom's
> author specified a type, they meant it, no?
>
> Which is why I asked for opinions (but for now got only yours).
>
> Stefan, WDYT?
>
[Message part 2 (text/html, inline)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#73098
; Package
emacs
.
(Mon, 09 Sep 2024 16:39:02 GMT)
Full text and
rfc822 format available.
Message #35 received at 73098 <at> debbugs.gnu.org (full text, mbox):
Eli Zaretskii <eliz <at> gnu.org> writes:
> > How about adding an option letting the user disable the type checking of
> > some options?
>
> Like what? Would we accept, for example, a string where the type is
> 'symbol'? Or any value where type is 'boolean'?
The new option would have as value a list of option names. The user
could then add those options with incorrect type specs. And for those
specified options Emacs would skip type checking entirely.
I _don't_ think melting types in either way would be a good idea.
Michael.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#73098
; Package
emacs
.
(Mon, 09 Sep 2024 16:40:02 GMT)
Full text and
rfc822 format available.
Message #38 received at 73098 <at> debbugs.gnu.org (full text, mbox):
Ship Mints <shipmints <at> gmail.com> writes:
> Perhaps an alternative macro `setopt-relaxed"? Documentation should
> suggest contacting package authors to request improvements (it's a
> very slow process to get misspecified packages updated and not all
> authors mean what they say when they themselves don't use the
> customize system--this group must know this all too well).
Dunno 'bout the name, but the idea sounds ok to me.
Michael.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#73098
; Package
emacs
.
(Mon, 09 Sep 2024 17:38:01 GMT)
Full text and
rfc822 format available.
Message #41 received at 73098 <at> debbugs.gnu.org (full text, mbox):
> From: Michael Heerdegen <michael_heerdegen <at> web.de>
> Cc: Stefan Monnier <monnier <at> iro.umontreal.ca>, shipmints <at> gmail.com,
> 73098 <at> debbugs.gnu.org
> Date: Mon, 09 Sep 2024 18:38:43 +0200
>
> Eli Zaretskii <eliz <at> gnu.org> writes:
>
> > > How about adding an option letting the user disable the type checking of
> > > some options?
> >
> > Like what? Would we accept, for example, a string where the type is
> > 'symbol'? Or any value where type is 'boolean'?
>
> The new option would have as value a list of option names. The user
> could then add those options with incorrect type specs. And for those
> specified options Emacs would skip type checking entirely.
Thanks, but this sounds like overkill to me.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#73098
; Package
emacs
.
(Mon, 09 Sep 2024 17:47:01 GMT)
Full text and
rfc822 format available.
Message #44 received at 73098 <at> debbugs.gnu.org (full text, mbox):
Eli Zaretskii <eliz <at> gnu.org> writes:
> Thanks, but this sounds like overkill to me.
Hmm... maybe. And the idea of an extra macro?
Michael.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#73098
; Package
emacs
.
(Mon, 09 Sep 2024 19:03:02 GMT)
Full text and
rfc822 format available.
Message #47 received at 73098 <at> debbugs.gnu.org (full text, mbox):
> From: Michael Heerdegen <michael_heerdegen <at> web.de>
> Cc: monnier <at> iro.umontreal.ca, shipmints <at> gmail.com, 73098 <at> debbugs.gnu.org
> Date: Mon, 09 Sep 2024 19:46:56 +0200
>
> Eli Zaretskii <eliz <at> gnu.org> writes:
>
> > Thanks, but this sounds like overkill to me.
>
> Hmm... maybe. And the idea of an extra macro?
Likewise.
I think we should make up our minds: either we enforce :type in setopt
or we don't.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#73098
; Package
emacs
.
(Mon, 09 Sep 2024 22:43:02 GMT)
Full text and
rfc822 format available.
Message #50 received at 73098 <at> debbugs.gnu.org (full text, mbox):
> Like what? Would we accept, for example, a string where the type is
> 'symbol'? Or any value where type is 'boolean'?
>
> And I'm also not sure we want this: presumably, if the defcustom's
> author specified a type, they meant it, no?
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.
Stefan
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#73098
; Package
emacs
.
(Tue, 10 Sep 2024 08:22:02 GMT)
Full text and
rfc822 format available.
Message #53 received at 73098 <at> debbugs.gnu.org (full text, mbox):
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:
> I tend to agree. If the type doesn't accept the value, you can use
> something lower-level than `setopt` [...]
What would that be in case the option has a custom setter function?
Michael.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#73098
; Package
emacs
.
(Tue, 10 Sep 2024 11:37:01 GMT)
Full text and
rfc822 format available.
Message #56 received at 73098 <at> debbugs.gnu.org (full text, mbox):
> From: Stefan Monnier <monnier <at> iro.umontreal.ca>
> Cc: Michael Heerdegen <michael_heerdegen <at> web.de>, shipmints <at> gmail.com,
> 73098 <at> debbugs.gnu.org
> Date: Mon, 09 Sep 2024 18:41:46 -0400
>
> IMO, the whole point of `setopt` is to check the value against the type.
I agree, but some users expect setopt to be a variant of setq,
especially since we advertise such use of setopt for modifying user
options.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#73098
; Package
emacs
.
(Tue, 10 Sep 2024 11:59:01 GMT)
Full text and
rfc822 format available.
Message #59 received at 73098 <at> debbugs.gnu.org (full text, mbox):
>> I tend to agree. If the type doesn't accept the value, you can use
>> something lower-level than `setopt` [...]
> What would that be in case the option has a custom setter function?
AFAIK people used `setq` before `setopt`. For vars that come with
setter functions, this usually doesn't work quite the same, but in 99%
it's good enough if the `setq` is performed early during startup.
You can also
(put '<SYM> 'custom-type t)
if you want to disable type-checking for a specific variable.
Stefan
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#73098
; Package
emacs
.
(Wed, 11 Sep 2024 22:55:01 GMT)
Full text and
rfc822 format available.
Message #62 received at 73098 <at> debbugs.gnu.org (full text, mbox):
Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <bug-gnu-emacs <at> 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
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#73098
; Package
emacs
.
(Fri, 13 Sep 2024 15:13:01 GMT)
Full text and
rfc822 format available.
Message #65 received at 73098 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
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 <at> gmail.com>
wrote:
> Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of
> text editors" <bug-gnu-emacs <at> 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
>
[Message part 2 (text/html, inline)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#73098
; Package
emacs
.
(Fri, 13 Sep 2024 15:29:01 GMT)
Full text and
rfc822 format available.
Message #68 received at 73098 <at> debbugs.gnu.org (full text, mbox):
> From: Ship Mints <shipmints <at> gmail.com>
> Date: Fri, 13 Sep 2024 11:11:18 -0400
> Cc: Stefan Monnier <monnier <at> iro.umontreal.ca>, Eli Zaretskii <eliz <at> gnu.org>,
> Michael Heerdegen <michael_heerdegen <at> web.de>, 73098 <at> debbugs.gnu.org
>
> Perhaps, some expanded advice in the docstring for setopt?
>
> "Set VARIABLE/VALUE pairs with enforced types, and return the final VALUE.
"Enforce" is inaccurate, since a value that doesn't match :type just
emits a warning (which can be shut up by the users, if they want), it
doesn't signal an error. And the variable is assigned the value event
if the type doesn't match.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#73098
; Package
emacs
.
(Fri, 13 Sep 2024 17:17:01 GMT)
Full text and
rfc822 format available.
Message #71 received at 73098 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Revised language:
"Set VARIABLE/VALUE pairs with type warnings, 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 will emit a
warning if VALUE is not of the type expected by the user option.
Example: If the user option is declared to accept a `float',
set the option to 2.0 rather than 2, which is considered an `integer'.
Despite the warning, the user option will still be set to VALUE."
On Fri, Sep 13, 2024 at 11:28 AM Eli Zaretskii <eliz <at> gnu.org> wrote:
> > From: Ship Mints <shipmints <at> gmail.com>
> > Date: Fri, 13 Sep 2024 11:11:18 -0400
> > Cc: Stefan Monnier <monnier <at> iro.umontreal.ca>, Eli Zaretskii <
> eliz <at> gnu.org>,
> > Michael Heerdegen <michael_heerdegen <at> web.de>,
> 73098 <at> debbugs.gnu.org
> >
> > Perhaps, some expanded advice in the docstring for setopt?
> >
> > "Set VARIABLE/VALUE pairs with enforced types, and return the final
> VALUE.
>
> "Enforce" is inaccurate, since a value that doesn't match :type just
> emits a warning (which can be shut up by the users, if they want), it
> doesn't signal an error. And the variable is assigned the value event
> if the type doesn't match.
>
[Message part 2 (text/html, inline)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#73098
; Package
emacs
.
(Fri, 13 Sep 2024 18:29:02 GMT)
Full text and
rfc822 format available.
Message #74 received at 73098 <at> debbugs.gnu.org (full text, mbox):
> setopt will execute any custom-set form
^^^^^^^^^^^^^^^
> associated with VARIABLE
1. "custom-set form" isn't mentioned, let alone
defined, in the Elisp manual. Should this
say "any defcustom :set function" instead?
2. What about what I suppose you would call a
"custom-init form", in other words, what the
Elisp manual calls ":initialize function"?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#73098
; Package
emacs
.
(Fri, 13 Sep 2024 19:10:02 GMT)
Full text and
rfc822 format available.
Message #77 received at 73098 <at> debbugs.gnu.org (full text, mbox):
> 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 ???"
You're here trying to describe workarounds to use in case of bugs
(either the value you set is wrong, or the type (or type-checker) is
wrong). We usually don't do that in docstrings.
Stefan
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#73098
; Package
emacs
.
(Fri, 13 Sep 2024 19:29:01 GMT)
Full text and
rfc822 format available.
Message #80 received at 73098 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
It was removed in a later proposed edit. I read the setopt code more deeply
and ran some tests.
On Fri, Sep 13, 2024 at 3:09 PM Stefan Monnier <monnier <at> iro.umontreal.ca>
wrote:
> > 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 ???"
>
> You're here trying to describe workarounds to use in case of bugs
> (either the value you set is wrong, or the type (or type-checker) is
> wrong). We usually don't do that in docstrings.
>
>
> Stefan
>
>
[Message part 2 (text/html, inline)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#73098
; Package
emacs
.
(Fri, 13 Sep 2024 19:40:02 GMT)
Full text and
rfc822 format available.
Message #83 received at 73098 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
The warning messages can be misleading. e.g., when trying to set
tab-bar-format-tabs-groups to include a simple lambda, it complains about
the wrong thing. It does match the hook type, but does not match the
hard-coded list of options.
(setopt tab-bar-format
`(
tab-bar-format-tabs-groups
(lambda () " ") ; tab-bar-separator
))
■ Warning (emacs): Value '(nil tab-bar-format-tabs-groups (lambda nil "
"))' does not match type hook
On Fri, Sep 13, 2024 at 3:26 PM Ship Mints <shipmints <at> gmail.com> wrote:
> It was removed in a later proposed edit. I read the setopt code more
> deeply and ran some tests.
>
> On Fri, Sep 13, 2024 at 3:09 PM Stefan Monnier <monnier <at> iro.umontreal.ca>
> wrote:
>
>> > 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 ???"
>>
>> You're here trying to describe workarounds to use in case of bugs
>> (either the value you set is wrong, or the type (or type-checker) is
>> wrong). We usually don't do that in docstrings.
>>
>>
>> Stefan
>>
>>
[Message part 2 (text/html, inline)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#73098
; Package
emacs
.
(Sat, 14 Sep 2024 06:16:02 GMT)
Full text and
rfc822 format available.
Message #86 received at 73098 <at> debbugs.gnu.org (full text, mbox):
> From: Ship Mints <shipmints <at> gmail.com>
> Date: Fri, 13 Sep 2024 15:38:28 -0400
> Cc: Stefan Kangas <stefankangas <at> gmail.com>, Eli Zaretskii <eliz <at> gnu.org>,
> Michael Heerdegen <michael_heerdegen <at> web.de>, 73098 <at> debbugs.gnu.org
>
> The warning messages can be misleading. e.g., when trying to set tab-bar-format-tabs-groups to include a
> simple lambda, it complains about the wrong thing. It does match the hook type, but does not match the
> hard-coded list of options.
>
> (setopt tab-bar-format
> `(
> tab-bar-format-tabs-groups
> (lambda () " ") ; tab-bar-separator
> ))
>
> ■ Warning (emacs): Value '(nil tab-bar-format-tabs-groups (lambda nil " "))' does not match type hook
I don't get a warning when I evaluate the above. Is this in "emacs -Q"?
Reply sent
to
Eli Zaretskii <eliz <at> gnu.org>
:
You have taken responsibility.
(Sat, 14 Sep 2024 09:36:01 GMT)
Full text and
rfc822 format available.
Notification sent
to
Ship Mints <shipmints <at> gmail.com>
:
bug acknowledged by developer.
(Sat, 14 Sep 2024 09:36:01 GMT)
Full text and
rfc822 format available.
Message #91 received at 73098-done <at> debbugs.gnu.org (full text, mbox):
> From: Ship Mints <shipmints <at> gmail.com>
> Date: Fri, 13 Sep 2024 13:14:59 -0400
> Cc: stefankangas <at> gmail.com, monnier <at> iro.umontreal.ca, michael_heerdegen <at> web.de,
> 73098 <at> debbugs.gnu.org
>
> Revised language:
>
> "Set VARIABLE/VALUE pairs with type warnings, 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 will emit a
> warning if VALUE is not of the type expected by the user option.
>
> Example: If the user option is declared to accept a `float',
> set the option to 2.0 rather than 2, which is considered an `integer'.
>
> Despite the warning, the user option will still be set to VALUE."
Thanks. Since there seems to be a consensus that 'setopt' should
continue emitting the warning, I added to the doc string a note about
the warning (on the emacs-30 branch), and I'm now closing this bug.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#73098
; Package
emacs
.
(Sat, 14 Sep 2024 12:35:01 GMT)
Full text and
rfc822 format available.
Message #94 received at 73098 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
I didn't try -Q assuming this behavior would be unaffected. I'll try to
keep this simple case in mind for future reproducers and go native when
practical. Thank you for the docstring edits.
On Sat, Sep 14, 2024 at 2:15 AM Eli Zaretskii <eliz <at> gnu.org> wrote:
> > From: Ship Mints <shipmints <at> gmail.com>
> > Date: Fri, 13 Sep 2024 15:38:28 -0400
> > Cc: Stefan Kangas <stefankangas <at> gmail.com>, Eli Zaretskii <eliz <at> gnu.org>,
>
> > Michael Heerdegen <michael_heerdegen <at> web.de>,
> 73098 <at> debbugs.gnu.org
> >
> > The warning messages can be misleading. e.g., when trying to set
> tab-bar-format-tabs-groups to include a
> > simple lambda, it complains about the wrong thing. It does match the
> hook type, but does not match the
> > hard-coded list of options.
> >
> > (setopt tab-bar-format
> > `(
> > tab-bar-format-tabs-groups
> > (lambda () " ") ; tab-bar-separator
> > ))
> >
> > ■ Warning (emacs): Value '(nil tab-bar-format-tabs-groups (lambda nil
> " "))' does not match type hook
>
> I don't get a warning when I evaluate the above. Is this in "emacs -Q"?
>
[Message part 2 (text/html, inline)]
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Sun, 13 Oct 2024 11:24:13 GMT)
Full text and
rfc822 format available.
This bug report was last modified 342 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.