use-package icon indicating copy to clipboard operation
use-package copied to clipboard

How can I properly defer pdf-tools?

Open alienbogart opened this issue 6 years ago • 1 comments

Runtime Environment

  • MX Linux 18
  • GNU Emacs 27.0.50
  • Evil version 1.2.14
  • .emacs.d
  • packages
  • use-package: 20181119.2350
  • pdf-tools: 20190129.1822

Issue

With the configuration,

(use-package pdf-tools
  :defer t
  :init
  (add-to-list 'auto-mode-alist '("\\.pdf\\'" . pdf-view-mode)))

I get the following error whenever I try to open a PDF file:

File mode specification error: (void-function pdf-view-mode)

If I remove the deferring it opens PDFs normally, but I get a huge loss in performance. Other modes work fine with deferring, what's going on here?

alienbogart avatar Mar 13 '19 12:03 alienbogart

Please try :mode instead of :init.

(use-package pdf-tools
  :mode ("\\.pdf\\'" . pdf-view-mode))

conao3 avatar Feb 22 '21 19:02 conao3

@conao3 answered this question, so I'm closing this issue now.

skangas avatar Nov 13 '22 20:11 skangas