]> git.eshelyaron.com Git - emacs.git/commitdiff
In doc-view, keep point on the equivalent page in the text version
authorLars Ingebrigtsen <larsi@gnus.org>
Thu, 3 Oct 2019 14:54:44 +0000 (16:54 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Thu, 3 Oct 2019 14:54:50 +0000 (16:54 +0200)
* lisp/doc-view.el (doc-view-open-text): After opening the text
version, put point on the page the user was reading (bug#16541).

lisp/doc-view.el

index f75421e7b5ce2f29def11ec26f376bc6c59d435a..1f864f8a4578def31ae8213c5a4e3a60b1795253 100644 (file)
@@ -1505,7 +1505,8 @@ For now these keys are useful:
   (interactive)
   (if doc-view--current-converter-processes
       (message "DocView: please wait till conversion finished.")
-    (let ((txt (expand-file-name "doc.txt" (doc-view--current-cache-dir))))
+    (let ((txt (expand-file-name "doc.txt" (doc-view--current-cache-dir)))
+          (page (doc-view-current-page)))
       (if (file-readable-p txt)
          (let ((inhibit-read-only t)
                (buffer-undo-list t)
@@ -1521,6 +1522,10 @@ For now these keys are useful:
            (setq-local doc-view--buffer-file-name dv-bfn)
            (set-buffer-modified-p nil)
            (doc-view-minor-mode)
+            (goto-char (point-min))
+            ;; Put point at the start of the page the user what
+            ;; reading.  Pages are separated by Control-L characters.
+            (re-search-forward page-delimiter nil t (1- page))
            (add-hook 'write-file-functions
                      (lambda ()
                         ;; FIXME: If the user changes major mode and then