branch: externals/dired-preview
commit b0cba0825d2eea2ac6d9a8ef65a73b6186e6d294
Author: Protesilaos Stavrou <[email protected]>
Commit: Protesilaos Stavrou <[email protected]>

    Do not rely on derived-mode-p to actually return the major mode symbol
    
    That it does so right now is an implementation detail that might
    change.
---
 dired-preview.el | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/dired-preview.el b/dired-preview.el
index 291ba3be1a..dc5233eedb 100644
--- a/dired-preview.el
+++ b/dired-preview.el
@@ -528,10 +528,12 @@ This technically runs `scroll-up-command'."
   (interactive)
   (dired-preview-with-window
     (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)))))
+     (cond
+      ((derived-mode-p 'doc-view-mode)
+       'doc-view-scroll-up-or-next-page)
+      ((derived-mode-p 'pdf-view-mode)
+       'pdf-view-scroll-up-or-next-page)
+      (t 'scroll-up-command)))))
 
 ;; Same as above for the terminology.
 (defun dired-preview-page-up ()
@@ -540,10 +542,12 @@ This technically runs `scroll-down-command'."
   (interactive)
   (dired-preview-with-window
     (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)))))
+     (cond
+      ((derived-mode-p 'doc-view-mode)
+       'doc-view-scroll-down-or-previous-page)
+      ((derived-mode-p 'pdf-view-mode)
+       'pdf-view-scroll-down-or-previous-page)
+      (t 'scroll-down-command)))))
 
 (declare-function hexl-mode "hexl")
 (declare-function hexl-mode-exit "hexl" (&optional arg))

Reply via email to