GNU bug report logs - #16541
23.3; doc-view-open-text should grab place in current doc

Previous Next

Package: emacs;

Reported by: Suhail Shergill <suhailshergill <at> gmail.com>

Date: Fri, 24 Jan 2014 20:40:03 UTC

Severity: wishlist

Tags: fixed, patch

Found in version 23.3

Fixed in version 27.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Suhail Shergill <suhailshergill <at> gmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 16541 <at> debbugs.gnu.org, Suhail Shergill <suhailshergill <at> gmail.com>
Subject: bug#16541: 23.3; doc-view-open-text should grab place in current doc
Date: Sat, 25 Jan 2014 02:10:47 +0000
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

> 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.

digging deeper, it seems doc-view-search-internal uses occurrences of  as page
markers. in fact, with a little bit of tinkering the following advice does the
trick: 

(defadvice doc-view-open-text (around
                               su/advice/doc-view/doc-view-open-text/around/goto-page
                               last a c pre)
  "grab the page when in doc-view mode and ensure that doc-view-open-text
   opens the correct page"
  (let ((su/dv/page (doc-view-current-page))
        (su/dv/text-buffer-name (concat "Text contents of " (buffer-name))))
    ad-do-it
    (with-current-buffer su/dv/text-buffer-name
     (re-search-forward "" nil t (1- su/dv/page))
     (recenter-top-bottom 0))))

-- 
Suhail




This bug report was last modified 5 years and 288 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.