From c1c9af312ed32f9e006452eef56ecabf6438cae9 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Thu, 3 Oct 2019 16:54:44 +0200 Subject: [PATCH] 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 f75421e7b5c..1f864f8a457 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