0

I've installed pdf-tools through MELPA, and it works like a charm. Funnily, and as is documented in the readme, the command pdf-tools-install needs to be run each time if you want pdf-tools to be enabled; (require 'pdf-tools) is not enough (the use of the word "install" in the command name is a little bit misleading). The only thing is, it takes 12 seconds or so to run pdf-tools-install from my init.el file (clocked using esup).

So what I've done is the following:

(with-eval-after-load 'tex
  (pdf-tools-install)
  (setq TeX-view-program-selection '((output-pdf "pdf-tools")))
  (setq TeX-view-program-list '(("pdf-tools" "TeX-pdf-tools-sync-view"))))

which allows it to only load when I'm in tex mode, which is nice. But it still means it takes an extra 12 seconds to load any tex file I want to work on, if I haven't loaded it in my current emacs session.

Call me impatient, but I literally moved to emacs from a more bloated editor in order to reduce startup times!! Is there any reason anyone can think of why it's taking so long to load pdf-tools-install, and a solution? Thanks in advance!

EDIT: Because of discussions following this issue, I replaced pdf-tools-install with (require 'pdf-tools) in my init.el just to make sure that pdf-tools-install is indeed required, and it seems that it is. Using (require 'pdf-tools) does not properly initiate pdf-tools, and pdfs are displayed using the normal DocView mode, rather than pdf-tools' PDFView mode.

  • 1
    You only need to install pdf-tools once, not every time you open a tex file. – Dan Dec 23 '17 at 16:17
  • according to the readme, pdf-tools-install needs to be in the init.el. When it is not, there is lots of missing functionality (synctex doesn't work, for instance) – sacuL Dec 23 '17 at 16:33
  • I just checked, it just ends up reverting to docview instead of using PDFview without running pdf-tools-install. – sacuL Dec 23 '17 at 16:44
  • Just run pdf-tools-install once and then put (require 'pdf-tools) in your init file. – Dan Dec 23 '17 at 16:57
  • @Dan, with (require 'pdf-tools), startup time is still about 12 seconds, and fails to work; auctex reverts to docview. – sacuL Dec 23 '17 at 17:14
1

Try setting the variable pdf-view-use-unicode-ligther to nil, according to the doc it speeds up the loading on systems where looking for the unicode symbols used in the mode line (⎙ and 🌙) takes a long time.

  • Amazing! That works perfectly. Thanks! – sacuL Dec 23 '17 at 17:13
1

After having pdf-tools installed (just once), put the following in your init file:

(add-hook 'doc-view-mode-hook 'pdf-tools-install) 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.