emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] org.el: Fix percent substitutions in `org-open-file'


From: Ihor Radchenko
Subject: Re: [PATCH] org.el: Fix percent substitutions in `org-open-file'
Date: Sat, 03 Sep 2022 16:26:37 +0800

Max Nikulin <manikulin@gmail.com> writes:

>>> +    (\"\\\\.pdf::\\\\(.+\\\\)\\\\\\='\" . \"okular file://%s\\\\\\\\#%1\")
>>> +    ;; No location within the file, optionally followed by \"::\",
>>> +    ;; e.g. <file:///usr/share/doc/bash/bashref.pdf>.
>>> +    (\"\\\\.pdf\\\\(?:::\\\\)?\\\\\\='\" . \"okular %s\")
>> 
>> This is a nice set of examples, but it probably does not belong to this
>> docstring. I'd rather see this in `org-file-apps' docstring or even in
>> the manual.
>
> I thought on this and I do not think it should be added to the manual. 
> Instead a set of hooks should be defined for popular PDF viewers: 
> evince, zathura, xpdf, firefox, chromium & Co, etc. Such hook injects a 
> number of supported `org-file-apps' records and users may add suitable 
> hook to e.g. (with-eval-after-load 'org (push ...)). It may be 
> implemented as a dedicated package org-pdf-viewers.el. The only problems 
> is that adding entries programmatically breaks easy customization 
> interface for `org-file-apps'. Currently there is the same issue with 
> `org-link-parameters' that is a defcustom variables with entries added 
> by various org extensions.

We may alter the :type specifier in `org-file-apps' to something like

:type `(repeat
         (choice
           ,org-file-apps-presets
           ...))

`org-file-apps-presets' will then contain :type specs for some common
file types and the apps. The variable can be easily populated by
third-party packages as well.

>       I added the example with hope to better explain the purpose of this 
>       function.

I do not think that it is needed in the `org--open-file-format-command'
docstring. If you wish, it would be better to add examples of the
arguments and return values of `org--open-file-format-command' instead
of showing `org-file-apps' examples.

-- 
Ihor Radchenko,
Org mode contributor,
Learn more about Org mode at https://orgmode.org/.
Support Org development at https://liberapay.com/org-mode,
or support my work at https://liberapay.com/yantar92



reply via email to

[Prev in Thread] Current Thread [Next in Thread]