Skip to content

Instantly share code, notes, and snippets.

@suhailshergill
Created January 25, 2014 02:22
Show Gist options
  • Save suhailshergill/8610821 to your computer and use it in GitHub Desktop.
Save suhailshergill/8610821 to your computer and use it in GitHub Desktop.
emacs: have doc-view-open-text remember correct page
(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))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment