GNU bug report logs - #77173
[PATCH] Instruct users to use customize or setopt for user options that have :set-er

Previous Next

Package: emacs;

Reported by: Visuwesh <visuweshm <at> gmail.com>

Date: Sat, 22 Mar 2025 12:21:02 UTC

Severity: normal

Tags: patch

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 77173 in the body.
You can then email your comments to 77173 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#77173; Package emacs. (Sat, 22 Mar 2025 12:21:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Visuwesh <visuweshm <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 22 Mar 2025 12:21:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Visuwesh <visuweshm <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] Instruct users to use customize or setopt for user options
 that have :set-er
Date: Sat, 22 Mar 2025 17:50:31 +0530
[Message part 1 (text/plain, inline)]
Tags: patch

Seeing the discussion in bug#77157, and another recent discussion about
the same, WDYT about the attached that automatically adds the "use
setopt" filler text?

This is what doc-view-epub-font-size says with the patch applied:

    doc-view-epub-font-size is a variable defined in ‘doc-view.el’.

    Its value is nil

    Font size in points for EPUB layout.

      This variable was introduced, or its default value was changed, in
      version 29.1 of Emacs.
      You can customize this variable.
      Setting this variable directly will not usually take effect;
      use either customize or ‘setopt’, or call ‘doc-view-custom-set-epub-font-size’.

The word 'customize' in the last line is buttonised the same way as the
one in "You can customize this variable'.

[custom-set.diff (text/patch, attachment)]
[Message part 3 (text/plain, inline)]
In GNU Emacs 31.0.50 (build 39, x86_64-pc-linux-gnu, X toolkit, cairo
 version 1.18.2, Xaw scroll bars) of 2025-03-11 built on astatine
Repository revision: 7ba62284137ba162df16f55c75bda4d56da7dfe7
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12101015
System Description: Debian GNU/Linux trixie/sid

Configured using:
 'configure --with-sound=alsa --with-x-toolkit=lucid --without-xaw3d
 --without-gconf --without-libsystemd --with-cairoCFLAGS=-g3'

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#77173; Package emacs. (Sat, 22 Mar 2025 12:28:03 GMT) Full text and rfc822 format available.

Message #8 received at 77173 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Visuwesh <visuweshm <at> gmail.com>, 77173 <at> debbugs.gnu.org
Subject: Re: bug#77173: [PATCH] Instruct users to use customize or setopt for
 user options that have :set-er
Date: Sat, 22 Mar 2025 07:27:23 -0500
Visuwesh <visuweshm <at> gmail.com> writes:

> Tags: patch
>
> Seeing the discussion in bug#77157, and another recent discussion about
> the same, WDYT about the attached that automatically adds the "use
> setopt" filler text?
>
> This is what doc-view-epub-font-size says with the patch applied:
>
>     doc-view-epub-font-size is a variable defined in ‘doc-view.el’.
>
>     Its value is nil
>
>     Font size in points for EPUB layout.
>
>       This variable was introduced, or its default value was changed, in
>       version 29.1 of Emacs.
>       You can customize this variable.
>       Setting this variable directly will not usually take effect;
>       use either customize or ‘setopt’, or call ‘doc-view-custom-set-epub-font-size’.

Thanks.  Are you on a current master?

It currently says this:

    doc-view-epub-font-size is a variable defined in ‘doc-view.el’.

    Its value is nil

    Font size in points for EPUB layout.

      This variable was introduced, or its default value was changed, in
      version 29.1 of Emacs.
      You can customize this variable.
    Setting this variable with ‘setq’ has no effect; use either ‘setopt’
    or M-x customize-option to change its value.

The formatting could use improving though.

> The word 'customize' in the last line is buttonised the same way as the
> one in "You can customize this variable'.

Neat.

