Subject: bug#77510: 31.0.50; help-customize fails with multiply defined symbols

From: Stephen Berman <[email-masked]>
Date: Fri, 11 Apr 2025 10:20:13 +0200

On Fri, 04 Apr 2025 00:16:45 +0200 Stephen Berman <[email-masked]> 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 <[email-masked]>
> Commit:     Dmitry Gutov <[email-masked]>
> 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