On 23/09/2022 21:49, Guillaume MULLER wrote:
- My OS settings are configured so that PDFs are opened in Evince. I
configured this with "xfce4-settings-manager > Default Applications"
(which runs "xfce4-mime-settings" under the hood) and it can be verified
with "xdg-open test.pdf" or by opening Thunar and clicking on "test.pdf".
I would name it desktop environment configuration since OS may have more
settings and it is your issue.
These settings likely alters ~/.config/mimeapps.list
https://specifications.freedesktop.org/mime-apps-spec/mime-apps-spec-1.0.html
"Association between MIME types and applications"
Unfortunately Emacs does not support this part of XDG specs, so there
are no ready to use functions to work with .desktop files and MIME
associations. You may add entries calling xdg-open for file types you
wish to the `org-file-apps' custom variable.
So, where in the world does org-mode/Emacs finds that it should use
Calibre instead of Evince?
You may have mailcap configuration where Calibre has higher priority
than Evince, check /etc/mailcap
RFC 1524. A User Agent Configuration Mechanism For Multimedia Mail
Format Information
https://www.rfc-editor.org/rfc/rfc1524.html
Emacs has limited support of mailcap and it is used by Org mode.
Besides system configuration, Emacs has a set of predefined association.
Unfortunately the latter is broken in Emacs-27, see
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=40247
#40247 - 27.0.90; mailcap-mime-data erased when parsing mime parts - GNU
bug report logs
- Now, I would like to circumvent this global OS behavior, so that Emacs
itself would be used specifically to open PDF links in files I open in
Emacs. When I was using Vanilla Emacs, I was advised to use pdf-tools,
and given a config that was working. I translated that into my DoomEmacs
config.org as follows:
(use-package! pdf-tools
:magic ("%PDF" . pdf-view-mode)
:config
(pdf-tools-install :no-query)
)
But apparently it does not override org's (default) behavior of
opening PDF file with external tools.
The code of `org-open-file' is tricky. You may instrument this function
for debugging and step through it to realize what actually happens.
Maybe pdf-tools vs. doc-view mode choice is controlled by `auto-mode-alist'.
Concerning external viewer configuration, you may adapt for Evince the
following approach:
Max Nikulin. Re: Org mode links: Open a PDF file at a given page and
highlight a given string. Sat, 3 Sep 2022 20:00:47 +0700.
https://list.orgmode.org/tevj61$17d8$1...@ciao.gmane.io