Not sure why this is, but I just tried an org-mode Latex export (C-c C-e l o), but it opened GIMP to display my resulting pdf file. I'm on 27.1 and 9.4. My system is Ubuntu 20.04 with Gnome. I went to org-file-apps and see \.pdf\'
set to Use default
. What are my best options to set the Ubuntu "document viewer" -- which is the default viewer throughout the system -- to be my org-mode Latex export viewer? So yes, the org-Latex interaction is healthy, just the strange choice Emacs/org-mode is making for my viewer. Obviously I could leave off the auto-open, but still...
2 Answers
I faced a similar issue - the pdf was being opened within emacs itself rather than the default OS pdf viewer.
While I'm not sure how to get emacs to use the correct default OS apps, I fixed this by changing ("\\.pdf\\'" . default)
to ("\\.pdf\\'" . "atril %s")
in the org-file-apps
list (atril is my pdf viewer).
Edit: (details on using the customize interface)
You simply have to change the string for "Command" where the "Extension" is \.pdf\'
and then State
-> "Save for Future Sessions":
There are instructions and examples below the State
button for customizing this variable in particular.
-
The commenter of the OP together with this answer gave me what I needed. However, the Emacs customize page for
org-file-apps
is a bit cryptic on just how to add in the("\\.pdf\\'" . "atril %s")
. I wound up just hand-adding into theorg-file-apps
section of my init.el. Nice would be if someone could explain how to navigate the customize page correctly.– 147pmCommented Dec 13, 2020 at 20:07
Instead of fixing this in emacs, one can also change the system default. Emacs uses /etc/mailcap
, probably through run-mailcap
. /etc/mailcap
gets refreshed by /usr/sbin/update-mime
, so to influence what gets listed there first one has to edit /etc/mailcap.order
.
I added one line there:
$ grep pdf /etc/mailcap.order
org.gnome.Evince:application/pdf
Then I ran:
sudo /usr/sbin/update-mime
org-file-aps
defaults to looking up the app for a mime-type in the systemmailcap
files. But, ifgimp
is installed on Debian and friends, it adds an entry inmailcap
saying that it is the right thing to open pdf. Strange but true.