emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r112045: * doc-view.el Fix bug#13887.


From: Tassilo Horn
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r112045: * doc-view.el Fix bug#13887.
Date: Thu, 14 Mar 2013 22:33:07 +0100
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 112045
committer: Tassilo Horn <address@hidden>
branch nick: trunk
timestamp: Thu 2013-03-14 22:33:07 +0100
message:
  * 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.
modified:
  lisp/ChangeLog
  lisp/doc-view.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2013-03-14 15:24:04 +0000
+++ b/lisp/ChangeLog    2013-03-14 21:33:07 +0000
@@ -1,9 +1,11 @@
 2013-03-14  Tassilo Horn  <address@hidden>
 
-       * doc-view.el (doc-view-insert-image): Don't modify overlay
-       associated with pseudo winprops entry, and implement horizontal
-       centering of image in case it's smaller than the window
-       (bug#13887).
+       * 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.
 
 2013-03-13  Karl Fogel  <address@hidden>
 

=== modified file 'lisp/doc-view.el'
--- a/lisp/doc-view.el  2013-03-14 15:24:04 +0000
+++ b/lisp/doc-view.el  2013-03-14 21:33:07 +0000
@@ -324,7 +324,26 @@
       ;; `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)))
+    (image-mode-window-put 'overlay ol winprops)
+    (when (windowp (car winprops))
+      (if (stringp (get-char-property (point-min) 'display))
+         ;; We're not already displaying an image, so this is the
+         ;; initial window showing the document.
+         (run-with-timer nil nil
+                         (lambda ()
+                           ;; In case a conversion is running, the
+                           ;; refresh will happen as defined by
+                           ;; `doc-view-conversion-refresh-interval'.
+                           (unless doc-view-current-converter-processes
+                             (with-selected-window (car winprops)
+                               (doc-view-goto-page 1)))))
+       ;; We've split the window showing the document.  All we need
+       ;; to do is selecting the new window to make the image appear
+       ;; there, too.
+       (run-with-timer nil nil
+                       (lambda ()
+                         (save-window-excursion
+                           (select-window (car winprops)))))))))
 
 (defvar doc-view-current-files nil
   "Only used internally.")
@@ -535,7 +554,7 @@
                          (with-selected-window win
                            (doc-view-goto-page page))))))))
     (overlay-put (doc-view-current-overlay)
-                 'help-echo (doc-view-current-info))))
+                'help-echo (doc-view-current-info))))
 
 (defun doc-view-next-page (&optional arg)
   "Browse ARG pages forward."
@@ -1251,9 +1270,8 @@
     (clear-image-cache)
     (setq doc-view-pending-cache-flush nil))
   (let ((ol (doc-view-current-overlay)))
-    ;; ol might be deleted (see `doc-view-new-window-function'), in
-    ;; which case we don't want to modify it.
-    (when (overlay-buffer ol)
+    ;; Only insert the image if the buffer is visible.
+    (when (window-live-p (overlay-get ol 'window))
       (let* ((image (if (and file (file-readable-p file))
                        (if (not (and doc-view-scale-internally
                                      (fboundp 'imagemagick-types)))


reply via email to

[Prev in Thread] Current Thread [Next in Thread]