On Wed, May 25, 2022 at 11:26 AM Max Nikulin <maniku...@gmail.com> wrote: > > On 25/05/2022 21:10, Alessandro Bertulli wrote: > > > > I'm not sure if it's the best way to do so, but it worked for me by > > using a lambda: > > > > (setq citar-file-open-function '(lambda (file) > > (async-shell-command (format-message "sioyek \"%s\"" file)))) > > First of all, it is unsafe. File names for papers downloaded from > various sources may have enough fancy characters including double > quotes, etc. having special meaning for shell. > > Use at least `shell-quote-argument' instead of adding double quotes. > > Depending on your OS I suggest to have a look at the implementation of > `browse-url-xdg-open', `browse-url-default-macosx-browser', > `browse-url-default-windows-browser' for an example how to start > external viewer process. > > On 25/05/2022 18:00, Bruce D'Arcus wrote: > > You just need to set `citar-file-open-function` to your preferred > > function; say xdg-open. > > Is there a reason to avoid emacs global or even system global settings > obtained through mailcap.el? While `mailcap-view-file' is quite new > addition, the function was inspired by `org-open-file' and the latter > queries mailcap settings.
No reason, other than that nobody suggested it. It could be, however, that when using citar, some users may have more specialized needs. For example, maybe Alessandro wants to use Sioyek when reading PDFs of scholarly articles and such, but the standard system PDF viewer otherwise. But I suppose these aren't mutually exclusive; citar could always, notwithstanding the bug you note below, fallback to making use of mailcap? > Actually I suspect that there may be some problems especially with > Emacs-27 (see "org--file-default-apps" thread), but the consequences is > not clear for me yet. > https://debbugs.gnu.org/cgi/bugreport.cgi?bug=40247 > mailcap-mime-data erased when parsing mime parts >