[Top][All Lists]

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

bug#14435: 24.3.50; Co-operation of doc-view + desktop-save-mode, save-p

From: Stefan Monnier
Subject: bug#14435: 24.3.50; Co-operation of doc-view + desktop-save-mode, save-place etc.
Date: Sun, 26 May 2013 20:59:18 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

>> That was my main test case while writing the patch, so "it works for me".
>> Could you give a detailed recipe?

> Sure.

>   1. emacs -Q
>   2. C-x C-f some.pdf
>      conversion is done and I see the first page of the PDF
>   3. k
>   4. C-x C-f some.pdf
>      I only see the raw PDF contents
>   5. <down>
>      Now I see the image.

Aha!  Now I see it, and it seems like it's a long standing bug in
image-mode.el.  I installed the patch below which seems to fix this problem.
It seems to also fix the scroll-bar-mode issue.


--- lisp/image-mode.el  2013-05-24 17:42:23 +0000
+++ lisp/image-mode.el  2013-05-27 00:55:05 +0000
@@ -104,13 +104,16 @@
 (defun image-mode-reapply-winprops ()
   ;; When set-window-buffer, set hscroll and vscroll to what they were
   ;; last time the image was displayed in this window.
-  (when (and (image-get-display-property)
-            (listp image-mode-winprops-alist))
+  (when (listp image-mode-winprops-alist)
+    ;; Beware: this call to image-mode-winprops can't be optimized away,
+    ;; because it not only gets the winprops data but sets it up if needed
+    ;; (e.g. it's used by doc-view to display the image in a new window).
     (let* ((winprops (image-mode-winprops nil t))
            (hscroll (image-mode-window-get 'hscroll winprops))
            (vscroll (image-mode-window-get 'vscroll winprops)))
+      (when (image-get-display-property) ;Only do it if we display an image!
       (if hscroll (set-window-hscroll (selected-window) hscroll))
-      (if vscroll (set-window-vscroll (selected-window) vscroll)))))
+       (if vscroll (set-window-vscroll (selected-window) vscroll))))))
 (defun image-mode-setup-winprops ()
   ;; Record current scroll settings.

reply via email to

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