Function: with-displayed-buffer-window
with-displayed-buffer-window is a macro defined in window.el.gz.
This macro is obsolete since 28.1; use with-current-buffer-window
with action alist entry body-function.
Signature
(with-displayed-buffer-window BUFFER-OR-NAME ACTION QUIT-FUNCTION &rest BODY)
Documentation
Show a buffer BUFFER-OR-NAME and evaluate BODY in that buffer.
This construct is like with-current-buffer-window but unlike that,
displays the buffer specified by BUFFER-OR-NAME before running BODY.
Probably introduced at or before Emacs version 28.1.
Source Code
;; Defined in /usr/src/emacs/lisp/window.el.gz
(defmacro with-displayed-buffer-window (buffer-or-name action quit-function &rest body)
"Show a buffer BUFFER-OR-NAME and evaluate BODY in that buffer.
This construct is like `with-current-buffer-window' but unlike that,
displays the buffer specified by BUFFER-OR-NAME before running BODY."
(declare (debug t) (indent 3)
(obsolete "use `with-current-buffer-window' with action alist entry `body-function'."
"28.1"))
(let ((buffer (make-symbol "buffer"))
(window (make-symbol "window"))
(value (make-symbol "value")))
(macroexp-let2* nil ((vbuffer-or-name buffer-or-name)
(vaction action)
(vquit-function quit-function))
`(let* ((,buffer (temp-buffer-window-setup ,vbuffer-or-name))
(standard-output ,buffer)
;; If a 'window-height' entry specifies a function,
;; remember it here in order to call it below but replace
;; the entry so `window--try-to-split-window' will bind
;; `window-combination-limit' to t and the function does
;; not resize any other window but the one we split this
;; one off (Bug#25055, Bug#25179).
(vheight-function
(let ((window-height (assq 'window-height (cdr ,vaction))))
(when (functionp (cdr window-height))
(cdr window-height))))
(vaction-copied
(when vheight-function
(cons (car , vaction)
(cons
'(window-height . t)
(assq-delete-all
'window-height (cdr (copy-sequence ,vaction)))))))
,window ,value)
(with-current-buffer ,buffer
(setq ,window (temp-buffer-window-show
,buffer (or vaction-copied ,vaction))))
(let ((inhibit-read-only t)
(inhibit-modification-hooks t))
(setq ,value (progn ,@body)))
(set-window-point ,window (point-min))
(when vheight-function
(ignore-errors
(set-window-parameter ,window 'preserve-size nil)
(funcall vheight-function ,window)))
(when (consp (cdr (assq 'preserve-size (cdr ,vaction))))
(window-preserve-size
,window t (cadr (assq 'preserve-size (cdr ,vaction))))
(window-preserve-size
,window nil (cddr (assq 'preserve-size (cdr ,vaction)))))
(if (functionp ,vquit-function)
(funcall ,vquit-function ,window ,value)
,value)))))