all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Nicolas Goaziou <mail@nicolasgoaziou.fr>
To: John Kitchin <jkitchin@andrew.cmu.edu>
Cc: "emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org>
Subject: Re: links-9.0 v3
Date: Thu, 07 Jul 2016 10:20:17 +0200	[thread overview]
Message-ID: <87k2gxg8qm.fsf@saiph.selenimh> (raw)
In-Reply-To: <m2vb0iky97.fsf@Johns-MacBook-Air.local> (John Kitchin's message of "Wed, 06 Jul 2016 21:55:32 -0400")

Hello,

John Kitchin <jkitchin@andrew.cmu.edu> 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'.

WDYT?

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

Regards,

-- 
Nicolas Goaziou

  reply	other threads:[~2016-07-07  8:20 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-06 14:41 links-9.0 v3 John Kitchin
2016-07-06 22:10 ` Nicolas Goaziou
2016-07-06 23:06   ` John Kitchin
2016-07-07  1:55   ` John Kitchin
2016-07-07  8:20     ` Nicolas Goaziou [this message]
2016-07-07 13:27       ` John Kitchin
2016-07-07 14:56         ` Nicolas Goaziou
2016-07-07 19:17           ` John Kitchin
2016-07-08 21:32             ` Nicolas Goaziou
2016-07-07 19:21           ` John Kitchin
2016-07-08 21:48             ` Nicolas Goaziou
2016-07-08 22:04               ` John Kitchin
2016-07-09 13:27               ` John Kitchin
2016-07-18 12:02                 ` Nicolas Goaziou
2016-07-15  1:12               ` John Kitchin
2016-07-18 11:48                 ` Nicolas Goaziou
2016-07-18 15:20                   ` John Kitchin
2016-07-18 16:05                     ` Nicolas Goaziou
2016-07-18 16:55                       ` John Kitchin
2016-07-18 21:59                         ` Nicolas Goaziou
2016-07-18 23:37                           ` John Kitchin
2016-08-06  1:14                         ` [PATCH] " Matt Lundin
2016-08-08  0:12                           ` John Kitchin
2016-08-08  5:30                             ` Robert Klein
2016-08-08  9:21                               ` Nicolas Goaziou
2016-08-08  9:08                           ` Nicolas Goaziou

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87k2gxg8qm.fsf@saiph.selenimh \
    --to=mail@nicolasgoaziou.fr \
    --cc=emacs-orgmode@gnu.org \
    --cc=jkitchin@andrew.cmu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.