branch: externals/dired-preview
commit a4ab2b5be5f2d104eb429389cebd9bb2f2b35add
Author: Protesilaos Stavrou <i...@protesilaos.com>
Commit: Protesilaos Stavrou <i...@protesilaos.com>

    Make the page up/down commands work with PDF files
    
    Thanks to fab6 for informing me that the original implementation was
    not complete. This was done in a comment to issue 24: 
<https://github.com/protesilaos/dired-preview/issues/24#issuecomment-2728818329>.
---
 README.org       |  2 +-
 dired-preview.el | 13 ++++++++++---
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/README.org b/README.org
index 26616b673a..95d824f5fe 100644
--- a/README.org
+++ b/README.org
@@ -368,7 +368,7 @@ matters.
 
 + Ideas and/or user feedback :: Bruno Boal, Ed Hamilton, Karthik
   Chikmagalur, Peter Prevos, Ramon Diaz-Uriarte, Yiyu Zhou, artelse,
-  Inkbottle00.
+  fab6, Inkbottle00.
 
 * GNU Free Documentation License
 :PROPERTIES:
diff --git a/dired-preview.el b/dired-preview.el
index 371628cd30..fbfc2a0b1d 100644
--- a/dired-preview.el
+++ b/dired-preview.el
@@ -469,15 +469,22 @@ Also see `dired-preview-find-file'."
 This technically runs `scroll-up-command'."
   (interactive)
   (dired-preview-with-window
-    (call-interactively 'scroll-up-command)))
+    (call-interactively
+     (pcase (derived-mode-p major-mode)
+       ('doc-view-mode 'doc-view-scroll-up-or-next-page)
+       ('pdf-view-mode 'pdf-view-scroll-up-or-next-page)
+       (_ 'scroll-up-command)))))
 
 ;; Same as above for the terminology.
 (defun dired-preview-page-up ()
   "Move a page up in the preview window.
 This technically runs `scroll-down-command'."
   (interactive)
-  (dired-preview-with-window
-    (call-interactively 'scroll-down-command)))
+  (call-interactively
+     (pcase (derived-mode-p major-mode)
+       ('doc-view-mode 'doc-view-scroll-down-or-previous-page)
+       ('pdf-view-mode 'pdf-view-scroll-down-or-previous-page)
+       (_ 'scroll-down-command))))
 
 (declare-function hexl-mode "hexl")
 (declare-function hexl-mode-exit "hexl" (&optional arg))

Reply via email to