Function: temp-buffer-resize-mode
temp-buffer-resize-mode is an interactive and byte-compiled function
defined in help.el.gz.
Signature
(temp-buffer-resize-mode &optional ARG)
Documentation
Toggle auto-resizing temporary buffer windows (Temp Buffer Resize Mode).
When Temp Buffer Resize mode is enabled, the windows in which Emacs
shows a temporary buffer are automatically resized in height to
fit the buffer's contents, but never more than
temp-buffer-max-height nor less than window-min-height.
When this mode is enabled, a window is resized only if it has been
specially created for a temporary buffer. Windows that have shown
another buffer before being reused for displaying a temporary buffer
are not resized (but note that if even-window-sizes is non-nil, they
might be resized in some situations anyway). A frame is resized only
if fit-frame-to-buffer(var)/fit-frame-to-buffer(fun) is non-nil.
This mode is used by help, apropos and completion buffers,
and some others, when they display their pop-up buffers.
This is a global minor mode. If called interactively, toggle the
Temp-Buffer-Resize mode mode. If the prefix argument is positive,
enable the mode, and if it is zero or negative, disable the mode.
If called from Lisp, toggle the mode if ARG is toggle. Enable the
mode if ARG is nil, omitted, or is a positive number. Disable the mode
if ARG is a negative number.
To check whether the minor mode is enabled in the current buffer,
evaluate (default-value \=temp-buffer-resize-mode)'.
The mode's hook is called both when the mode is enabled and when it is disabled.
Probably introduced at or before Emacs version 20.4.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/help.el.gz
(define-minor-mode temp-buffer-resize-mode
"Toggle auto-resizing temporary buffer windows (Temp Buffer Resize Mode).
When Temp Buffer Resize mode is enabled, the windows in which Emacs
shows a temporary buffer are automatically resized in height to
fit the buffer's contents, but never more than
`temp-buffer-max-height' nor less than `window-min-height'.
When this mode is enabled, a window is resized only if it has been
specially created for a temporary buffer. Windows that have shown
another buffer before being reused for displaying a temporary buffer
are not resized (but note that if `even-window-sizes' is non-nil, they
might be resized in some situations anyway). A frame is resized only
if `fit-frame-to-buffer' is non-nil.
This mode is used by `help', `apropos' and `completion' buffers,
and some others, when they display their pop-up buffers."
:global t :group 'help
(if temp-buffer-resize-mode
;; `help-make-xrefs' may add a `back' button and thus increase the
;; text size, so `resize-temp-buffer-window' must be run *after* it.
(add-hook 'temp-buffer-show-hook #'resize-temp-buffer-window 'append)
(remove-hook 'temp-buffer-show-hook #'resize-temp-buffer-window)))