GNU bug report logs - #73637
[PATCH] New hook 'help-setup-hook'

Previous Next

Package: emacs;

Reported by: Eshel Yaron <me <at> eshelyaron.com>

Date: Sat, 5 Oct 2024 07:18:02 UTC

Severity: normal

Tags: patch

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

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Eshel Yaron <me <at> eshelyaron.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Stefan Monnier <monnier <at> iro.umontreal.ca>, 73637 <at> debbugs.gnu.org
Subject: bug#73637: [PATCH] New hook 'help-setup-hook'
Date: Sat, 05 Oct 2024 10:46:06 +0200
[Message part 1 (text/plain, inline)]
Hi,

Eli Zaretskii <eliz <at> gnu.org> writes:

>> Date: Sat, 05 Oct 2024 09:14:54 +0200
>> From:  Eshel Yaron via "Bug reports for GNU Emacs,
>>  the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
>
> Stefan, any comments?
>
>> --- a/lisp/help-fns.el
>> +++ b/lisp/help-fns.el
>> @@ -280,7 +280,12 @@ xref-backend-references
>>  
>>  (defun help-fns--setup-xref-backend ()
>>    (add-hook 'xref-backend-functions #'elisp--xref-backend nil t)
>> -  (setq-local semantic-symref-filepattern-alist '((help-mode "*.el"))))
>> +  (setq-local semantic-symref-filepattern-alist '((help-mode "*.el")))
>> +  (add-hook 'help-setup-hook
>> +            (lambda ()
>> +              (kill-local-variable 'xref-backend-functions)
>> +              (kill-local-variable 'semantic-symref-filepattern-alist))
>> +            nil t))
>
> Please add comments here to explain why the hook does these things.

OK, see updated patch below.

>> --- a/lisp/help-mode.el
>> +++ b/lisp/help-mode.el
>> @@ -492,6 +492,13 @@ help-xref-url-regexp
>>    (purecopy "\\<[Uu][Rr][Ll][ \t\n]+['`‘]\\([^'’]+\\)['’]")
>>    "Regexp matching doc string references to a URL.")
>>  
>> +(defvar-local help-setup-hook nil
>> +  "Functions to call with no arguments when populating \"*Help*\" buffers.
>
> Please mention in the doc string which function(s) call(s) this hook.

Done.

>> -    ;; Disable `outline-minor-mode' in a reused Help buffer
>> -    ;; created by `describe-bindings' that enables this mode.
>
> This useful comment is lost as result of your patch.  Is that on
> purpose?

Yes, this change obviates the need for this comment, as the code no
longer caters for describe-bindings specifically, it just runs a hook.

> Finally, I think this hook should be added to the list of the standard
> hooks in the ELisp manual.

Done in the patch below.  Thanks for taking a look.

[v2-0001-New-hook-help-setup-hook-bug-73637.patch (text/x-patch, attachment)]

This bug report was last modified 226 days ago.

Previous Next


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