reddit / emacs
PDF/DJVU viewing unuseably slow in emacs 28.1.
talgu · 2022-09-02 01:41
Does anyone know why this is and whether I can do something about that? Zathura is bleedingly fast by comparison. However I want to switch to Emacs since apparently it can do annotations in PDFs and DJVU files. The problem is that whenever I open either type of file Emacs immediately maxes out my CPU and basically stops, forcing me to kill it.
flexibeast · 2022-09-02 02:08
Difficult to offer thoughts without more details of your setup. Are you using stock Emacs, or a distro like Doom? In what context/OS? What relevant extensions do you have enabled? Is your configuration set up to do certain things when opening files? And so on.
talgu · 2022-09-02 02:19
It's mostly stock Emacs. It's the standard Void Linux package. I'm not sure which extensions would be relevant honestly and if anything happens when files are opened I do not know about it. I haven't set anything like that up myself. I do use Evil, and I have Ivy, Helpful, and use-package installed additionally. Is there anything else I can/should check for?
flexibeast · 2022-09-02 02:29
So you're viewing PDFs with doc-view-mode, i.e. is that the mode you eventually end up in when viewing a PDF? (i was previously on Void, and never had the sort of issues you describe, although that was prior to 28.1.) Have you tried starting Emacs via `emacs -Q` and checking if the problem is still there?
talgu · 2022-09-02 02:40
It seems like it's doc-view-mode, at least the modeline says "DocView". Yeah, Void is generally pretty good. :)
Okay, I tried `emacs -Q` now (I didn't know about it before) and the problem doesn't occur. So it would seem like it's something in my config? How do I go about debugging that? Do I just comment out packages until I find the one causing the issue?
flexibeast · 2022-09-02 02:44
Yeah, either that or bisecting (removing one half of your config, checking what happens, repeat with the remaining half), depending on the size of your config.
Void is indeed a pretty good distro! i only moved to Gentoo relatively recently, because i've been using Linux systems long enough to be able to want to specify "Don't need *that*, but do want *this*", etc.
thetemp_ · 2022-09-02 02:57
If you're using docview-mode, try setting up [pdf-tools](https://github.com/vedang/pdf-tools). It's much faster.
talgu · 2022-09-02 03:56
So after some testing it seems that linum-relative is the problem. Not sure what to do about that.
I used to use Gentoo years ago and it's great. I like Void for it's low effort though. There it's much that ever requires attention. But I'm thinking of trying out Source Mage sometime. :)
talgu · 2022-09-02 04:01
This seems really useful thank you! :) Do you happen to know of something similar for DJVU files?
flexibeast · 2022-09-02 04:10
\*nod\* That seems plausible, as doc-view-mode already disables other line numbering stuff, as per `doc-view.el`:
(setq-local global-linum-mode nil
display-line-numbers-mode nil)
This is the sort of thing you can deal with via a hook, when one has been provided; add to your config something like:
(add-hook 'doc-view-mode-hook
(defun my-doc-view-function ()
"Function to run when doc-view-mode starts."
(linum-relative-off)))
The function can be removed from the hook with:
(remove-hook 'doc-view-mode-hook #'my-doc-view-function)
Hadn't heard of Source Mage! Will read up on it, thanks. :-)
thetemp_ · 2022-09-02 04:10
Nope. I imagine docview-mode can handle them. But as you've discovered it can be slow.
MatthewZMD · 2022-09-02 07:15
You might want to have a look at EAF for fastest pdf viewing experience.