> diff --git a/lisp/help-fns.el b/lisp/help-fns.el
> index bbc7700c49e..32a68d37b61 100644
> --- a/lisp/help-fns.el
> +++ b/lisp/help-fns.el
> @@ -1620,12 +1620,18 @@ help-fns--run-describe-functions
>  (defun help-fns--customize-variable (variable &optional text)
>    ;; Make a link to customize if this variable can be customized.
>    (when (custom-variable-p variable)
> -    (let ((customize-label "customize"))
> +    (let ((customize-label "customize")
> +          (custom-set (get variable 'custom-set)))
>        (princ (concat "  You can " customize-label (or text " this variable.")))
> +      (when custom-set
> +        (princ (concat "\n  Setting this variable directly will not usually take effect;"
> +                       "\n  use either customize or " (substitute-quotes "`setopt'")
> +                       ", or call "
> +                       (substitute-quotes (concat "`" (symbol-name custom-set) "'.")))))
>        (with-current-buffer standard-output
>  	(save-excursion
> -          (re-search-backward (concat "\\(" customize-label "\\)"))
> -	  (help-xref-button 1 'help-customize-variable variable)))
> +          (while (re-search-backward (concat "\\(" customize-label "\\)") nil t)
> +	    (help-xref-button 1 'help-customize-variable variable))))
>        (terpri))))
>
>  (add-hook 'help-fns-describe-variable-functions
>




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#77173; Package emacs. (Sat, 22 Mar 2025 13:00:02 GMT) Full text and rfc822 format available.

Message #11 received at 77173 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Visuwesh <visuweshm <at> gmail.com>
Cc: 77173 <at> debbugs.gnu.org
Subject: Re: bug#77173: [PATCH] Instruct users to use customize or setopt for
 user options that have :set-er
Date: Sat, 22 Mar 2025 14:59:23 +0200
> From: Visuwesh <visuweshm <at> gmail.com>
> Date: Sat, 22 Mar 2025 17:50:31 +0530
> 
> Seeing the discussion in bug#77157, and another recent discussion about
> the same, WDYT about the attached that automatically adds the "use
> setopt" filler text?
> 
> This is what doc-view-epub-font-size says with the patch applied:
> 
>     doc-view-epub-font-size is a variable defined in ‘doc-view.el’.
> 
>     Its value is nil
> 
>     Font size in points for EPUB layout.
> 
>       This variable was introduced, or its default value was changed, in
>       version 29.1 of Emacs.
>       You can customize this variable.
>       Setting this variable directly will not usually take effect;
>       use either customize or ‘setopt’, or call ‘doc-view-custom-set-epub-font-size’.
> 
> The word 'customize' in the last line is buttonised the same way as the
> one in "You can customize this variable'.

What does this do when the setter is an anonymous function?  We have
quite a lot of these when a defcustom needs a :set function.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#77173; Package emacs. (Sat, 22 Mar 2025 13:48:01 GMT) Full text and rfc822 format available.

Message #14 received at 77173 <at> debbugs.gnu.org (full text, mbox):

From: Visuwesh <visuweshm <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 77173 <at> debbugs.gnu.org
Subject: Re: bug#77173: [PATCH] Instruct users to use customize or setopt
 for user options that have :set-er
Date: Sat, 22 Mar 2025 19:17:01 +0530
[Saturday March 22, 2025] Eli Zaretskii wrote:

>> From: Visuwesh <visuweshm <at> gmail.com>
>> Date: Sat, 22 Mar 2025 17:50:31 +0530
>> 
>> Seeing the discussion in bug#77157, and another recent discussion about
>> the same, WDYT about the attached that automatically adds the "use
>> setopt" filler text?
>> 
>> This is what doc-view-epub-font-size says with the patch applied:
>> 
>>     doc-view-epub-font-size is a variable defined in ‘doc-view.el’.
>> 
>>     Its value is nil
>> 
>>     Font size in points for EPUB layout.
>> 
>>       This variable was introduced, or its default value was changed, in
>>       version 29.1 of Emacs.
>>       You can customize this variable.
>>       Setting this variable directly will not usually take effect;
>>       use either customize or ‘setopt’, or call ‘doc-view-custom-set-epub-font-size’.
>> 
>> The word 'customize' in the last line is buttonised the same way as the
>> one in "You can customize this variable'.
>
> What does this do when the setter is an anonymous function?  We have
> quite a lot of these when a defcustom needs a :set function.

It currently does nothing, thanks for catching this.  I forgot to
consider lambdas when I wrote the patch earlier.  I think we can leave
out the "or call XXX" part if :set is a function?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#77173; Package emacs. (Sat, 22 Mar 2025 13:52:02 GMT) Full text and rfc822 format available.

Message #17 received at 77173 <at> debbugs.gnu.org (full text, mbox):

From: Visuwesh <visuweshm <at> gmail.com>
To: Stefan Kangas <stefankangas <at> gmail.com>
Cc: 77173 <at> debbugs.gnu.org
Subject: Re: bug#77173: [PATCH] Instruct users to use customize or setopt
 for user options that have :set-er
Date: Sat, 22 Mar 2025 19:21:16 +0530
[Saturday March 22, 2025] Stefan Kangas wrote:

> Visuwesh <visuweshm <at> gmail.com> writes:
>
>> Tags: patch
>>
>> Seeing the discussion in bug#77157, and another recent discussion about
>> the same, WDYT about the attached that automatically adds the "use
>> setopt" filler text?
>>
>> This is what doc-view-epub-font-size says with the patch applied:
>>
>>     doc-view-epub-font-size is a variable defined in ‘doc-view.el’.
>>
>>     Its value is nil
>>
>>     Font size in points for EPUB layout.
>>
>>       This variable was introduced, or its default value was changed, in
>>       version 29.1 of Emacs.
>>       You can customize this variable.
>>       Setting this variable directly will not usually take effect;
>>       use either customize or ‘setopt’, or call ‘doc-view-custom-set-epub-font-size’.
>
> Thanks.  Are you on a current master?

I haven't pulled for a few weeks now.  Should I rework the patch on top
of yours?  I think adding this bit to help-fns--customize-variable would
be cleaner, but happy to change the function you wrote instead.

> It currently says this:
>
>     doc-view-epub-font-size is a variable defined in ‘doc-view.el’.
>
>     Its value is nil
>
>     Font size in points for EPUB layout.
>
>       This variable was introduced, or its default value was changed, in
>       version 29.1 of Emacs.
>       You can customize this variable.
>     Setting this variable with ‘setq’ has no effect; use either ‘setopt’
>     or M-x customize-option to change its value.
>
> The formatting could use improving though.

Yea, I am out of ideas for the wording too.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#77173; Package emacs. (Sat, 22 Mar 2025 14:13:03 GMT) Full text and rfc822 format available.

Message #20 received at 77173 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Visuwesh <visuweshm <at> gmail.com>
Cc: 77173 <at> debbugs.gnu.org
Subject: Re: bug#77173: [PATCH] Instruct users to use customize or setopt for
 user options that have :set-er
Date: Sat, 22 Mar 2025 14:12:32 +0000
Visuwesh <visuweshm <at> gmail.com> writes:

> [Saturday March 22, 2025] Stefan Kangas wrote:
>
>> Thanks.  Are you on a current master?
>
> I haven't pulled for a few weeks now.  Should I rework the patch on top
> of yours?  I think adding this bit to help-fns--customize-variable would
> be cleaner, but happy to change the function you wrote instead.

Yes, please.  Feel free to suggest something cleaner.

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#77173; Package emacs. (Sat, 22 Mar 2025 15:30:02 GMT) Full text and rfc822 format available.

Message #23 received at 77173 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Visuwesh <visuweshm <at> gmail.com>
Cc: 77173 <at> debbugs.gnu.org
Subject: Re: bug#77173: [PATCH] Instruct users to use customize or setopt
 for user options that have :set-er
Date: Sat, 22 Mar 2025 17:29:00 +0200
> From: Visuwesh <visuweshm <at> gmail.com>
> Cc: 77173 <at> debbugs.gnu.org
> Date: Sat, 22 Mar 2025 19:17:01 +0530
> 
> [Saturday March 22, 2025] Eli Zaretskii wrote:
> 
> >> From: Visuwesh <visuweshm <at> gmail.com>
> >> Date: Sat, 22 Mar 2025 17:50:31 +0530
> >> 
> >> Seeing the discussion in bug#77157, and another recent discussion about
> >> the same, WDYT about the attached that automatically adds the "use
> >> setopt" filler text?
> >> 
> >> This is what doc-view-epub-font-size says with the patch applied:
> >> 
> >>     doc-view-epub-font-size is a variable defined in ‘doc-view.el’.
> >> 
> >>     Its value is nil
> >> 
> >>     Font size in points for EPUB layout.
> >> 
> >>       This variable was introduced, or its default value was changed, in
> >>       version 29.1 of Emacs.
> >>       You can customize this variable.
> >>       Setting this variable directly will not usually take effect;
> >>       use either customize or ‘setopt’, or call ‘doc-view-custom-set-epub-font-size’.
> >> 
> >> The word 'customize' in the last line is buttonised the same way as the
> >> one in "You can customize this variable'.
> >
> > What does this do when the setter is an anonymous function?  We have
> > quite a lot of these when a defcustom needs a :set function.
> 
> It currently does nothing, thanks for catching this.  I forgot to
> consider lambdas when I wrote the patch earlier.  I think we can leave
> out the "or call XXX" part if :set is a function?

I don't see any reasonable alternative.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#77173; Package emacs. (Sun, 23 Mar 2025 06:00:04 GMT) Full text and rfc822 format available.

Message #26 received at 77173 <at> debbugs.gnu.org (full text, mbox):

From: Visuwesh <visuweshm <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 77173 <at> debbugs.gnu.org
Subject: Re: bug#77173: [PATCH] Instruct users to use customize or setopt
 for user options that have :set-er
Date: Sun, 23 Mar 2025 11:28:53 +0530
[Message part 1 (text/plain, inline)]
[Saturday March 22, 2025] Eli Zaretskii wrote:

>> > What does this do when the setter is an anonymous function?  We have
>> > quite a lot of these when a defcustom needs a :set function.
>> 
>> It currently does nothing, thanks for catching this.  I forgot to
>> consider lambdas when I wrote the patch earlier.  I think we can leave
>> out the "or call XXX" part if :set is a function?
>
> I don't see any reasonable alternative.

Thanks, now done in the attached.  I hope symbolp is good enough to test
if :set is a named function.

[Saturday March 22, 2025] Stefan Kangas wrote:

> Visuwesh <visuweshm <at> gmail.com> writes:
>
>> [Saturday March 22, 2025] Stefan Kangas wrote:
>>
>>> Thanks.  Are you on a current master?
>>
>> I haven't pulled for a few weeks now.  Should I rework the patch on top
>> of yours?  I think adding this bit to help-fns--customize-variable would
>> be cleaner, but happy to change the function you wrote instead.
>
> Yes, please.  Feel free to suggest something cleaner.
>
> Thanks.

Thanks, I moved the setopt suggestion to help-fns--customize-variable to
keep related code in the same function.  In this process, I removed the
top TODO comment, should we keep it around?

[0001-Improve-formatting-of-setopt-suggestion-in-Help-buff.patch (text/x-diff, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#77173; Package emacs. (Tue, 25 Mar 2025 20:02:02 GMT) Full text and rfc822 format available.

Message #29 received at 77173 <at> debbugs.gnu.org (full text, mbox):

From: Rudolf Adamkovič <rudolf <at> adamkovic.org>
To: Visuwesh <visuweshm <at> gmail.com>, Eli Zaretskii <eliz <at> gnu.org>
Cc: 77173 <at> debbugs.gnu.org
Subject: Re: bug#77173: [PATCH] Instruct users to use customize or setopt
 for user options that have :set-er
Date: Tue, 25 Mar 2025 21:01:08 +0100
Visuwesh <visuweshm <at> gmail.com> writes:

> +  ... will not usually take effect; ...

Perhaps "may not take effect"?

Rudy
-- 
"'Contrariwise,' continued Tweedledee, 'if it was so, it might be; and
if it were so, it would be; but as it isn't, it ain't.  That's logic.'"
--- Lewis Carroll, Through the Looking Glass, 1871/1872

Rudolf Adamkovič <rudolf <at> adamkovic.org> [he/him]
http://adamkovic.org




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#77173; Package emacs. (Wed, 26 Mar 2025 03:54:01 GMT) Full text and rfc822 format available.

Message #32 received at 77173 <at> debbugs.gnu.org (full text, mbox):

From: Visuwesh <visuweshm <at> gmail.com>
To: Rudolf Adamkovič <rudolf <at> adamkovic.org>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 77173 <at> debbugs.gnu.org
Subject: Re: bug#77173: [PATCH] Instruct users to use customize or setopt
 for user options that have :set-er
Date: Wed, 26 Mar 2025 09:23:34 +0530
[Message part 1 (text/plain, inline)]
[Tuesday March 25, 2025] Rudolf Adamkovič wrote:

> Visuwesh <visuweshm <at> gmail.com> writes:
>
>> +  ... will not usually take effect; ...
>
> Perhaps "may not take effect"?

Thanks, that's better.  Updated patch attached.

[0001-Improve-formatting-of-setopt-suggestion-in-Help-buff.patch (text/x-diff, attachment)]

Reply sent to Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility. (Sat, 05 Apr 2025 08:48:02 GMT) Full text and rfc822 format available.

Notification sent to Visuwesh <visuweshm <at> gmail.com>:
bug acknowledged by developer. (Sat, 05 Apr 2025 08:48:02 GMT) Full text and rfc822 format available.

Message #37 received at 77173-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Visuwesh <visuweshm <at> gmail.com>
Cc: rudolf <at> adamkovic.org, 77173-done <at> debbugs.gnu.org
Subject: Re: bug#77173: [PATCH] Instruct users to use customize or setopt
 for user options that have :set-er
Date: Sat, 05 Apr 2025 11:47:07 +0300
> From: Visuwesh <visuweshm <at> gmail.com>
> Cc: Eli Zaretskii <eliz <at> gnu.org>,  77173 <at> debbugs.gnu.org
> Date: Wed, 26 Mar 2025 09:23:34 +0530
> 
> [Tuesday March 25, 2025] Rudolf Adamkovič wrote:
> 
> > Visuwesh <visuweshm <at> gmail.com> writes:
> >
> >> +  ... will not usually take effect; ...
> >
> > Perhaps "may not take effect"?
> 
> Thanks, that's better.  Updated patch attached.

Thanks, installed on the master branch, and closing the bug.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 03 May 2025 11:24:17 GMT) Full text and rfc822 format available.

This bug report was last modified 106 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.