0

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...

1
  • 2
    This is a weirdness of Debain-based systems: org-file-aps defaults to looking up the app for a mime-type in the system mailcap files. But, if gimp is installed on Debian and friends, it adds an entry in mailcap saying that it is the right thing to open pdf. Strange but true. Commented Dec 12, 2020 at 23:26

2 Answers 2

1

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":

enter image description here

There are instructions and examples below the State button for customizing this variable in particular.

1
  • 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 the org-file-apps section of my init.el. Nice would be if someone could explain how to navigate the customize page correctly.
    – 147pm
    Commented Dec 13, 2020 at 20:07
1

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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