aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTassilo Horn2013-03-14 22:33:07 +0100
committerTassilo Horn2013-03-14 22:33:07 +0100
commitf35ffe5e3714cecdc5d7ea4027339178393cb578 (patch)
tree52df9f834c805ee76d76d5437ae893b60090391e
parenta5cc4ddeb84fbdceff31af8d8df7036edebbc58d (diff)
downloademacs-f35ffe5e3714cecdc5d7ea4027339178393cb578.tar.gz
emacs-f35ffe5e3714cecdc5d7ea4027339178393cb578.zip
* doc-view.el Fix bug#13887.
(doc-view-insert-image): Don't modify overlay associated to non-live windows, and implement horizontal centering of image in case it's smaller than the window. (doc-view-new-window-function): Force redisplay of new windows on doc-view buffers.
-rw-r--r--lisp/ChangeLog10
-rw-r--r--lisp/doc-view.el28
2 files changed, 29 insertions, 9 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index a5dbac3a5a0..4ff63448d89 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,9 +1,11 @@
12013-03-14 Tassilo Horn <tsdh@gnu.org> 12013-03-14 Tassilo Horn <tsdh@gnu.org>
2 2
3 * doc-view.el (doc-view-insert-image): Don't modify overlay 3 * doc-view.el Fix bug#13887.
4 associated with pseudo winprops entry, and implement horizontal 4 (doc-view-insert-image): Don't modify overlay associated to
5 centering of image in case it's smaller than the window 5 non-live windows, and implement horizontal centering of image in
6 (bug#13887). 6 case it's smaller than the window.
7 (doc-view-new-window-function): Force redisplay of new windows on
8 doc-view buffers.
7 9
82013-03-13 Karl Fogel <kfogel@red-bean.com> 102013-03-13 Karl Fogel <kfogel@red-bean.com>
9 11
diff --git a/lisp/doc-view.el b/lisp/doc-view.el
index 7290040d168..ee77f397746 100644
--- a/lisp/doc-view.el
+++ b/lisp/doc-view.el
@@ -324,7 +324,26 @@ of the page moves to the previous page."
324 ;; `window' property is only effective if its value is a window). 324 ;; `window' property is only effective if its value is a window).
325 (cl-assert (eq t (car winprops))) 325 (cl-assert (eq t (car winprops)))
326 (delete-overlay ol)) 326 (delete-overlay ol))
327 (image-mode-window-put 'overlay ol winprops))) 327 (image-mode-window-put 'overlay ol winprops)
328 (when (windowp (car winprops))
329 (if (stringp (get-char-property (point-min) 'display))
330 ;; We're not already displaying an image, so this is the
331 ;; initial window showing the document.
332 (run-with-timer nil nil
333 (lambda ()
334 ;; In case a conversion is running, the
335 ;; refresh will happen as defined by
336 ;; `doc-view-conversion-refresh-interval'.
337 (unless doc-view-current-converter-processes
338 (with-selected-window (car winprops)
339 (doc-view-goto-page 1)))))
340 ;; We've split the window showing the document. All we need
341 ;; to do is selecting the new window to make the image appear
342 ;; there, too.
343 (run-with-timer nil nil
344 (lambda ()
345 (save-window-excursion
346 (select-window (car winprops)))))))))
328 347
329(defvar doc-view-current-files nil 348(defvar doc-view-current-files nil
330 "Only used internally.") 349 "Only used internally.")
@@ -535,7 +554,7 @@ Typically \"page-%s.png\".")
535 (with-selected-window win 554 (with-selected-window win
536 (doc-view-goto-page page)))))))) 555 (doc-view-goto-page page))))))))
537 (overlay-put (doc-view-current-overlay) 556 (overlay-put (doc-view-current-overlay)
538 'help-echo (doc-view-current-info)))) 557 'help-echo (doc-view-current-info))))
539 558
540(defun doc-view-next-page (&optional arg) 559(defun doc-view-next-page (&optional arg)
541 "Browse ARG pages forward." 560 "Browse ARG pages forward."
@@ -1251,9 +1270,8 @@ ARGS is a list of image descriptors."
1251 (clear-image-cache) 1270 (clear-image-cache)
1252 (setq doc-view-pending-cache-flush nil)) 1271 (setq doc-view-pending-cache-flush nil))
1253 (let ((ol (doc-view-current-overlay))) 1272 (let ((ol (doc-view-current-overlay)))
1254 ;; ol might be deleted (see `doc-view-new-window-function'), in 1273 ;; Only insert the image if the buffer is visible.
1255 ;; which case we don't want to modify it. 1274 (when (window-live-p (overlay-get ol 'window))
1256 (when (overlay-buffer ol)
1257 (let* ((image (if (and file (file-readable-p file)) 1275 (let* ((image (if (and file (file-readable-p file))
1258 (if (not (and doc-view-scale-internally 1276 (if (not (and doc-view-scale-internally
1259 (fboundp 'imagemagick-types))) 1277 (fboundp 'imagemagick-types)))