GNU bug report logs - #73098
setopt float warning unexpected

Previous Next

Package: emacs;

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.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#73098: closed (setopt float warning unexpected)
Date: Sat, 14 Sep 2024 09:36:01 +0000
[Message part 1 (text/plain, inline)]
Your message dated Sat, 14 Sep 2024 12:35:27 +0300
with message-id <86ldzuh928.fsf <at> gnu.org>
and subject line Re: bug#73098: setopt float warning unexpected
has caused the debbugs.gnu.org bug report #73098,
regarding setopt float warning unexpected
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
73098: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=73098
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Ship Mints <shipmints <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: setopt float warning unexpected
Date: Sat, 7 Sep 2024 09:14:54 -0400
[Message part 3 (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 4 (text/html, inline)]
[Message part 5 (message/rfc822, inline)]
From: Eli Zaretskii <eliz <at> gnu.org>
To: Ship Mints <shipmints <at> gmail.com>
Cc: michael_heerdegen <at> web.de, 73098-done <at> debbugs.gnu.org,
 stefankangas <at> gmail.com, monnier <at> iro.umontreal.ca
Subject: Re: bug#73098: setopt float warning unexpected
Date: Sat, 14 Sep 2024 12:35:27 +0300
> 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.


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.