From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: links-9.0 v3 Date: Thu, 07 Jul 2016 10:20:17 +0200 Message-ID: <87k2gxg8qm.fsf@saiph.selenimh> References: <87oa6afmeu.fsf@saiph.selenimh> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:52290) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bL4Xq-00010e-T7 for emacs-orgmode@gnu.org; Thu, 07 Jul 2016 04:20:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bL4Xo-0006hY-Ql for emacs-orgmode@gnu.org; Thu, 07 Jul 2016 04:20:25 -0400 Received: from relay3-d.mail.gandi.net ([2001:4b98:c:538::195]:57060) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bL4Xo-0006hN-KN for emacs-orgmode@gnu.org; Thu, 07 Jul 2016 04:20:24 -0400 In-Reply-To: (John Kitchin's message of "Wed, 06 Jul 2016 21:55:32 -0400") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: John Kitchin Cc: "emacs-orgmode@gnu.org" Hello, John Kitchin 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