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 we show 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.

A window is resized only if it has been specially created for the buffer. Windows that have shown another buffer before are not resized. 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.

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.

View in manual

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 we
show 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'.

A window is resized only if it has been specially created for the
buffer.  Windows that have shown another buffer before are not
resized.  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."
  :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)))