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
display-buffer-pop-up-frame: https://www.gnu.org/software/emacs/manual/html_node/elisp/Display-Action-Functions.html Another idea idea would be to issue amake-framewhile usingdisplay-bufferwith a custom function to target that new frame. If you are interested in locating and targeting an existing frame, then take a look at this example: http://stackoverflow.com/questions/18346785/how-to-intercept-a-file-before-it-opens-and-decide-which-frame – lawlist Jun 18 '16 at 16:12display-buffer-pop-up-frame, since it is quite close to what I seek. But... the frame pops up in another place (not my current frame), and I must dispatch it with cmd-w, not "q" in help-style. Saving / restoring window configs is not the underlying problem. Currently I'm leaning toward cloning and modifying the source of with-help-window to give it an option that I can let-bind, or wrap with with a defmacro or something. I smile at how picky we emacs people are at wanting exactly what we want from Emacs. – Kevin Jun 18 '16 at 16:41help-return-method,quit-window, thequit-restorewindow parameter, and probably some custom code to set/use all those things to create the desired effect. – Kevin Jun 18 '16 at 17:26