bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#17397: 24.4.50; REGRESSION: `temp-buffer-show-hook' is no longer inv


From: martin rudalics
Subject: bug#17397: 24.4.50; REGRESSION: `temp-buffer-show-hook' is no longer invoked for `describe-variable'
Date: Wed, 14 May 2014 09:06:50 +0200

> To get *Help* to DTRT for the code or user that previously used
> `temp-buffer-setup-hook' or `temp-buffer-show-hook, is it
> appropriate to put the same things on `temp-buffer-window-setup-hook'
> and `temp-buffer-window-show-hook' instead?  Or will that maybe
> have unwanted effects because `with-temp-buffer-window' is perhaps
> used for more than just *Help*?

Both `with-output-to-temp-buffer' and `with-temp-buffer-window' are and
can be used for other things than displaying *Help*.

> Not clear to me.  And I find no help in the doc or NEWS - or in
> this bug thread, so far.

The manual says about `with-temp-buffer-window' that

     This macro uses the normal hooks `temp-buffer-window-setup-hook'
     and `temp-buffer-window-show-hook' in place of the analogous hooks
     run by `with-output-to-temp-buffer'.

What else do you need?

> Should I be adding `fit-frame-if-one-window' to `temp-buffer-window'
> for Emacs 24.4, to get the effect it has in Emacs 24.3 (and prior)
> by being on `temp-buffer-show-hook'?

I suppose you want to add it to `temp-buffer-window-show-hook'.

> If not, how to get the same effect?  If yes, how to deal with other
> possible uses of `with-temp-buffer-window', which have nothing to do
> with *Help*?  (In the case of `fit-frame-if-one-window', that would
> probably not hurt anything, but the question is more general.)

Emacs has a `temp-buffer-resize-mode' which is tied to temporary buffers
and not to `help-mode'.  To "deal with other possible uses" of temporary
buffers, a function run by `temp-buffer-show-hook' or
`temp-buffer-window-show-hook' should probably check whether the buffer
is in help mode.  In this regard nothing has changed wrt earlier version
where a user removed `help-mode-setup' from `temp-buffer-setup-hook' and
`help-mode-finish' from `temp-buffer-show-hook'.

Maybe you could also use `help-mode-hook' to do something for help
buffers exclusively and avoid other temporary buffers.

> The existing doc is anyway wrong in some cases, AFAICT: The doc
> string of `with-temp-buffer-window' says:
>
>    This construct is similar to `with-output-to-temp-buffer'
>    but, neither runs `temp-buffer-setup-hook' which usually puts
>    the buffer in Help mode, nor `temp-buffer-show-function' (the
>    ACTION argument replaces this).

What is wrong here?

> And the doc string of `temp-buffer-setup-hook', likewise, says:
>
>    This hook is normally set up with a function to put the buffer
>    in Help mode.

This is still the case for the release version.  IIRC Leo Liu changed it
on the trunk so the doc-string should be probably updated there.

> I don't get the impression that either of those statements is
> true anymore.  It seems like there is *no relation* anymore
> between such temp-buffer things and Help mode.  Furthermore,
> grepping for `temp-buffer-setup-hook' in the Emacs sources
> shows that it is not used for this at all anymore.

The connection between temporary buffers and help mode is established by
`with-help-window' which uses `with-temp-buffer-window'.

martin





reply via email to

[Prev in Thread] Current Thread [Next in Thread]