I have been using a pdf-tools fork with a image-roll.el support, this fork and file make it possible to scroll continuously from the end of a page to the beginning of the other without jumping from end of page to beginning of the next page, and I got it to work with my emacs, but there is a downside that to make it operational I always have to go to the buffer where my pdf is being displayed and in that buffer type M-x pdf-view-roll-minor-mode and after this it works very well, I am new to emacs and lisp, but is there a way to make this command automatic whenever I open a pdf-tools buffer?

I mean, in the documentation it seems as if pdf-view-roll-minor-mode is a variable that begins with the value nil and there is something about toggle and positive and negative values, can't I change the value of this in the init.el and have it always on and working whenever I open a pdf view buffer?

  • Have you tried (ad-hook 'pdf-view-mode #'pdf-view-roll-minor-mode) in your init file ?
    – gigiair
    May 29, 2022 at 5:59
  • Hello, I didn't know what hooks were but I have tried to put this code in my init file and it gave me an error about the function definition being void in add-hook.
    – user38135
    May 29, 2022 at 15:53
  • There are a couple of typos in that suggestion. I've added an answer with the corrected config.
    – phils
    May 30, 2022 at 1:12

1 Answer 1


I mean, in the documentation it seems as if pdf-view-roll-minor-mode is a variable

Any minor mode symbol is both a command function and also a variable, where the command enables or disables the mode, and the variable indicates the current state of the mode.

Invoking the command with M-x pdf-view-roll-minor-mode would toggle the state.

Command functions can also be called in code, and the normal approach to your question is to use a "mode hook" to do that:

(add-hook 'pdf-view-mode-hook #'pdf-view-roll-minor-mode)

Which essentially says "after enabling pdf-view-mode call the function pdf-view-roll-minor-mode".

Note that C-hf pdf-view-mode tells you:

In addition to any hooks its parent mode special-mode might have run, this mode runs the hook pdf-view-mode-hook, as the final or penultimate step during initialization.

and if you inspect that hook variable with C-hv pdf-view-mode-hook you'll observe your configuration.

  • Thank you very much!!! May 30, 2022 at 2:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.