A minor mode for Emacs that implements a two-buffer hack to provide continuous scrolling in pdf-tools
This mode works only from Emacs 27 (see here). It includes keybindings to just work also on Spacemacs.
Probably this minor-mode will get updated a few times over the next days so keep your eyes on it, or install it using a Quelpa recipe. Spacemacs users can install the package (using Quelpa) by adding the following lines to the list of additional packages
in their .spacemacs file:
(pdf-continuous-scroll-mode :location (recipe
:fetcher github
:repo "dalanicolai/pdf-continuous-scroll-mode.el"))
Subsequently load the file or add the following lines to your dotfile:
(with-eval-after-load 'pdf-view
(require 'pdf-continuous-scroll-mode))
Then when you open a file in pdf-tools you can just toggle the mode on and of using M-x pdf-continuous-scroll-mode
. If you like to to start pdf-tools with the minor mode activated then add a hook by placing the following lines in your dotfile:
(add-hook 'pdf-view-mode-hook 'pdf-continuous-scroll-mode)
You can set the scroll step size via the customizable variable pdf-continuous-step-size
.
Of course any feedback is welcome (possibly by opening an issue in the repo).
Keybindings
Emacs | Spacemacs | Function |
---|---|---|
C-n |
j |
pdf-continuous-scroll-forward |
C-p |
k |
pdf-continuous-scroll-backward |
n |
J |
pdf-continuous-next-page |
p |
K |
pdf-continuous-previous-page |
C-d |
C-j |
pdf-view-scroll-up-or-next-page |
(works on single buffer, but handy for skimming) | ||
C-u |
C-k |
pdf-view-scroll-down-or-previous-page |
(idem as previous) | ||
M-g g/M-g M-g |
g t |
pdf-cscroll-view-goto-page |
M-< |
g g |
pdf-cscroll-first-page |
M-> |
G |
pdf-cscroll-last-page |
Q |
Q |
pdf-cscroll-kill-buffer-and-windows |
C-f |
l |
pdf-cscroll-image-forward-hscroll |
C-b |
h |
pdf-cscroll-image-backward-hscroll |
T |
M |
pdf-cscroll-toggle-mode-line |
M |
pdf-cscroll-toggle-narrow-mode-line | |
C-c C-a l |
SPC m a l (, a l) |
pdf-cscroll-annot-list-annotations |
Comments
If you like to scroll using the mouse-wheel then you might want to get rid of the mode-line using pdf-cscroll-toggle-mode-line
, or in vanilla Emacs you might prefer to just narrow down the mode-line using pdf-cscroll-toggle-narrow-mode-line
.
Related: double page layout
In this comment the user apnewberry posted code to realize a double page layout (and apparently he suggested this pdf-continuous-scroll-hack before)
Related projects
https://github.com/dalanicolai/djvu2.el
djvu2Show djvu annotations within Emacs (extending djvu.el). There is also a Spacemacs djvu layer which additionally implements smooth scrolling in djvu.
https://github.com/dalanicolai/toc-mode
toc-modeA package to create and attach Table of contents to pdf and djvu documents. There is also a toc-layer for Spacemacs
https://melpa.org/#/calibredb
calibredbA super nice calibre frontend within Emacs