I sometimes want to display information in Help buffer style, so I have been using code like this:
(with-help-window (help-buffer)
(princ "Type q to exit this help buffer.\n\n")
(princ result))
This works fine, but the help window only uses half of my frame. I normally split my frame horizontally, to give two tall windows. The displayed help buffer uses one of the two windows.
I would rather use the whole frame in some cases, to display more information and to reduce the number of times I need to page down through the displayed information. The problem to solve is how to temporarily use the whole frame for the with-help-window
call, and to automatically restore the original buffers/window sizes when I type "q" in the help window.
How can I best achieve this goal? I think I'm looking for something like this:
(with-FULL-FRAME-help-window (help-buffer)
...)
I've looked at winner-mode, bookmarks, saving layouts to registers, the various (and powerful, but complex) (display-buffer ...)
methods. Most of them seem slightly off-target to my desired intent because they tend to correct/restore a layout after a full frame display operation. And it seems to me that many of them require me to manually restore my window layout (which I would prefer not to do).
I'm wondering if anyone has heard of a way to solve this simply. I'm hoping for something simple like these possible approaches, where I can override something with a let frame...
(let ((help-window-width-display-option fullwidth))
(with-help-window (help-buffer)
...))
Or this kind of approach, which I don't know how to do yet, and which looks somewhat difficult/tricky for my current skill level.
(let ((save original configuration somehow)
(delete-other-windows)
(with-help-window (help-buffer)
...)
;; somehow, when I type "q" in the help buffer
;; - catch that action in code after the buffer is killed
;; - and restore the original window configuration
)
It seems to me the key problem for me to solve is how to automatically restore the original window configuration when I type "q" in the temporary help-mode buffer. Thanks