Function: doc-view-new-window-function
doc-view-new-window-function is a byte-compiled function defined in
doc-view.el.gz.
Signature
(doc-view-new-window-function WINPROPS)
Source Code
;; Defined in /usr/src/emacs/lisp/doc-view.el.gz
(defun doc-view-new-window-function (winprops)
;; (message "New window %s for buf %s" (car winprops) (current-buffer))
;;
;; If the window configuration changed, `image-mode-reapply-winprops'
;; will have erased any previous property list for this window, but
;; without removing existing overlays for the same, so that they must
;; be located and erased before a new overlay is created.
(dolist (tem (car (overlay-lists)))
(when (and (eq (overlay-get tem 'window) (car winprops))
(overlay-get tem 'doc-view))
(delete-overlay tem)))
(cl-assert (or (eq t (car winprops))
(eq (window-buffer (car winprops)) (current-buffer))))
(let ((ol (image-mode-window-get 'overlay winprops)))
(if ol
(progn
(setq ol (copy-overlay ol))
;; `ol' might actually be dead.
(move-overlay ol (point-min) (point-max)))
(setq ol (make-overlay (point-min) (point-max) nil t))
(overlay-put ol 'doc-view t))
(overlay-put ol 'window (car winprops))
(unless (windowp (car winprops))
;; It's a pseudo entry. Let's make sure it's not displayed (the
;; `window' property is only effective if its value is a window).
(cl-assert (eq t (car winprops)))
(delete-overlay ol))
(image-mode-window-put 'overlay ol winprops)
(when (and (windowp (car winprops))
(stringp (overlay-get ol 'display))
(null doc-view--current-converter-processes))
;; We're not displaying an image yet, so let's do so. This happens when
;; the buffer is displayed for the first time.
;; Don't do it if there's a conversion is running, since in that case, it
;; will be done later.
(with-selected-window (car winprops)
(doc-view-goto-page (image-mode-window-get 'page t))))))