Subject: bug#36588: Unable to revert M-x apropos help buffer

From: Stefan Kangas <[email-masked]>
Date: Fri, 12 Jul 2019 07:03:31 +0200

Basil L. Contovounesios <[email-masked]> writes:

> This is because Apropos buffers are set up in apropos-print using
> with-output-to-temp-buffer, which by default calls help-mode, which sets
> revert-buffer-function permanently-locally to help-mode-revert-buffer.
>
> [Aside: Why is revert-buffer-function permanent-local?]
>
> help-mode-revert-buffer expects the command which generated the Help
> buffer to have previously called help-setup-xref.  This should be
> possible to do in Apropos, but it would be quite ugly as help-setup-xref
> needs to be called with the Help buffer current, so Apropos commands
> would need to set their own version of help-xref-stack-item before
> apropos-print performs the help-setup-xref dance.  Besides, Apropos
> buffers are not (currently) really Help buffers.
>
> Instead, I propose emulating a simpler version of help-setup-xref
> specific to Apropos:
>
>
> I don't consider this duplication because, unless Apropos were
> completely refactored, setting something like apropos--current would be
> necessary either way.  This has the added perk of not coupling Apropos
> with Help any more than it currently needs to be.
>
> WDYT?

Not familiar with this code, so I can't speak to your solution.  I can confirm
it fixes the problem though.  Thanks for looking at it so promptly.

I've attached a small patch with a test for this.

Thanks,
Stefan Kangas