unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#41836: 26.3; Could we stop `help-buffer' from ever signalling errors?
@ 2020-06-13 13:29 Phil Sainty
  2021-01-21 16:04 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 3+ messages in thread
From: Phil Sainty @ 2020-06-13 13:29 UTC (permalink / raw)
  To: 41836

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





^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#41836: 26.3; Could we stop `help-buffer' from ever signalling errors?
  2020-06-13 13:29 bug#41836: 26.3; Could we stop `help-buffer' from ever signalling errors? Phil Sainty
@ 2021-01-21 16:04 ` Lars Ingebrigtsen
  2022-06-06 14:12   ` Lars Ingebrigtsen
  0 siblings, 1 reply; 3+ messages in thread
From: Lars Ingebrigtsen @ 2021-01-21 16:04 UTC (permalink / raw)
  To: Phil Sainty; +Cc: 41836

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





^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#41836: 26.3; Could we stop `help-buffer' from ever signalling errors?
  2021-01-21 16:04 ` Lars Ingebrigtsen
@ 2022-06-06 14:12   ` Lars Ingebrigtsen
  0 siblings, 0 replies; 3+ messages in thread
From: Lars Ingebrigtsen @ 2022-06-06 14:12 UTC (permalink / raw)
  To: Phil Sainty; +Cc: 41836

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





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-06-06 14:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-13 13:29 bug#41836: 26.3; Could we stop `help-buffer' from ever signalling errors? Phil Sainty
2021-01-21 16:04 ` Lars Ingebrigtsen
2022-06-06 14:12   ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).