politza / pdf-tools

Emacs support library for PDF files.
GNU General Public License v3.0
1.57k stars 162 forks source link

pdf-view-previous-line-or-next-page does not work in a hydra / another window until pdf-view-next-line-or-next-page #544

Closed AlexLewandowski closed 4 years ago

AlexLewandowski commented 4 years ago

Here is a basic example of a hydra I am using:

(defhydra hydra-pdftools (:color red :hint nil
                                 :pre (setq which-key-inhibit t)
                                 :post (setq which-key-inhibit nil))
  "
  Navigation^^^^
  ----------^^^^---------------
  [_j_/_k_] scroll down/up
  "
  ;; Navigation
  ("j"  pdf-view-next-line-or-next-page :exit nil)
  ("k"  pdf-view-previous-line-or-previous-page :exit nil)
  )

If I am zoomed out, pdf-view-previous-line-or-next-page should move to the previous page and this works fine.

However, if am zoomed in enough such that pdf-view-previous-line-or-next-page should trigger a previous line, it does not. It will instead move to the previous line after calling pdf-view-next-line-or-next-page. Hence, in the hydra if I press k nothing happens. If I press k and then j nothing happens (the up and down motion cancel). If I press k k and then j I move up one line. If I press k enough times that I move up a page, then it will instantly trigger the previous page without scrolling through the previous lines.

This has been a problem for a while, possibly related to #212. It is not related to the issue unique to Emacs 27 (#520).

Edit: The hydra works in doc-view as expected, with doc-view-previous/next commands inplace of pdf-view-previous/next.

AlexLewandowski commented 4 years ago

I erroneously thought that I had not loaded my config files, but some custom variables were in fact loaded. The offending variable was

'(hydra--work-around-dedicated nil t)

Commenting this out fixes my issue, apologies!