reddit / emacs

Do all Emacs versions have blurry pdfs in pdf-tools on M1 Macbooks?

East_Staff3288 · 2022-07-26 13:23
Are any of you using M1 Mac and figured out how to make pdf not blurry?
HM0880 · 2022-07-26 14:11
;; Fix blurry PDFs on MacOS. ;; From https://github.com/politza/pdf-tools/issues/51 (setq pdf-view-use-scaling t)
East_Staff3288 · 2022-07-26 15:23
I have tried it - to no avail: [https://i.imgur.com/CswwG0w.png](https://i.imgur.com/CswwG0w.png) I have reloaded, restarted etc. changed elpa to melpa version of pdf-tools (as suggested in some answer post) but nothing has worked. As you can see from the uploaded image, it's still blurry. I have also blurry icons in Dired and Treemacs, look: [https://i.imgur.com/1Q2Qfo4.png](https://i.imgur.com/1Q2Qfo4.png) perhaps it is connected? I am on MB Air M1.
HM0880 · 2022-07-26 16:09
- Are you using the latest PDF tools fork: https://github.com/vedang/pdf-tools ? - See this issue (particularly the last comment): https://github.com/vedang/pdf-tools/issues/48
vcored · 2022-07-26 16:19
Which emacs version are you using? For sharp pdf-tools buffers you’ll need either mituharu’s [emacs-mac](https://bitbucket.org/mituharu/emacs-mac/src/master/) port or GNU Emacs 28. Other versions don’t have the capabilities to report frame’s scale factor. Also, make sure to use [vedang’s pdf-tools fork.](https://github.com/vedang/pdf-tools)
East_Staff3288 · 2022-07-26 16:50
Thanks. Are there any ready to download compiled ports of emacs-mac port?
kundry_wag · 2022-07-26 16:59
Does that mean that `emacs-plus` [1] is not expected to work well? I'm using it and it looks good, but maybe it depends on other factors. [1]: https://github.com/d12frosted/homebrew-emacs-plus
GangstaKirBie · 2022-07-26 17:14
Check that you are using pdf-tools and not doc-view. I think you can use C-h m to describe mayor mode. If you are not using it yet, you might have to compile it with M-x pdf-tools-install or something like that.
vcored · 2022-07-26 17:28
Yes. There is a homebrew formula: https://github.com/railwaycat/homebrew-emacsmacport
vcored · 2022-07-26 17:30
If the version is at least 28 it will work. I would also disable imagemagick support just to be safe
AlanYx · 2022-07-26 18:13
>Also, make sure to use vedang’s pdf-tools fork. Thanks for this -- I didn't realize this was the version of pdf-tools to use.
ndpian · 2022-07-26 18:45
Related thread: https://www.reddit.com/r/emacs/comments/vk2w18/problems_with_pdftools_auctex_on_mac_m1_blurry/
East_Staff3288 · 2022-07-26 19:29
Yes, thanks a lot, it is working now. Here is a screenshot: [https://i.imgur.com/Iymcfxj.png](https://i.imgur.com/Iymcfxj.png) There is a bit difference, but the fonts are definitely not blurry anymore and actually finally very easy to read. For google visitors from the future (perhaps even me ;D): Backup your .emacs.d and .spacemacs config - or just rename them and add \_bak\_2022-07-26 at the end of the file/directory. If you have installed Emacs via homebrew uninstall the brew of Emacs 27 (or 26 etc.) then removed the tap - it was the d12 something tap for me. And throw to trash anything with Emacs in their name in your Applications folder where you have installed all your Mac apps. Perhaps take a look into /opt/homebrew/ folder but I didn't do anything there. Then install Emacs 28.1 as mentioned here: [https://github.com/railwaycat/homebrew-emacsmacport](https://github.com/railwaycat/homebrew-emacsmacport) , so: $ brew tap railwaycat/emacsmacport ​ $ brew install emacs-mac run this script o add Emacs into App search and Spotlight search: osascript -e 'tell application "Finder" to make alias file to POSIX file "/opt/homebrew/opt/emacs-mac/Emacs.app" at POSIX file "/Applications"' Then, if you want, install Spacemacs (don't forget to delete the newly created .emacs.d directory in your root folder before starting the Spacemacs installation): git clone https://github.com/syl20bnr/spacemacs ~/.emacs.d Then, replace the newly created .spacemacs file with your old .spacemacs file you have backed up at the beginning. Or start from scratch. Of course, the crucial part. is to add in the dotspacemacs/user-function this: (require 'package) (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t) (package-initialize) ;;;;; PDF Tools (use-package pdf-tools :ensure t :defer t :config (pdf-loader-install) (setq pdf-view-use-scaling t pdf-view-use-imagemagick t)) And restart Emacs and say Yes to any question about recompilation etc. Now the pdfs should be opened and nice to look at and not blurry. If there is some problem try to reload the pdf or open it differently via dired or treemacs or some other way. It should eventually open nicely.
colemacsen · 2022-07-26 20:18
EDIT: Nevermind, your post is about pdf-tools. Leaving this here in case it's helpful to someone else. ~~I'm not sure this has anything to do with an M1 chip or even Mac OS. I've had the same issue on both Linux and my Intel Macbook Pro using high-DPI scaling.~~ Check out the variable `doc-view-resolution` (`C-h v doc-view-resolution`). I'm betting it's at its default value, 100. Change the value of that variable to something like 300 (`M-x set-variable doc-view-resolution`) and then clear the doc-view cache (`M-x doc-view-clear-cache`). Open the file again, and it should look much clearer (though it'll take longer to load). Explanation (I think): Before it displays a PDF, DocView converts each page to a .png file and saves it to a directory which is the value of the variable `doc-view-cache-directory`. The reason the PDFs appear blurry is that you're actually viewing 100-dpi .png files.
East_Staff3288 · 2022-07-26 20:28
Coud be, but after switching to Emacs 28.1 (was on 27) even the letters in normal org files and any files are crisper. So, it is probably something with the whole 28 version and not only the doc-view or pdf-tools settings. But I am just guessing.
ppvvaa · 2022-07-26 21:56
I had the same problem, and found the solution which is described in the link that is [Here](https://www.reddit.com/r/emacs/comments/vk2w18/problems_with_pdftools_auctex_on_mac_m1_blurry/). It has to do with the version of pdf-tools which appears available by default is not the good one, and you must use melpa. I hope you can see this comment, because for some reason all my posting on this subreddit is flagged as spam by reddit.
HM0880 · 2022-07-27 01:52
Great follow-up for visitors from the future!
HM0880 · 2022-07-27 01:53
Are DirEd icons crisp now that you are on v28.1?
East_Staff3288 · 2022-07-27 07:11
The fonts not only in pdfs but everywhere in Emacs are definitely nicer and smoother - a proper 4k experience ;D. But the icons are still blurry/pixelated as you can see here: [https://i.imgur.com/ZeFOdYS.png](https://i.imgur.com/ZeFOdYS.png) . So, 28.1 seems to be nice for fonts and pdf rendering upgrade but those pesky icons are still not improved. Perhaps there was a newer Spacemacs version because I have noticed that some things in Helm are designed differently - I would say it even looks better. So, perhaps the icons are a Spacemacs issue? Perhaps it is related to this: [https://github.com/Alexander-Miller/treemacs/issues/861](https://github.com/Alexander-Miller/treemacs/issues/861) ?
worthless-trash · 2022-07-28 01:06
Not a trick question, why do people post about "m1 macbooks" as a factor in troubleshooting, are they usually buggy ?
quantum_mattress · 2022-07-28 04:48
They’re not buggy but they are using a totally different type of processor and can affect which apps run and how.
worthless-trash · 2022-07-28 11:51
But hasn't arm64 CPU's been around for quite a while ?