At present (current master branch included), `help-buffer' returns the following: (buffer-name (if (not help-xref-following) (get-buffer-create "*Help*") (unless (derived-mode-p 'help-mode) (error "Current buffer is not in Help mode")) (current-buffer))) Is there any reason not to change it to this? (buffer-name (if (and help-xref-following (derived-mode-p 'help-mode)) (current-buffer) (get-buffer-create "*Help*"))) That way, even in unexpected situations, we can still show the user some help. My motivation is from wondering whether it was simple to display all of the function and variable symbols displayed by `so-long-commentary' as help buttons. I found that calling `help-make-xrefs' does exactly that, but then trying to use any of the buttons causes the "Current buffer is not in Help mode" error. With the suggested change I get the desirable behaviour of those help buttons popping up a help window with the relevant help. It seems to work beautifully for my use-case, and would surely be equally useful in other similar situations. Is there any good reason to maintain that error? -Phil
Phil Sainty <psainty@orcon.net.nz> writes: > My motivation is from wondering whether it was simple to > display all of the function and variable symbols displayed by > `so-long-commentary' as help buttons. I found that calling > `help-make-xrefs' does exactly that, but then trying to use any > of the buttons causes the "Current buffer is not in Help mode" > error. > > With the suggested change I get the desirable behaviour of those > help buttons popping up a help window with the relevant help. > It seems to work beautifully for my use-case, and would surely > be equally useful in other similar situations. > > Is there any good reason to maintain that error? Looking at the code, my impression is that `help-make-xrefs' is meant to be used in `help-mode' buffers only, and the `error' call is just a sanity check for that, kinda? Lifting the restriction by removing that `error' would allow other usages. I'm not sure whether they're all taken into account, though. Anybody got an opinion here? -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no
Lars Ingebrigtsen <larsi@gnus.org> writes: > Looking at the code, my impression is that `help-make-xrefs' is meant to > be used in `help-mode' buffers only, and the `error' call is just a > sanity check for that, kinda? Lifting the restriction by removing that > `error' would allow other usages. I'm not sure whether they're > all taken into account, though. > > Anybody got an opinion here? The explanation for all this was in bug#8147, and Stephen Berman proposed an alternate fix (which Stefan agreed with). But it was never applied, so I did that in Emacs 29, which also solves this bug report, I think. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no