reddit / emacs

PDFView not starting correctly

dwdwdan · 2022-02-06 16:16
Hi. I'm trying to configure `pdf-tools` over `docview`, but it doesn't seem to be launching properly. If I open a pdf file in emacs, it first opens in `doc-view-mode`. I can manually enable `pdf-view-mode` using `M-x` which works fine. This doesn't at all match with what I've seen online. I'm using `straight.el` as a package manager, and I'm installing pdf-tools with `(use-package pdf-tools)` ETA: I have `straight-use-package-by-default` set to `t` earlier in my config Any idea what's going on?
oantolin · 2022-02-06 17:52
You need to run `pdf-tools-install` at some point. Try `(use-package pdf-tools :init (pdf-tools-install))`. (Don't worry: despite the name that function does not redownload and reinstall pdf-tools, it just (1) checks that the epdfinfo server is accessible and offers to rebuild it otherwise, and (2) associates PDFs with pdf-view-mode).
arthurno1 · 2022-02-07 22:01
I don't know how many times pdf-tools have broken my setup because of epdfinfo being "out of date". Occasionally my daemon does not start, or when I open org-file it will be a mess, or suddenly some functionality will not work. I get strange errors, almost never seeing any mentions about pdf-tools itself. Yet, after rebuilding the darn thing with pdf-tools-install, everything works normally. Is this just my setup, do I have to put something special in config, or what is the case with it? Is it so for everybody else?
oantolin · 2022-02-07 22:10
That does not sound normal. Whenever I update pdf-tools the epdfinfo program needs to be rebuilt, but the next time I try to open a PDF file I get a prompt clearly stating that epdfinfo needs rebuilding and asking if I want to do it now. No confusing error messages. At that prompt, if I'm on Linux I say yes and it gets compiled with no problem, only takes a few seconds. On Windows I don't have a compiler toolchain nor the requisite libraries so there I say no and just copy an old `epdfinfo.exe` (plus some `dll`s) I keep into the `~/.emacs.d/elpa/pdftools-.../` directory.
arthurno1 · 2022-02-07 22:50
I am very rarely asked to compile epdfinfo, it happened, but usually I will notice I need to rebuild it when my org-mode does not start normally, or my shortcuts in org-mode does not work :). Or when I see a standalone Emacs process starting up instead of just emacsclient popping up. Ok I'll investigate. Thank you for the feedback.