protesilaos / dired-preview

Automatically preview file at point in Emacs Dired.
GNU General Public License v3.0
57 stars 2 forks source link

integration with pdf-tools? #17

Open gvoysey opened 2 weeks ago

gvoysey commented 2 weeks ago

hi prot,

perhaps this is an obvious question, but how would i go about opening pdf-tools in a dired-preview managed window when i navigate to a pdf file?

protesilaos commented 2 weeks ago

From: Graham Voysey @.***> Date: Tue, 5 Nov 2024 06:45:49 -0800

hi prot,

Hello there!

perhaps this is an obvious question, but how would i go about opening pdf-tools in a dired-preview managed window when i navigate to a pdf file?

You mean how to produce a preview or how to open the actual file? In the former case, this should happen already but do let me know if it does not. In the latter case, RET in dired should visit the file at point. Otherwise, try the command 'dired-preview-find-file', which is bound to 'C-c C-f' in the 'dired-preview-mode-map'.

-- Protesilaos Stavrou https://protesilaos.com

gvoysey commented 9 hours ago

I see now that pdf-mode is enabled -- but the preview itself isn't there. Here's a hopefully not very information-leaking screenshot: image

If (and only if) i have already opened the pdf file (with RET in dired, e.g.) in question with pdf-tools (ie, i have a buffer in PDFView mode open but not displayed), dired-preview will display that:

image

but, i'd like to have dired-preview do the previewing without having to first open all the PDFs first :)

I configure dired-preview as follows:

    (use-package ready-player
      :straight ( ready-player :type git :host nil :repo "https://github.com/xenodium/ready-player")
      :config
      (setq ready-player-autoplay nil)
      (setq ready-player-repeat nil)
      )
    (use-package dired-preview
      :straight (dired-preview :type git :host nil :repo "https://github.com/protesilaos/dired-preview")
      :bind (:map dired-mode-map ("P" . dired-preview-mode))
      :after ready-player
      :hook (ready-player-mode . dired-preview-mode)
      :config
      (setq dired-preview-max-size (expt 2 25))
      (setq dired-preview-delay 0.1)
      )

and pdf-tools:

  (use-package
    pdf-tools
    :init (pdf-tools-install t)
    (setq-default
     pdf-view-display-size
     'fit-page))