From: Tassilo Horn <tsdh@gnu.org>
To: Suhail Shergill <suhailshergill@gmail.com>
Cc: 16541@debbugs.gnu.org
Subject: bug#16541: 23.3; doc-view-open-text should grab place in current doc
Date: Mon, 27 Jan 2014 11:25:09 +0100 [thread overview]
Message-ID: <87a9ehhgca.fsf@gnu.org> (raw)
In-Reply-To: <8738kc3lzm.fsf@chaos.shergill.su> (Suhail Shergill's message of "Sat, 25 Jan 2014 02:10:47 +0000")
Suhail Shergill <suhailshergill@gmail.com> writes:
Hi!
>> Currently doc-view has pretty much no idea about the format in use,
>> so it doesn't know how to go from one page to another.
>
> except results shown by doc-view-search and doc-view-search-next-match
> are associated with the correct page number as seen in docview mode
> (even though it seems the search is conducted on the extracted
> text). so, clearly that information is available to doc-view in some
> sense.
Suhail is correct. We could easily make C-c C-t switch to the current
page using this patch:
--8<---------------cut here---------------start------------->8---
=== modified file 'lisp/doc-view.el'
--- lisp/doc-view.el 2014-01-01 07:43:34 +0000
+++ lisp/doc-view.el 2014-01-27 10:22:11 +0000
@@ -1400,6 +1400,7 @@
(defun doc-view-open-text ()
"Open a buffer with the current doc's contents as text."
(interactive)
+ (let ((page (doc-view-current-page)))
(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))))
@@ -1409,8 +1410,11 @@
(dir (file-name-directory buffer-file-name)))
(with-current-buffer (find-file txt)
(rename-buffer name)
- (setq default-directory dir)))
- (doc-view-doc->txt txt 'doc-view-open-text)))))
+ (setq default-directory dir)
+ ;; Jump to the current page
+ (goto-char (point-min))
+ (search-forward "
" nil t (1- page))))
+ (doc-view-doc->txt txt 'doc-view-open-text))))))
;;;;; Toggle between editing and viewing
--8<---------------cut here---------------end--------------->8---
Should I install it?
Bye,
Tassilo
next prev parent reply other threads:[~2014-01-27 10:25 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-24 20:18 bug#16541: 23.3; doc-view-open-text should grab place in current doc Suhail Shergill
2014-01-24 21:17 ` Stefan Monnier
2014-01-25 2:10 ` Suhail Shergill
2014-01-27 10:25 ` Tassilo Horn [this message]
2019-09-29 13:09 ` Lars Ingebrigtsen
2019-10-03 9:05 ` Tassilo Horn
2019-10-03 14:55 ` Lars Ingebrigtsen
2019-10-03 17:06 ` Tassilo Horn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87a9ehhgca.fsf@gnu.org \
--to=tsdh@gnu.org \
--cc=16541@debbugs.gnu.org \
--cc=suhailshergill@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).