[Top][All Lists]

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

Re: [O] links-9.0 v3

From: Nicolas Goaziou
Subject: Re: [O] links-9.0 v3
Date: Thu, 07 Jul 2016 10:20:17 +0200


John Kitchin <address@hidden> writes:

> I think I have addressed these. Revised commits appended and at 
> https://github.com/jkitchin/org-mode/tree/link-9.0-v3.
> The new org-link-set-parameters function you suggested works fine as far
> as I can tell. WDYT?

That's great. I realized there's one gotcha left.

>                 (let* ((option (org-element-property :search-option link))
>                        (app (org-element-property :application link))
>                        (dedicated-function
> -                       (nth 1 (assoc app org-link-protocols))))
> +                       (org-link-get-parameter type :follow)))
>                   (if dedicated-function

Here is the gotcha. `type' is "file", not "file+sys" or "file+emacs",
so, when checking `dedicated-function' first, we cannot tell the
difference between "file+sys" and "file+emacs".

One solution is to swap the logic order. First, if app is non-nil, we
use it. If it isn't, we look after `dedicated-function'.

Another solution is to add an optional parameter to the signature of
the :follow function, which would be the "app" (e.g. "emacs", "sys",
"docview"...) to use. I tend to think this solution is slightly better,
since it doesn't require to hard-code logic in `org-open-at-point'.


>    (let ((data (assoc type org-link-parameters)))
> -    (if data
> -     (cl-loop for (key val) on parameters by #'cddr
> -              do
> -              (setf (cl-getf (cdr data) key)
> -                    val))
> +    (if data (setcdr data (org-combine-plists (cdr data) parameters))
>        (push (cons type parameters) org-link-parameters)
>        (org-make-link-regexps)
>        (org-element-update-syntax))))

This change can be merged with `org-link-set-parameters' definition.

> +(defcustom org-link-parameters
> +  '(("http") ("https") ("ftp") ("mailto")
> +    ("file" :complete 'org-file-complete-link)
> +    ("file+emacs") ("file+sys")
> +    ("news") ("shell") ("elisp")
> +    ("doi") ("message") ("help"))

See above about "file+emacs" and "file+sys", which are not valid types.


Nicolas Goaziou

reply via email to

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