emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master c1c9af3: In doc-view, keep point on the equivalent


From: Lars Ingebrigtsen
Subject: [Emacs-diffs] master c1c9af3: In doc-view, keep point on the equivalent page in the text version
Date: Thu, 3 Oct 2019 10:54:56 -0400 (EDT)

branch: master
commit c1c9af312ed32f9e006452eef56ecabf6438cae9
Author: Lars Ingebrigtsen <address@hidden>
Commit: Lars Ingebrigtsen <address@hidden>

    In doc-view, keep point on the equivalent page in the text version
    
    * 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 | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lisp/doc-view.el b/lisp/doc-view.el
index f75421e..1f864f8 100644
--- a/lisp/doc-view.el
+++ b/lisp/doc-view.el
@@ -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



reply via email to

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