changeset 88058:fd7dd85405fc

2008-01-29 Tassilo Horn <tassilo@member.fsf.org> * doc-view.el (doc-view-mode): Use facilities of image-mode to restore [vh]scroll when switching buffers.
author Tassilo Horn <tassilo@member.fsf.org>
date Tue, 29 Jan 2008 13:50:05 +0000
parents 1341d54b08e2
children 256c8ed35688
files lisp/doc-view.el
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/doc-view.el	Tue Jan 29 13:49:05 2008 +0000
+++ b/lisp/doc-view.el	Tue Jan 29 13:50:05 2008 +0000
@@ -987,6 +987,15 @@
   (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)))))