GNU bug report logs - #77510
31.0.50; help-customize fails with multiply defined symbols

Previous Next

Package: emacs;

Reported by: Stephen Berman <stephen.berman <at> gmx.net>

Date: Thu, 3 Apr 2025 22:17:02 UTC

Severity: normal

Found in version 31.0.50

Done: Dmitry Gutov <dmitry <at> gutov.dev>

To reply to this bug, email your comments to 77510 AT debbugs.gnu.org.
There is no need to reopen the bug first.

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#77510; Package emacs. (Thu, 03 Apr 2025 22:17:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Stephen Berman <stephen.berman <at> gmx.net>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 03 Apr 2025 22:17:02 GMT) Full text and rfc822 format available.

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

From: Stephen Berman <stephen.berman <at> gmx.net>
To: bug-gnu-emacs <at> gnu.org
Subject: 31.0.50; help-customize fails with multiply defined symbols
Date: Fri, 04 Apr 2025 00:16:45 +0200
[Message part 1 (text/plain, inline)]
0. emacs -Q
1. Type `C-h o fringe-mode RET' to pop up a *Help* buffer displaying
   help for both the function fringe-mode and the variable fringe-mode.
2. In the *Help* buffer type `c'.
=> Emacs dings and displays the message "No variable or face to customize"

When executing this recipe in emacs-30, after step 2 Emacs switches to a
*Customize* buffer for the variable fringe-mode, which is the expected
behavior after typing `c' (help-customize) in *Help*.  This is broken in
master.  The breakage is due to this commit:

commit e776df2a3eae0454ea85287e15ebba649bf8e918
Author:     Dmitry Gutov <dmitry <at> gutov.dev>
Commit:     Dmitry Gutov <dmitry <at> gutov.dev>
CommitDate: Sun Oct 6 04:32:00 2024 +0300

    help-setup-xref: Keep the local values only of some variables

    * lisp/help-mode.el (help-setup-xref): Kill all local variables,
    saving ones that are known to need to be preserved (bug#73637).

and the breakage remained after the two followup commits, which is the
current code state.

According to my debugging, calling help-setup-xref at the end of
describe-symbol after the function definition help has been added to the
*Help* buffer nullifies the property list of help-mode--current-data
(this happens on evaluating `(funcall major-mode)' in help-setup-xref
when the value of major-mode is 'help-mode), which renders
help-customize a noop.  The following patch fixes the breakage according
to my brief testing, though I'm not sure it doesn't have unwanted
side-effects (but at least I get the same test results on running make
check with the patch as without it).

