From 10b6e7c189a99d892d7f3c329745c1360f3ebaa4 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Mon, 28 Apr 2008 23:49:02 +0000 Subject: [PATCH] (doc-view-new-window-function): Avoid using WINDOW argument to get-char-property, in case the current buffer hasn't been assigned to that window yet. (doc-view-display): Default to selected window if the current buffer hasn't been assigned to a window yet. --- lisp/doc-view.el | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/lisp/doc-view.el b/lisp/doc-view.el index 7d2988f9718..f7cabbe42a7 100644 --- a/lisp/doc-view.el +++ b/lisp/doc-view.el @@ -230,7 +230,7 @@ has finished." (let ((ol (image-mode-window-get 'overlay winprops))) (if ol (setq ol (copy-overlay ol)) - (assert (not (get-char-property (point-min) 'display (car winprops)))) + (assert (not (get-char-property (point-min) 'display))) (setq ol (make-overlay (point-min) (point-max) nil t)) (overlay-put ol 'doc-view t)) (overlay-put ol 'window (car winprops)) @@ -845,16 +845,17 @@ have the page we want to view." (sort (directory-files (doc-view-current-cache-dir) t "page-[0-9]+\\.png" t) 'doc-view-sort)) - (dolist (win (get-buffer-window-list buffer nil t)) - (let* ((page (doc-view-current-page win)) - (pagefile (expand-file-name (format "page-%d.png" page) - (doc-view-current-cache-dir)))) - (when (or force - (and (not (member pagefile prev-pages)) - (member pagefile doc-view-current-files))) - (with-selected-window win - (assert (eq (current-buffer) buffer)) - (doc-view-goto-page page)))))))) + (dolist (win (or (get-buffer-window-list buffer nil t) + (list (selected-window)))) + (let* ((page (doc-view-current-page win)) + (pagefile (expand-file-name (format "page-%d.png" page) + (doc-view-current-cache-dir)))) + (when (or force + (and (not (member pagefile prev-pages)) + (member pagefile doc-view-current-files))) + (with-selected-window win + (assert (eq (current-buffer) buffer)) + (doc-view-goto-page page)))))))) (defun doc-view-buffer-message () ;; Only show this message initially, not when refreshing the buffer (in which -- 2.39.5