]> git.eshelyaron.com Git - emacs.git/commitdiff
(doc-view-convert-current-doc): Save the current
authorTassilo Horn <tassilo@member.fsf.org>
Thu, 5 Mar 2009 08:24:26 +0000 (08:24 +0000)
committerTassilo Horn <tassilo@member.fsf.org>
Thu, 5 Mar 2009 08:24:26 +0000 (08:24 +0000)
resolution in the cache directory.
(doc-view-initiate-display): Restore the saved resolution when
using cached image files.

lisp/ChangeLog
lisp/doc-view.el

index 5f9a617aa442d1a25104562df738ea1539e449b2..1b00c6f0fdc2213929a68b0e7e6283d0b94fba72 100644 (file)
@@ -1,3 +1,10 @@
+2009-03-05  Tassilo Horn  <tassilo@member.fsf.org>
+
+       * doc-view.el (doc-view-convert-current-doc): Save the current
+       resolution in the cache directory.
+       (doc-view-initiate-display): Restore the saved resolution when
+       using cached image files.
+
 2009-03-05  Glenn Morris  <rgm@gnu.org>
 
        * mail/rmail.el (rmail-perm-variables): rmail-overlay-list needs to be
index c9ad392a0b792fc8241ea1addc901159b38da21f..bfdc40d50b0486eafd49e3d6093ff02db0a6b6be 100644 (file)
@@ -721,8 +721,16 @@ Those files are saved in the directory given by the function
   ;; resets during the redisplay).
   (setq doc-view-pending-cache-flush t)
   (let ((png-file (expand-file-name "page-%d.png"
+                                    (doc-view-current-cache-dir)))
+       (res-file (expand-file-name "resolution.el"
                                     (doc-view-current-cache-dir))))
     (make-directory (doc-view-current-cache-dir) t)
+    ;; Save the used resolution so that it can be restored when
+    ;; reading the cached files.
+    (let ((res doc-view-resolution))
+      (with-temp-buffer
+       (princ res (current-buffer))
+       (write-file res-file)))
     (case doc-view-doc-type
       (dvi
        ;; DVI files have to be converted to PDF before Ghostscript can process
@@ -1045,6 +1053,16 @@ If BACKWARD is non-nil, jump to the previous match."
        (if (doc-view-already-converted-p)
            (progn
              (message "DocView: using cached files!")
+             ;; Load the saved resolution
+             (let ((res-file (expand-file-name "resolution.el"
+                                               (doc-view-current-cache-dir)))
+                   (res doc-view-resolution))
+               (with-temp-buffer
+                 (when (file-exists-p res-file)
+                   (insert-file-contents res-file)
+                   (setq res (read (current-buffer)))))
+               (when (numberp res)
+                 (set (make-local-variable 'doc-view-resolution) res)))
              (doc-view-display (current-buffer) 'force))
          (doc-view-convert-current-doc))
        (message