fix(dired): fail gracefully if pdf-tools isn't installed

Will throw a "void-variable pdf-info-epdfinfo-program" error if
pdf-tools isn't installed (or `:tools pdf` is disabled).
This commit is contained in:
Henrik Lissner 2024-08-21 02:14:57 -04:00
parent a6c3c6842a
commit 4ed3e75f5f
No known key found for this signature in database
GPG key ID: B60957CA074D39A3

View file

@ -213,8 +213,8 @@ Fixes #3939: unsortable dired entries on Windows."
(defadvice! +dired--autoload-pdf-tools-a (fn &rest args)
:around #'dirvish-pdf-dp
(when (equal (nth 1 args) "pdf")
(require 'pdf-tools nil t)
(if (file-exists-p pdf-info-epdfinfo-program)
(if (and (require 'pdf-tools nil t)
(file-exists-p pdf-info-epdfinfo-program))
(apply fn args)
'(info . "`epdfinfo' program required to preview pdfs; run `M-x pdf-tools-install'")))))