Make saveplace-pdf-view' work with pdf-tools'

This commit is contained in:
Gerard Vermeulen 2024-06-25 12:17:59 +02:00
parent 7976866fea
commit 456d97d423

View File

@ -227,7 +227,6 @@ of [[info:emacs#Saving Customizations][saving customizations (info)]].
next-error-message-highlight t next-error-message-highlight t
recentf-max-saved-items history-length recentf-max-saved-items history-length
recentf-mode t recentf-mode t
save-place-mode t
savehist-mode t savehist-mode t
scroll-bar-mode nil scroll-bar-mode nil
tab-always-indent 'complete tab-always-indent 'complete
@ -1840,10 +1839,11 @@ Listing [[lst:configure-nov]] configures [[https://depp.brause.cc/nov.el/][nov.e
The [[https://github.com/vedang/pdf-tools][pdf-tools]] package exploits the [[https://github.com/freedesktop/poppler][poppler]] library to render and to let you The [[https://github.com/vedang/pdf-tools][pdf-tools]] package exploits the [[https://github.com/freedesktop/poppler][poppler]] library to render and to let you
annotate [[https://en.wikipedia.org/wiki/PDF][PDF]] files. It also exploits the [[https://wiki.contextgarden.net/SyncTeX][SyncTeX]] library to link anchors in [[https://en.wikipedia.org/wiki/PDF][PDF]] annotate [[https://en.wikipedia.org/wiki/PDF][PDF]] files. It also exploits the [[https://wiki.contextgarden.net/SyncTeX][SyncTeX]] library to link anchors in [[https://en.wikipedia.org/wiki/PDF][PDF]]
files produced with LaTeX to the original LaTeX sources. In order to use files produced with LaTeX to the original LaTeX sources. Listing
[[https://github.com/vedang/pdf-tools][pdf-tools]], you have to type {{{kbd(M-x pdf-tools-install)}}} after installation [[lst:setup-pdf-tools]] loads =bookmark= in order to use [[https://github.com/vedang/pdf-tools][pdf-tools]] with
of [[https://github.com/vedang/pdf-tools][pdf-tools]] from [[https://melpa.org/][MELPA]] or after each update of [[https://github.com/freedesktop/poppler][poppler]] to build or rebuild the [[https://github.com/nicolaisingh/saveplace-pdf-view][saveplace-pdf-view]]. Building or rebuilding the =epdfinfo= executable that
=epdfinfo= executable that serves the [[https://en.wikipedia.org/wiki/PDF][PDF]] files to Emacs. Table serves the [[https://en.wikipedia.org/wiki/PDF][PDF]] files to Emacs is necessary after installation of [[https://github.com/vedang/pdf-tools][pdf-tools]] from
[[https://melpa.org/][MELPA]] or after each update of [[https://github.com/freedesktop/poppler][poppler]]. Table
[[tab:pdf-view-mode-commands-and-bindings]] lists important local map key bindings [[tab:pdf-view-mode-commands-and-bindings]] lists important local map key bindings
in ~pdf-view-mode~. Note: ~image-save~ saves the page under point to a ~png~ in ~pdf-view-mode~. Note: ~image-save~ saves the page under point to a ~png~
file. file.
@ -1852,10 +1852,13 @@ file.
#+caption: Setup =pdf-tools=. #+caption: Setup =pdf-tools=.
#+name: lst:setup-pdf-tools #+name: lst:setup-pdf-tools
#+begin_src emacs-lisp -n :results silent #+begin_src emacs-lisp -n :results silent
(when (ensure-package-installation 'pdf-tools) (when (ensure-package-installation 'pdf-tools 'saveplace-pdf-view)
;; Enable `save-place-mode' after loading those two libraries.
(require 'bookmark) ; Prevent unexpected Emacs setup weirdness.
(require 'saveplace-pdf-view) ; Like the documentation.
(save-place-mode +1) ; Like the documentation.
;; Use `pdf-loader-install' for faster startup than with `pdf-tools-install'. ;; Use `pdf-loader-install' for faster startup than with `pdf-tools-install'.
(pdf-loader-install) (pdf-loader-install)
(with-eval-after-load 'pdf-view (with-eval-after-load 'pdf-view
(setopt pdf-view-display-size 'fit-page (setopt pdf-view-display-size 'fit-page
pdf-view-use-scaling (eq system-type 'darwin)))) pdf-view-use-scaling (eq system-type 'darwin))))