[Message part 2 (text/x-patch, inline)]
diff --git a/lisp/help-mode.el b/lisp/help-mode.el
index 7f272de790e..102c92fbb04 100644
--- a/lisp/help-mode.el
+++ b/lisp/help-mode.el
@@ -506,7 +506,7 @@ help-setup-xref
 restore it properly when going back."
   (with-current-buffer (help-buffer)
     ;; Re-enable major mode, killing all unrelated local vars.
-    (funcall major-mode)
+    (unless (eq major-mode 'help-mode) (funcall major-mode))
     (when help-xref-stack-item
       (push (cons (point) help-xref-stack-item) help-xref-stack)
       (setq help-xref-forward-stack nil))
[Message part 3 (text/plain, inline)]
In GNU Emacs 31.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
 3.24.49, cairo version 1.18.4) of 2025-04-04 built on strobelfs2
Repository revision: 37262eac0525562ac03fe84e6f657de908808245
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12101016
System Description: Linux From Scratch r12.3-10

Configured using:
 'configure -C 'CFLAGS=-Og -g3' PKG_CONFIG_PATH=/opt/qt6/lib/pkgconfig'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
LCMS2 LIBSYSTEMD LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG
RSVG SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER
WEBP X11 XDBE XIM XINERAMA XINPUT2 XPM XRANDR GTK3 ZLIB

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#77510; Package emacs. (Fri, 11 Apr 2025 08:21:01 GMT) Full text and rfc822 format available.

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

From: Stephen Berman <stephen.berman <at> gmx.net>
To: 77510 <at> debbugs.gnu.org
Subject: Re: bug#77510: 31.0.50; help-customize fails with multiply defined
 symbols
Date: Fri, 11 Apr 2025 10:20:13 +0200
On Fri, 04 Apr 2025 00:16:45 +0200 Stephen Berman <stephen.berman <at> gmx.net> wrote:

> 0. emacs -Q
> 1. Type `C-h o fringe-mode RET' to pop up a *Help* buffer displaying
>    help for both the function fringe-mode and the variable fringe-mode.
> 2. In the *Help* buffer type `c'.
> => Emacs dings and displays the message "No variable or face to customize"
>
> When executing this recipe in emacs-30, after step 2 Emacs switches to a
> *Customize* buffer for the variable fringe-mode, which is the expected
> behavior after typing `c' (help-customize) in *Help*.  This is broken in
> master.  The breakage is due to this commit:
>
> commit e776df2a3eae0454ea85287e15ebba649bf8e918
> Author:     Dmitry Gutov <dmitry <at> gutov.dev>
> Commit:     Dmitry Gutov <dmitry <at> gutov.dev>
> CommitDate: Sun Oct 6 04:32:00 2024 +0300
>
>     help-setup-xref: Keep the local values only of some variables
>
>     * lisp/help-mode.el (help-setup-xref): Kill all local variables,
>     saving ones that are known to need to be preserved (bug#73637).
>
> and the breakage remained after the two followup commits, which is the
> current code state.
>
> According to my debugging, calling help-setup-xref at the end of
> describe-symbol after the function definition help has been added to the
> *Help* buffer nullifies the property list of help-mode--current-data
> (this happens on evaluating `(funcall major-mode)' in help-setup-xref
> when the value of major-mode is 'help-mode), which renders
> help-customize a noop.  The following patch fixes the breakage according
> to my brief testing, though I'm not sure it doesn't have unwanted
> side-effects (but at least I get the same test results on running make
> check with the patch as without it).
>
> diff --git a/lisp/help-mode.el b/lisp/help-mode.el
> index 7f272de790e..102c92fbb04 100644
> --- a/lisp/help-mode.el
> +++ b/lisp/help-mode.el
> @@ -506,7 +506,7 @@ help-setup-xref
>  restore it properly when going back."
>    (with-current-buffer (help-buffer)
>      ;; Re-enable major mode, killing all unrelated local vars.
> -    (funcall major-mode)
> +    (unless (eq major-mode 'help-mode) (funcall major-mode))
>      (when help-xref-stack-item
>        (push (cons (point) help-xref-stack-item) help-xref-stack)
>        (setq help-xref-forward-stack nil))

Is there any objection to installing this patch to fix the regression?

Steve Berman




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#77510; Package emacs. (Fri, 11 Apr 2025 09:04:01 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Stephen Berman <stephen.berman <at> gmx.net>,
 Dmitry Gutov <dmitry <at> gutov.dev>
Cc: 77510 <at> debbugs.gnu.org
Subject: Re: bug#77510: 31.0.50;
 help-customize fails with multiply defined symbols
Date: Fri, 11 Apr 2025 12:02:22 +0300
> Date: Fri, 11 Apr 2025 10:20:13 +0200
> From:  Stephen Berman via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
> 
> On Fri, 04 Apr 2025 00:16:45 +0200 Stephen Berman <stephen.berman <at> gmx.net> wrote:
> 
> > 0. emacs -Q
> > 1. Type `C-h o fringe-mode RET' to pop up a *Help* buffer displaying
> >    help for both the function fringe-mode and the variable fringe-mode.
> > 2. In the *Help* buffer type `c'.
> > => Emacs dings and displays the message "No variable or face to customize"
> >
> > When executing this recipe in emacs-30, after step 2 Emacs switches to a
> > *Customize* buffer for the variable fringe-mode, which is the expected
> > behavior after typing `c' (help-customize) in *Help*.  This is broken in
> > master.  The breakage is due to this commit:
> >
> > commit e776df2a3eae0454ea85287e15ebba649bf8e918
> > Author:     Dmitry Gutov <dmitry <at> gutov.dev>
> > Commit:     Dmitry Gutov <dmitry <at> gutov.dev>
> > CommitDate: Sun Oct 6 04:32:00 2024 +0300
> >
> >     help-setup-xref: Keep the local values only of some variables
> >
> >     * lisp/help-mode.el (help-setup-xref): Kill all local variables,
> >     saving ones that are known to need to be preserved (bug#73637).
> >
> > and the breakage remained after the two followup commits, which is the
> > current code state.
> >
> > According to my debugging, calling help-setup-xref at the end of
> > describe-symbol after the function definition help has been added to the
> > *Help* buffer nullifies the property list of help-mode--current-data
> > (this happens on evaluating `(funcall major-mode)' in help-setup-xref
> > when the value of major-mode is 'help-mode), which renders
> > help-customize a noop.  The following patch fixes the breakage according
> > to my brief testing, though I'm not sure it doesn't have unwanted
> > side-effects (but at least I get the same test results on running make
> > check with the patch as without it).
> >
> > diff --git a/lisp/help-mode.el b/lisp/help-mode.el
> > index 7f272de790e..102c92fbb04 100644
> > --- a/lisp/help-mode.el
> > +++ b/lisp/help-mode.el
> > @@ -506,7 +506,7 @@ help-setup-xref
> >  restore it properly when going back."
> >    (with-current-buffer (help-buffer)
> >      ;; Re-enable major mode, killing all unrelated local vars.
> > -    (funcall major-mode)
> > +    (unless (eq major-mode 'help-mode) (funcall major-mode))
> >      (when help-xref-stack-item
> >        (push (cons (point) help-xref-stack-item) help-xref-stack)
> >        (setq help-xref-forward-stack nil))
> 
> Is there any objection to installing this patch to fix the regression?

Thanks for the ping, but it's too early for you to assume this fell
through the cracks, as today is just 1 week since your OP.  Some
people take more than that to respond.

I added Dmitry to the discussion (it is generally a good idea to do
that in the OP, by means of the X-Debbugs-Cc header).




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#77510; Package emacs. (Fri, 11 Apr 2025 09:24:02 GMT) Full text and rfc822 format available.

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

From: Stephen Berman <stephen.berman <at> gmx.net>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Dmitry Gutov <dmitry <at> gutov.dev>, 77510 <at> debbugs.gnu.org
Subject: Re: bug#77510: 31.0.50; help-customize fails with multiply defined
 symbols
Date: Fri, 11 Apr 2025 11:23:26 +0200
On Fri, 11 Apr 2025 12:02:22 +0300 Eli Zaretskii <eliz <at> gnu.org> wrote:

>> Date: Fri, 11 Apr 2025 10:20:13 +0200
>> From:  Stephen Berman via "Bug reports for GNU Emacs,
>>  the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
>>
>> On Fri, 04 Apr 2025 00:16:45 +0200 Stephen Berman <stephen.berman <at> gmx.net> wrote:
>>
>> > 0. emacs -Q
>> > 1. Type `C-h o fringe-mode RET' to pop up a *Help* buffer displaying
>> >    help for both the function fringe-mode and the variable fringe-mode.
>> > 2. In the *Help* buffer type `c'.
>> > => Emacs dings and displays the message "No variable or face to customize"
>> >
>> > When executing this recipe in emacs-30, after step 2 Emacs switches to a
>> > *Customize* buffer for the variable fringe-mode, which is the expected
>> > behavior after typing `c' (help-customize) in *Help*.  This is broken in
>> > master.  The breakage is due to this commit:
>> >
>> > commit e776df2a3eae0454ea85287e15ebba649bf8e918
>> > Author:     Dmitry Gutov <dmitry <at> gutov.dev>
[...]
>> Is there any objection to installing this patch to fix the regression?
>
> Thanks for the ping, but it's too early for you to assume this fell
> through the cracks, as today is just 1 week since your OP.  Some
> people take more than that to respond.

Sure, no sweat.

> I added Dmitry to the discussion (it is generally a good idea to do
> that in the OP, by means of the X-Debbugs-Cc header).

Thanks.

Steve Berman




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#77510; Package emacs. (Sun, 13 Apr 2025 00:46:01 GMT) Full text and rfc822 format available.

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

From: Dmitry Gutov <dmitry <at> gutov.dev>
To: Stephen Berman <stephen.berman <at> gmx.net>, 77510 <at> debbugs.gnu.org
Subject: Re: bug#77510: 31.0.50; help-customize fails with multiply defined
 symbols
Date: Sun, 13 Apr 2025 03:44:49 +0300
Hi! Thanks for reporting.

On 04/04/2025 01:16, Stephen Berman via Bug reports for GNU Emacs, the 
Swiss army knife of text editors wrote:
> 0. emacs -Q
> 1. Type `C-h o fringe-mode RET' to pop up a *Help* buffer displaying
>     help for both the function fringe-mode and the variable fringe-mode.
> 2. In the *Help* buffer type `c'.
> => Emacs dings and displays the message "No variable or face to customize"
> 
> When executing this recipe in emacs-30, after step 2 Emacs switches to a
> *Customize* buffer for the variable fringe-mode, which is the expected
> behavior after typing `c' (help-customize) in *Help*.  This is broken in
> master.  The breakage is due to this commit:
> 
> commit e776df2a3eae0454ea85287e15ebba649bf8e918
> Author:     Dmitry Gutov <dmitry <at> gutov.dev>
> Commit:     Dmitry Gutov <dmitry <at> gutov.dev>
> CommitDate: Sun Oct 6 04:32:00 2024 +0300
> 
>      help-setup-xref: Keep the local values only of some variables
> 
>      * lisp/help-mode.el (help-setup-xref): Kill all local variables,
>      saving ones that are known to need to be preserved (bug#73637).
> 
> and the breakage remained after the two followup commits, which is the
> current code state.
> 
> According to my debugging, calling help-setup-xref at the end of
> describe-symbol after the function definition help has been added to the
> *Help* buffer nullifies the property list of help-mode--current-data
> (this happens on evaluating `(funcall major-mode)' in help-setup-xref
> when the value of major-mode is 'help-mode), which renders
> help-customize a noop.  The following patch fixes the breakage according
> to my brief testing, though I'm not sure it doesn't have unwanted
> side-effects (but at least I get the same test results on running make
> check with the patch as without it).

It seems like your proposal would regress the bug report that's 
referenced in the above commit message. The change has the goal to reset 
some buffer-local variables, and the current means to do that is to call 
the major mode function again.

If the major-mode function is not called, the vars are not reset.

What are the other options we could use?

help-setup-xref's docstring says it should be called very early - 
perhaps before the value of help-mode--current-data is assigned?

Making help-mode--current-data would also be an option, but it won't 
work alone because help-mode function sets it to nil explicitly as well. 
I wonder what will happen if we remove that assignment.

Finally, if 'describe-symbol' is the only main exception (where 
help-setup-xref is called late), we could save and restore the current 
value of help-mode--current-data just there.

Like this:

diff --git a/lisp/help-fns.el b/lisp/help-fns.el
index 6c4c3f4da97..fa7241d3e9d 100644
--- a/lisp/help-fns.el
+++ b/lisp/help-fns.el
@@ -1965,7 +1965,8 @@ describe-symbol
         (unless single
           ;; Don't record the `describe-variable' item in the stack.
           (setq help-xref-stack-item nil)
-          (help-setup-xref (list #'describe-symbol symbol) nil))
+          (let ((help-mode--current-data help-mode--current-data))
+            (help-setup-xref (list #'describe-symbol symbol) nil)))
         (goto-char (point-max))
         (help-xref--navigation-buttons)
         (goto-char (point-min))))))






Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#77510; Package emacs. (Sun, 13 Apr 2025 09:00:04 GMT) Full text and rfc822 format available.

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

From: Stephen Berman <stephen.berman <at> gmx.net>
To: Dmitry Gutov <dmitry <at> gutov.dev>
Cc: 77510 <at> debbugs.gnu.org
Subject: Re: bug#77510: 31.0.50; help-customize fails with multiply defined
 symbols
Date: Sun, 13 Apr 2025 10:59:05 +0200
On Sun, 13 Apr 2025 03:44:49 +0300 Dmitry Gutov <dmitry <at> gutov.dev> wrote:

> Hi! Thanks for reporting.
>
> On 04/04/2025 01:16, Stephen Berman via Bug reports for GNU Emacs, the
> Swiss army knife of text editors wrote:
>> 0. emacs -Q
>> 1. Type `C-h o fringe-mode RET' to pop up a *Help* buffer displaying
>>     help for both the function fringe-mode and the variable fringe-mode.
>> 2. In the *Help* buffer type `c'.
>> => Emacs dings and displays the message "No variable or face to customize"
>>
>> When executing this recipe in emacs-30, after step 2 Emacs switches to a
>> *Customize* buffer for the variable fringe-mode, which is the expected
>> behavior after typing `c' (help-customize) in *Help*.  This is broken in
>> master.  The breakage is due to this commit:
>>
>> commit e776df2a3eae0454ea85287e15ebba649bf8e918
>> Author:     Dmitry Gutov <dmitry <at> gutov.dev>
>> Commit:     Dmitry Gutov <dmitry <at> gutov.dev>
>> CommitDate: Sun Oct 6 04:32:00 2024 +0300
>>
>>      help-setup-xref: Keep the local values only of some variables
>>
>>      * lisp/help-mode.el (help-setup-xref): Kill all local variables,
>>      saving ones that are known to need to be preserved (bug#73637).
>>
>> and the breakage remained after the two followup commits, which is the
>> current code state.
>>
>> According to my debugging, calling help-setup-xref at the end of
>> describe-symbol after the function definition help has been added to the
>> *Help* buffer nullifies the property list of help-mode--current-data
>> (this happens on evaluating `(funcall major-mode)' in help-setup-xref
>> when the value of major-mode is 'help-mode), which renders
>> help-customize a noop.  The following patch fixes the breakage according
>> to my brief testing, though I'm not sure it doesn't have unwanted
>> side-effects (but at least I get the same test results on running make
>> check with the patch as without it).
>
> It seems like your proposal would regress the bug report that's
> referenced in the above commit message. The change has the goal to reset
> some buffer-local variables, and the current means to do that is to call
> the major mode function again.
>
> If the major-mode function is not called, the vars are not reset.
>
> What are the other options we could use?
>
> help-setup-xref's docstring says it should be called very early -
> perhaps before the value of help-mode--current-data is assigned?
>
> Making help-mode--current-data would also be an option, but it won't
> work alone because help-mode function sets it to nil explicitly as well.
> I wonder what will happen if we remove that assignment.
>
> Finally, if 'describe-symbol' is the only main exception (where
> help-setup-xref is called late), we could save and restore the current
> value of help-mode--current-data just there.
>
> Like this:
>
> diff --git a/lisp/help-fns.el b/lisp/help-fns.el
> index 6c4c3f4da97..fa7241d3e9d 100644
> --- a/lisp/help-fns.el
> +++ b/lisp/help-fns.el
> @@ -1965,7 +1965,8 @@ describe-symbol
>           (unless single
>             ;; Don't record the `describe-variable' item in the stack.
>             (setq help-xref-stack-item nil)
> -          (help-setup-xref (list #'describe-symbol symbol) nil))
> +          (let ((help-mode--current-data help-mode--current-data))
> +            (help-setup-xref (list #'describe-symbol symbol) nil)))
>           (goto-char (point-max))
>           (help-xref--navigation-buttons)
>           (goto-char (point-min))))))

I confirm this fixes the issue I reported, so if my patch is
problematical, I'm fine with yours.  Thanks!

Steve Berman




Reply sent to Dmitry Gutov <dmitry <at> gutov.dev>:
You have taken responsibility. (Mon, 14 Apr 2025 00:39:02 GMT) Full text and rfc822 format available.

Notification sent to Stephen Berman <stephen.berman <at> gmx.net>:
bug acknowledged by developer. (Mon, 14 Apr 2025 00:39:03 GMT) Full text and rfc822 format available.

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

From: Dmitry Gutov <dmitry <at> gutov.dev>
To: Stephen Berman <stephen.berman <at> gmx.net>
Cc: 77510-done <at> debbugs.gnu.org
Subject: Re: bug#77510: 31.0.50; help-customize fails with multiply defined
 symbols
Date: Mon, 14 Apr 2025 03:38:44 +0300
On 13/04/2025 11:59, Stephen Berman wrote:
>> Like this:
>>
>> diff --git a/lisp/help-fns.el b/lisp/help-fns.el
>> index 6c4c3f4da97..fa7241d3e9d 100644
>> --- a/lisp/help-fns.el
>> +++ b/lisp/help-fns.el
>> @@ -1965,7 +1965,8 @@ describe-symbol
>>            (unless single
>>              ;; Don't record the `describe-variable' item in the stack.
>>              (setq help-xref-stack-item nil)
>> -          (help-setup-xref (list #'describe-symbol symbol) nil))
>> +          (let ((help-mode--current-data help-mode--current-data))
>> +            (help-setup-xref (list #'describe-symbol symbol) nil)))
>>            (goto-char (point-max))
>>            (help-xref--navigation-buttons)
>>            (goto-char (point-min))))))
> I confirm this fixes the issue I reported, so if my patch is
> problematical, I'm fine with yours.  Thanks!

Great! I've pushed this patch to master, thanks for testing.

We can return to other options if some other drawbacks are reported.




This bug report was last modified 1 day ago.

Previous Next


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