]> git.eshelyaron.com Git - emacs.git/commitdiff
2008-01-29 Tassilo Horn <tassilo@member.fsf.org>
authorTassilo Horn <tassilo@member.fsf.org>
Tue, 29 Jan 2008 13:50:35 +0000 (13:50 +0000)
committerTassilo Horn <tassilo@member.fsf.org>
Tue, 29 Jan 2008 13:50:35 +0000 (13:50 +0000)
* doc-view.el (doc-view-mode): Use facilities of
image-mode to restore [vh]scroll when switching buffers.

lisp/ChangeLog
lisp/doc-view.el

index 51a033602ff376282be5eb2c1c22a4a60c58f6a0..5c68efb5298a395cdbf2d368b81eccc30722a5cd 100644 (file)
@@ -1,3 +1,18 @@
+2008-01-29  Tassilo Horn  <tassilo@member.fsf.org>
+
+       * doc-view.el (doc-view-mode): Use facilities below to
+       restore [vh]scroll when switching buffers.
+
+       * image-mode.el (image-mode-current-vscroll)
+       (image-mode-current-hscroll): New variables.
+       (image-set-window-hscroll, image-set-window-vscroll): New
+       functions.
+       (image-forward-hscroll, image-next-line, image-bol, image-eol)
+       (image-bob, image-eob): Use them.
+       (image-reset-current-vhscroll): New function.
+       (image-mode): Make new variables buffer-local and reset [vh]scroll
+       on window configuration changes.
+
 2008-01-27  Nick Roberts  <nickrob@snap.net.nz>
 
        * progmodes/gdb-ui.el (gdb-create-define-alist): Don't call
index 034eace3dfbf6fa3e6c37f3998c1d43881f611bd..047785e844c632de4e871b17d3e7bd2f027650b6 100644 (file)
@@ -987,6 +987,15 @@ toggle between displaying the document or editing it as text."
   (add-hook 'change-major-mode-hook
            (lambda () (delete-overlay doc-view-current-overlay))
            nil t)
+
+  ;; Keep track of [vh]scroll when switching buffers
+  (set (make-local-variable 'image-mode-current-hscroll)
+       (window-hscroll (selected-window)))
+  (set (make-local-variable 'image-mode-current-vscroll)
+       (window-vscroll (selected-window)))
+  (add-hook 'window-configuration-change-hook
+           'image-reset-current-vhscroll nil t)
+
   (set (make-local-variable 'mode-line-position)
        '(" P" (:eval (number-to-string doc-view-current-page))
         "/" (:eval (number-to-string (length doc-view-current-files)))))