Function: temp-buffer-window-show

temp-buffer-window-show is a byte-compiled function defined in window.el.gz.

Signature

(temp-buffer-window-show BUFFER &optional ACTION)

Documentation

Show temporary buffer BUFFER in a window.

Return the window showing BUFFER. Pass ACTION as action argument to display-buffer.

Source Code

;; Defined in /usr/src/emacs/lisp/window.el.gz
(defun temp-buffer-window-show (buffer &optional action)
  "Show temporary buffer BUFFER in a window.
Return the window showing BUFFER.  Pass ACTION as action argument
to `display-buffer'."
  (let (resize-temp-buffer-window-inhibit window)
    (with-current-buffer buffer
      (set-buffer-modified-p nil)
      (setq buffer-read-only t)
      (goto-char (point-min))
      (when (let ((window-combination-limit
		   ;; When `window-combination-limit' equals
		   ;; `temp-buffer' or `temp-buffer-resize' and
		   ;; `temp-buffer-resize-mode' is enabled in this
		   ;; buffer bind it to t so resizing steals space
		   ;; preferably from the window that was split.
		   (if (or (eq window-combination-limit 'temp-buffer)
			   (and (eq window-combination-limit
				    'temp-buffer-resize)
				temp-buffer-resize-mode))
		       t
		     window-combination-limit)))
	      (setq window (display-buffer buffer action)))
        ;; We used to raise the window's frame here.  Do not do that
        ;; since it would override an `inhibit-switch-frame' entry
        ;; specified for the action alist used by `display-buffer'.
	(setq minibuffer-scroll-window window)
	(set-window-hscroll window 0)
	(with-selected-window window
	  (run-hooks 'temp-buffer-window-show-hook)
	  (when temp-buffer-resize-mode
	    (resize-temp-buffer-window window)))
	;; Return the window.
	window))))