Next: , Previous: , Up: Temporary Displays   [Index]


H.1.2 Macros for Display of Non-help Buffers

Macro: with-temp-buffer-window buffer-or-name action quit-function body

As with with-output-to-temp-buffer, it executes ‘BODY’ while arranging to insert any output it prints into the buffer named ‘BUFFER-OR-NAME’ and displays that buffer in some window. Unlike with-output-to-temp-buffer, however, it does not automatically switch that buffer to ‘Help’ mode.

BUFFER-OR-NAME

specifies the temporary buffer. It can be either a buffer, which must already exist, or a string, in which case a buffer of that name is created, if necessary. The buffer is marked as unmodified and read-only when with-temp-buffer-window exits.

ACTION

The ACTION argument can have a non-nil and non-list value. This means to display the buffer in a window other than the selected one, even if it is already displayed in the selected window. Non-interactive calls should always supply a list or nil.

It passes the ‘ACTION’ argument to display-buffer in order to display the buffer. It should specify a buffer display action of the form ‘(FUNCTIONS . ALIST)’.

  • FUNCTIONS’ is either an "action function" or a possibly empty list of action functions. An action function is a function that accepts two arguments:
    1. the buffer to display; and
    2. an action alist.

    Based on those arguments, it should try to display the buffer in a window and return that window. Action functions use the action alist passed to them to fine-tune their behaviors.

  • ALIST’ is a possibly empty "action alist". An action alist is an association list mapping symbols to values.
  • ACTION FUNCTIONS Action functions and the action they try to perform are:
    • ‘display-buffer-same-window’
    • ‘display-buffer-reuse-window’
    • ‘display-buffer-in-previous-window’
    • ‘display-buffer-use-some-window’
    • ‘display-buffer-pop-up-window’
    • ‘display-buffer-below-selected’
    • ‘display-buffer-at-bottom’
    • ‘display-buffer-pop-up-frame’
    • ‘display-buffer-in-child-frame’
    • ‘display-buffer-no-window’
ACTION-ALIST ENTRIES
  • ‘inhibit-same-window’
  • ‘inhibit-switch-frame’
  • ‘reusable-frames’
  • ‘pop-up-frame-parameters’
  • ‘window-height’
  • ‘window-width’
  • ‘preserve-size’
  • ‘window-parameters’
  • ‘allow-no-window’
  • ‘body-function’
QUIT-FUNCTION

If this argument is non-nil, it should be a function that is called with two arguments: the window showing the buffer and the result of ‘BODY’. The final return value is then whatever quit-function returns.

HOOKS
  • temp-buffer-window-setup-hook
  • temp-buffer-window-show-hook
Macro: with-current-buffer-window buffer-or-name action quit-function &rest body

Like with-temp-buffer-window but makes the buffer specified by ‘BUFFER-OR-NAME’ current for running ‘BODY’.

Macro: with-displayed-buffer-window buffer-or-name action quit-function &rest body

Like with-current-buffer-window but displays the buffer specified by ‘BUFFER-OR-NAME’ before running ‘BODY’.


Next: Changing the Size of a Temporary Buffer Window, Previous: Display as a Help Buffer, Up: Temporary Displays   [Index]