emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: John Kitchin <jkitchin@andrew.cmu.edu>
To: Nicolas Goaziou <mail@nicolasgoaziou.fr>
Cc: "emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org>
Subject: Re: links-9.0 v3
Date: Mon, 18 Jul 2016 11:20:30 -0400	[thread overview]
Message-ID: <m2eg6rrn0h.fsf@andrew.cmu.edu> (raw)
In-Reply-To: <8737n7go9k.fsf@saiph.selenimh>

[-- Attachment #1: Type: text/plain, Size: 1744 bytes --]


Nicolas Goaziou writes:

> Hello,
>
> John Kitchin <jkitchin@andrew.cmu.edu> writes:
>
>> Here are my current suggestions for the org-link 9.0.
>
> Thank you.

I think I fixed the points you made in the previous email.

>
>> Let me know what the best way to send these might be. It looks like it
>> might be 21 patches right now.
>
> AFAIU, many among them introduce code that no longer exists in the final
> draft. It would be nice to make them disappear, using interactive
> rebasing, as suggested earlier in this thread.

I am not sure what you mean for this. Let me know if it isn't fixed in
the attached patches. I thought I had squashed everything into a concise
history. 

>
> If that's not possible, just send them over here, I'll apply them.
>
> BTW sent patch doesn't seem to include an option handler. Am I missing
> something?

What do you mean by an option handler?

Do you mean for this file:path::option

I think this code below (which should be in the patches) handles the
option correctly.

(defun org--open-file-link (path app)
  "Open PATH using APP.

PATH is from a file link, and can have the following syntax:
     [[file:~/code/main.c::255]]
     [[file:~/xx.org::My Target]]
     [[file:~/xx.org::*My Target]]
     [[file:~/xx.org::#my-custom-id]]
     [[file:~/xx.org::/regexp/]]

APP is '(4) to open the PATH in Emacs, or 'system to use a system application."
  (let* ((fields (split-string path "::"))	   
	 (option (and (cdr fields)
		      (mapconcat #'identity (cdr fields) ""))))
    (apply #'org-open-file
	   (car fields)
	   app
	   (cond ((not option) nil)
		 ((string-match-p "\\`[0-9]+\\'" option)
		  (list (string-to-number option)))
		 (t (list nil
			  (org-link-unescape option)))))))


>
> Regards,


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Create-org-link-parameters.patch --]
[-- Type: text/x-patch, Size: 16031 bytes --]

From ddc863fc16b8fe4b430e2f86b7ad96a0e90219cc Mon Sep 17 00:00:00 2001
From: John Kitchin <jkitchin@andrew.cmu.edu>
Date: Thu, 7 Jul 2016 09:58:29 -0400
Subject: [PATCH 01/20] Create `org-link-parameters'

* lisp/org-element.el: Replace `org-link-types' variable with
  `org-link-types' function.

* lisp/org.el: Replace the `org-link-types' variable with
  `org-link-types' function. Create `org-link-get-parameter' and
  `org-link-set-parameters' functions. Remove `org-add-link-type'. Add
  `org-store-link-functions' function and remove
  `org-store-link-functions' variable. Add `org--open-file-link' for use
  as a :follow function for file type links.

* lisp/org.el: Set :follow functions for file links in `org-link-parameters.
Define `org-open-file-link' that opens a file link with an app.

* testing/lisp/test-ox.el: Remove usage of the `org-link-types'
  variable.

* lisp/org-compat.el: Move `org-add-link-type' and mark it as obsolete.

* lisp/ox.el: Change org-add-link-type comment in ox.el.
---
 lisp/org-compat.el      |  31 +++++++++
 lisp/org-element.el     |   4 +-
 lisp/org.el             | 167 ++++++++++++++++++++++++++++++++----------------
 lisp/ox.el              |   2 +-
 testing/lisp/test-ox.el |  16 ++---
 5 files changed, 155 insertions(+), 65 deletions(-)

diff --git a/lisp/org-compat.el b/lisp/org-compat.el
index 92fdb1c..a856ff7 100644
--- a/lisp/org-compat.el
+++ b/lisp/org-compat.el
@@ -374,6 +374,37 @@ Implements `define-error' for older emacsen."
     (put name 'error-conditions
 	 (copy-sequence (cons name (get 'error 'error-conditions))))))
 
+(defun org-add-link-type (type &optional follow export)
+  "Add a new TYPE link.
+FOLLOW and EXPORT are two functions.
+
+FOLLOW should take the link path as the single argument and do whatever
+is necessary to follow the link, for example find a file or display
+a mail message.
+
+EXPORT should format the link path for export to one of the export formats.
+It should be a function accepting three arguments:
+
+  path    the path of the link, the text after the prefix (like \"http:\")
+  desc    the description of the link, if any
+  format  the export format, a symbol like `html' or `latex' or `ascii'.
+
+The function may use the FORMAT information to return different values
+depending on the format.  The return value will be put literally into
+the exported file.  If the return value is nil, this means Org should
+do what it normally does with links which do not have EXPORT defined.
+
+Org mode has a built-in default for exporting links.  If you are happy with
+this default, there is no need to define an export function for the link
+type.  For a simple example of an export function, see `org-bbdb.el'.
+
+If TYPE already exists, update it with the arguments.
+See `org-link-parameters' for documentation on the other parameters."
+  (org-link-add type :follow follow :export export) 
+  (message "Created %s link." type))
+
+(make-obsolete 'org-add-link-type "org-link-add." "Org 9.0")
+
 (provide 'org-compat)
 
 ;;; org-compat.el ends here
diff --git a/lisp/org-element.el b/lisp/org-element.el
index 269bc7d..9452641 100644
--- a/lisp/org-element.el
+++ b/lisp/org-element.el
@@ -185,7 +185,7 @@ specially in `org-element--object-lex'.")
 		"\\)\\)")
 	org-element--object-regexp
 	(mapconcat #'identity
-		   (let ((link-types (regexp-opt org-link-types)))
+		   (let ((link-types (regexp-opt (org-link-types))))
 		     (list
 		      ;; Sub/superscript.
 		      "\\(?:[_^][-{(*+.,[:alnum:]]\\)"
@@ -3108,7 +3108,7 @@ Assume point is at the beginning of the link."
 	      (string-match "\\`\\.\\.?/" raw-link))
 	  (setq type "file")
 	  (setq path raw-link))
-	 ;; Explicit type (http, irc, bbdb...).  See `org-link-types'.
+	 ;; Explicit type (http, irc, bbdb...).  
 	 ((string-match org-link-types-re raw-link)
 	  (setq type (match-string 1 raw-link))
 	  (setq path (substring raw-link (match-end 0))))
diff --git a/lisp/org.el b/lisp/org.el
index 2202d41..5b92e12 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -1758,6 +1758,73 @@ calls `table-recognize-table'."
   "Buffer-local version of `org-link-abbrev-alist', which see.
 The value of this is taken from the #+LINK lines.")
 
+(defcustom org-link-parameters
+  '(("file"  :complete #'org-file-complete-link)
+    ("file+emacs" :follow (lambda (path) (org--open-file-link path '(4))))
+    ("file+sys" :follow (lambda (path) (org--open-file-link path 'system)))
+    ("http") ("https") ("ftp") ("mailto")
+    ("news") ("shell") ("elisp")
+    ("doi") ("message") ("help"))
+  "An alist of properties that defines all the links in Org mode.
+The key in each association is a string of the link type.
+Subsequent optional elements make up a p-list of link properties.
+
+:follow - A function that takes the link path as an argument.
+
+:export - A function that takes the link path, description and
+export-backend as arguments.
+
+:store - A function responsible for storing the link.  See the
+function `org-store-link-functions'.
+
+:complete - A function that inserts a link with completion.  The
+function takes one optional prefix arg.
+
+:face - A face for the link, or a function that returns a face.
+The function takes one argument which is the link path.  The
+default face is `org-link'.
+
+:mouse-face - The mouse-face. The default is `highlight'.
+
+:display - `full' will not fold the link in descriptive
+display.  Default is `org-link'.
+
+:help-echo - A string or function that takes (window object position)
+as arguments and returns a string.
+
+:keymap - A keymap that is active on the link.  The default is
+`org-mouse-map'.
+
+:htmlize-link - A function for the htmlize-link.  Defaults
+to (list :uri \"type:path\")
+
+:activate-func - A function to run at the end of font-lock
+activation.  The function must accept (link-start link-end path bracketp) 
+as arguments."
+  :group 'org-link
+  :type '(alist :tag "Link display parameters"
+		:value-type plist))
+
+(defun org-link-get-parameter (type key)
+  "Get TYPE link property for KEY.
+TYPE is a string and KEY is a plist keyword."
+  (plist-get
+   (cdr (assoc type org-link-parameters))
+   key))
+
+(defun org-link-set-parameters (type &rest parameters)
+  "Set link TYPE properties to PARAMETERS.
+  PARAMETERS should be :key val pairs."
+  (let ((data (assoc type org-link-parameters)))
+    (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))))
+
+(defun org-link-types ()
+  "Returns a list of known link types."
+  (mapcar #'car org-link-parameters))
+
 (defcustom org-link-abbrev-alist nil
   "Alist of link abbreviations.
 The car of each element is a string, to be replaced at the start of a link.
@@ -5490,7 +5557,7 @@ The following commands are available:
      org-display-table 4
      (vconcat (mapcar
 	       (lambda (c) (make-glyph-code c (and (not (stringp org-ellipsis))
-					      org-ellipsis)))
+						   org-ellipsis)))
 	       (if (stringp org-ellipsis) org-ellipsis "..."))))
     (setq buffer-display-table org-display-table))
   (org-set-regexps-and-options)
@@ -5658,9 +5725,6 @@ the rounding returns a past time."
 (require 'font-lock)
 
 (defconst org-non-link-chars "]\t\n\r<>")
-(defvar org-link-types '("http" "https" "ftp" "mailto" "file" "file+emacs"
-			 "file+sys" "news" "shell" "elisp" "doi" "message"
-			 "help"))
 (defvar org-link-types-re nil
   "Matches a link that has a url-like prefix like \"http:\"")
 (defvar org-link-re-with-space nil
@@ -5727,8 +5791,8 @@ stacked delimiters is N.  Escaping delimiters is not possible."
 
 (defun org-make-link-regexps ()
   "Update the link regular expressions.
-This should be called after the variable `org-link-types' has changed."
-  (let ((types-re (regexp-opt org-link-types t)))
+This should be called after the variable `org-link-parameters' has changed."
+  (let ((types-re (regexp-opt (org-link-types) t)))
     (setq org-link-types-re
 	  (concat "\\`" types-re ":")
 	  org-link-re-with-space
@@ -5766,7 +5830,7 @@ This should be called after the variable `org-link-types' has changed."
 	  org-bracket-link-analytic-regexp++
 	  (concat
 	   "\\[\\["
-	   "\\(" (regexp-opt (cons "coderef" org-link-types) t) ":\\)?"
+	   "\\(" (regexp-opt (cons "coderef" (org-link-types)) t) ":\\)?"
 	   "\\([^]]+\\)"
 	   "\\]"
 	   "\\(\\[" "\\([^]]+\\)" "\\]\\)?"
@@ -7393,7 +7457,7 @@ a block.  Return a non-nil value when toggling is successful."
 ;; Remove overlays when changing major mode
 (add-hook 'org-mode-hook
 	  (lambda () (add-hook 'change-major-mode-hook
-			  'org-show-block-all 'append 'local)))
+			       'org-show-block-all 'append 'local)))
 
 ;;; Org-goto
 
@@ -9666,60 +9730,32 @@ The refresh happens only for the current tree (not subtree)."
 (defvar org-store-link-plist nil
   "Plist with info about the most recently link created with `org-store-link'.")
 
-(defvar org-link-protocols nil
-  "Link protocols added to Org-mode using `org-add-link-type'.")
+(defun org-store-link-functions ()
+  "Returns a list of functions that are called to create and store a link.
+The functions defined in the :store property of
+`org-link-parameters'.
 
-(defvar org-store-link-functions nil
-  "List of functions that are called to create and store a link.
 Each function will be called in turn until one returns a non-nil
-value.  Each function should check if it is responsible for creating
-this link (for example by looking at the major mode).
-If not, it must exit and return nil.
-If yes, it should return a non-nil value after a calling
-`org-store-link-props' with a list of properties and values.
-Special properties are:
+value.  Each function should check if it is responsible for
+creating this link (for example by looking at the major mode).  If
+not, it must exit and return nil.  If yes, it should return a
+non-nil value after a calling `org-store-link-props' with a list
+of properties and values. Special properties are:
 
 :type         The link prefix, like \"http\".  This must be given.
 :link         The link, like \"http://www.astro.uva.nl/~dominik\".
               This is obligatory as well.
 :description  Optional default description for the second pair
               of brackets in an Org-mode link.  The user can still change
-              this when inserting this link into an Org-mode buffer.
+              this when inserting this link into an Org mode buffer.
 
 In addition to these, any additional properties can be specified
-and then used in capture templates.")
-
-(defun org-add-link-type (type &optional follow export)
-  "Add TYPE to the list of `org-link-types'.
-Re-compute all regular expressions depending on `org-link-types'
-
-FOLLOW and EXPORT are two functions.
-
-FOLLOW should take the link path as the single argument and do whatever
-is necessary to follow the link, for example find a file or display
-a mail message.
-
-EXPORT should format the link path for export to one of the export formats.
-It should be a function accepting three arguments:
-
-  path    the path of the link, the text after the prefix (like \"http:\")
-  desc    the description of the link, if any
-  format  the export format, a symbol like `html' or `latex' or `ascii'.
-
-The function may use the FORMAT information to return different values
-depending on the format.  The return value will be put literally into
-the exported file.  If the return value is nil, this means Org should
-do what it normally does with links which do not have EXPORT defined.
-
-Org mode has a built-in default for exporting links.  If you are happy with
-this default, there is no need to define an export function for the link
-type.  For a simple example of an export function, see `org-bbdb.el'."
-  (add-to-list 'org-link-types type t)
-  (org-make-link-regexps)
-  (org-element-update-syntax)
-  (if (assoc type org-link-protocols)
-      (setcdr (assoc type org-link-protocols) (list follow export))
-    (push (list type follow export) org-link-protocols)))
+and then used in capture templates."
+  (cl-loop for link in org-link-parameters
+	   with store-func
+	   do (setq store-func (org-link-get-parameter (car link) :store))
+	   if store-func
+	   collect store-func))
 
 (defvar org-agenda-buffer-name) ; Defined in org-agenda.el
 (defvar org-id-link-to-org-use-id) ; Defined in org-id.el
@@ -9764,7 +9800,7 @@ active region."
 		    (delq
 		     nil (mapcar (lambda (f)
 				   (let (fs) (if (funcall f) (push f fs))))
-				 org-store-link-functions))
+				 (org-store-link-functions)))
 		    sfunsn (mapcar (lambda (fu) (symbol-name (car fu))) sfuns))
 	      (or (and (cdr sfuns)
 		       (funcall (intern
@@ -10325,7 +10361,7 @@ Use TAB to complete link prefixes, then RET for type-specific completion support
 	(and (window-live-p cw) (select-window cw)))
       (setq all-prefixes (append (mapcar 'car abbrevs)
 				 (mapcar 'car org-link-abbrev-alist)
-				 org-link-types))
+				 (org-link-types)))
       (unwind-protect
 	  ;; Fake a link history, containing the stored links.
 	  (let ((org--links-history
@@ -10601,6 +10637,29 @@ they must return nil.")
 
 (defvar org-link-search-inhibit-query nil) ;; dynamically scoped
 (defvar clean-buffer-list-kill-buffer-names) ; Defined in midnight.el
+(defun org--open-file-link (path app)
+  "Open PATH using APP.
+
+PATH is from a file link, and can have the following syntax:
+     [[file:~/code/main.c::255]]
+     [[file:~/xx.org::My Target]]
+     [[file:~/xx.org::*My Target]]
+     [[file:~/xx.org::#my-custom-id]]
+     [[file:~/xx.org::/regexp/]]
+
+APP is '(4) to open the PATH in Emacs, or 'system to use a system application."
+  (let* ((fields (split-string path "::"))	   
+	 (option (and (cdr fields)
+		      (mapconcat #'identity (cdr fields) ""))))
+    (apply #'org-open-file
+	   (car fields)
+	   app
+	   (cond ((not option) nil)
+		 ((string-match-p "\\`[0-9]+\\'" option)
+		  (list (string-to-number option)))
+		 (t (list nil
+			  (org-link-unescape option)))))))
+
 (defun org-open-at-point (&optional arg reference-buffer)
   "Open link, timestamp, footnote or tags at point.
 
diff --git a/lisp/ox.el b/lisp/ox.el
index da985f3..3986ec3 100644
--- a/lisp/ox.el
+++ b/lisp/ox.el
@@ -4073,7 +4073,7 @@ meant to be translated with `org-export-data' or alike."
 ;;;; For Links
 ;;
 ;; `org-export-custom-protocol-maybe' handles custom protocol defined
-;; with `org-add-link-type', which see.
+;; in `org-link-parameters'.
 ;;
 ;; `org-export-get-coderef-format' returns an appropriate format
 ;; string for coderefs.
diff --git a/testing/lisp/test-ox.el b/testing/lisp/test-ox.el
index 8b07cca..09d2e2a 100644
--- a/testing/lisp/test-ox.el
+++ b/testing/lisp/test-ox.el
@@ -2571,8 +2571,8 @@ Para2"
   (should
    (string-match
     "success"
-    (let ((org-link-types (copy-sequence org-link-types)))
-      (org-add-link-type "foo" nil (lambda (p d f) "success"))
+    (progn
+      (org-link-set-parameters "foo" :export (lambda (p d f) "success"))
       (org-export-string-as
        "[[foo:path]]"
        (org-export-create-backend
@@ -2586,9 +2586,9 @@ Para2"
   (should-not
    (string-match
     "success"
-    (let ((org-link-types (copy-sequence org-link-types)))
-      (org-add-link-type
-       "foo" nil (lambda (p d f) (and (eq f 'test) "success")))
+    (progn
+      (org-link-set-parameters
+       "foo" :export (lambda (p d f) (and (eq f 'test) "success")))
       (org-export-string-as
        "[[foo:path]]"
        (org-export-create-backend
@@ -2603,9 +2603,9 @@ Para2"
   (should-not
    (string-match
     "success"
-    (let ((org-link-types (copy-sequence org-link-types)))
-      (org-add-link-type
-       "foo" nil (lambda (p d f) (and (eq f 'test) "success")))
+    (progn
+      (org-link-set-parameters
+       "foo" :export (lambda (p d f) (and (eq f 'test) "success")))
       (org-export-string-as
        "[[foo:path]]"
        (org-export-create-backend
-- 
2.9.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0002-Remove-org-link-protocols-variable.patch --]
[-- Type: text/x-patch, Size: 3896 bytes --]

From 8225a3b630de05bb507dea2b85b10af5a8776afc Mon Sep 17 00:00:00 2001
From: John Kitchin <jkitchin@andrew.cmu.edu>
Date: Thu, 7 Jul 2016 10:02:29 -0400
Subject: [PATCH 02/20] Remove `org-link-protocols' variable

* lisp/org.el (org-link-protocols): Remove variable org-link-protocols.
The data in this variable is now retrieved with org-link-get-parameter.

* lisp/org.el: Enable file links to use the application link property to
  determine the follow action. Also add a space after let*.
---
 lisp/org.el | 18 +++++++++---------
 lisp/ox.el  |  2 +-
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index 5b92e12..13f794a 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -10755,10 +10755,10 @@ link in a property drawer line."
 	  ;; When link is located within the description of another
 	  ;; link (e.g., an inline image), always open the parent
 	  ;; link.
-	  (let*((link (let ((up (org-element-property :parent context)))
-			(if (eq (org-element-type up) 'link) up context)))
-		(type (org-element-property :type link))
-		(path (org-link-unescape (org-element-property :path link))))
+	  (let* ((link (let ((up (org-element-property :parent context)))
+			 (if (eq (org-element-type up) 'link) up context)))
+		 (type (org-element-property :type link))
+		 (path (org-link-unescape (org-element-property :path link))))
 	    ;; Switch back to REFERENCE-BUFFER needed when called in
 	    ;; a temporary buffer through `org-open-link-from-string'.
 	    (with-current-buffer (or reference-buffer (current-buffer))
@@ -10766,7 +10766,7 @@ link in a property drawer line."
 	       ((equal type "file")
 		(if (string-match "[*?{]" (file-name-nondirectory path))
 		    (dired path)
-		  ;; Look into `org-link-protocols' in order to find
+		  ;; Look into `org-link-parameters' in order to find
 		  ;; a DEDICATED-FUNCTION to open file.  The function
 		  ;; will be applied on raw link instead of parsed
 		  ;; link due to the limitation in `org-add-link-type'
@@ -10780,7 +10780,7 @@ link in a property drawer line."
 		  (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 (if app (concat type "+" app) type) :follow)))
 		    (if dedicated-function
 			(funcall dedicated-function
 				 (concat path
@@ -10795,8 +10795,8 @@ link in a property drawer line."
 				    (list (string-to-number option)))
 				   (t (list nil
 					    (org-link-unescape option)))))))))
-	       ((assoc type org-link-protocols)
-		(funcall (nth 1 (assoc type org-link-protocols)) path))
+	       ((functionp (org-link-get-parameter type :follow))
+		(funcall (org-link-get-parameter type :follow) path))
 	       ((equal type "help")
 		(let ((f-or-v (intern path)))
 		  (cond ((fboundp f-or-v) (describe-function f-or-v))
@@ -10845,7 +10845,7 @@ link in a property drawer line."
 		    (user-error "Abort"))))
 	       ((equal type "id")
 		(require 'org-id)
-		(funcall (nth 1 (assoc "id" org-link-protocols)) path))
+		(funcall (org-link-get-parameter type :follow) path))
 	       ((member type '("coderef" "custom-id" "fuzzy" "radio"))
 		(unless (run-hook-with-args-until-success
 			 'org-open-link-functions path)
diff --git a/lisp/ox.el b/lisp/ox.el
index 3986ec3..8472e9d 100644
--- a/lisp/ox.el
+++ b/lisp/ox.el
@@ -4116,7 +4116,7 @@ The function ignores links with an implicit type (e.g.,
   (let ((type (org-element-property :type link)))
     (unless (or (member type '("coderef" "custom-id" "fuzzy" "radio"))
 		(not backend))
-      (let ((protocol (nth 2 (assoc type org-link-protocols))))
+      (let ((protocol (org-link-get-parameter type :export)))
 	(and (functionp protocol)
 	     (funcall protocol
 		      (org-link-unescape (org-element-property :path link))
-- 
2.9.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: 0003-Get-the-complete-function-from-org-link-parameters.patch --]
[-- Type: text/x-patch, Size: 1134 bytes --]

From 5f2f09643d1c79ce83c2b990700227f90c262bfe Mon Sep 17 00:00:00 2001
From: John Kitchin <jkitchin@andrew.cmu.edu>
Date: Tue, 5 Jul 2016 10:20:23 -0400
Subject: [PATCH 03/20] Get the complete function from `org-link-parameters'

* lisp/org.el (org-link-try-special-completion):
Get the follow function from `org-link-parameters'

Only follow when a function is defined.

* lisp/org.el (org-open-at-point): Some links don't have a :follow
  function, so we should not call nil in that case.
---
 lisp/org.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/org.el b/lisp/org.el
index 13f794a..5448bdb 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -10465,7 +10465,7 @@ Use TAB to complete link prefixes, then RET for type-specific completion support
 
 (defun org-link-try-special-completion (type)
   "If there is completion support for link type TYPE, offer it."
-  (let ((fun (intern (concat "org-" type "-complete-link"))))
+  (let ((fun (org-link-get-parameter type :complete)))
     (if (functionp fun)
 	(funcall fun)
       (read-string "Link (no completion support): " (concat type ":")))))
-- 
2.9.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #5: 0004-Update-org-activate-plain-links.patch --]
[-- Type: text/x-patch, Size: 2872 bytes --]

From f4dcf689de2c0091597fd07d2b88c194e12eb873 Mon Sep 17 00:00:00 2001
From: John Kitchin <jkitchin@andrew.cmu.edu>
Date: Tue, 5 Jul 2016 10:21:08 -0400
Subject: [PATCH 04/20] Update `org-activate-plain-links'

* lisp/org.el (org-activate-plain-links): Use `org-link-parameters' to
  create the link properties.
---
 lisp/org.el | 54 +++++++++++++++++++++++++++++++++++++++++++++++-------
 1 file changed, 47 insertions(+), 7 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index 5448bdb..886c288 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -5928,17 +5928,57 @@ prompted for."
   "Add link properties for plain links."
   (when (and (re-search-forward org-plain-link-re limit t)
 	     (not (org-in-src-block-p)))
-    (let ((face (get-text-property (max (1- (match-beginning 0)) (point-min))
-				   'face))
-	  (link (match-string-no-properties 0)))
+
+    (let* ((face (get-text-property (max (1- (match-beginning 0)) (point-min))
+				    'face))
+	   (link (match-string-no-properties 0))
+	   (type (match-string-no-properties 1))
+	   (path (match-string-no-properties 2))
+	   (link-start (match-beginning 0))
+	   (link-end (match-end 0))
+	   (link-face (org-link-get-parameter type :face))
+	   (help-echo (org-link-get-parameter type :help-echo))	   
+	   (htmlize-link (org-link-get-parameter type :htmlize-link))
+	   (activate-func (org-link-get-parameter type :activate-func)))
       (unless (if (consp face) (memq 'org-tag face) (eq 'org-tag face))
 	(org-remove-flyspell-overlays-in (match-beginning 0) (match-end 0))
 	(add-text-properties (match-beginning 0) (match-end 0)
-			     (list 'mouse-face 'highlight
-				   'face 'org-link
-				   'htmlize-link `(:uri ,link)
-				   'keymap org-mouse-map))
+			     (list
+			      'mouse-face (or (org-link-get-parameter type :mouse-face)
+					      'highlight)
+			      'face (cond
+				     ;; A function that returns a face
+				     ((functionp link-face)
+				      (funcall link-face path))
+				     ;; a face
+				     ((facep link-face)
+				      link-face)
+				     ;; An anonymous face
+				     ((consp link-face)
+				      link-face)
+				     ;; default
+				     (t
+				      'org-link))
+			      'help-echo (cond
+					  ((stringp help-echo)
+					   help-echo)
+					  ((functionp help-echo)
+					   help-echo)
+					  (t
+					   (concat "LINK: "
+						   (save-match-data
+						     (org-link-unescape link)))))
+			      'htmlize-link (cond
+					     ((functionp htmlize-link)
+					      (funcall htmlize-link path))
+					     (t
+					      `(:uri ,link)))
+			      'keymap (or (org-link-get-parameter type :keymap)
+					  org-mouse-map)
+			      'org-link-start (match-beginning 0)))
 	(org-rear-nonsticky-at (match-end 0))
+	(when activate-func
+	  (funcall activate-func link-start link-end path nil))
 	t))))
 
 (defun org-activate-code (limit)
-- 
2.9.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #6: 0005-Update-org-activate-bracket-links.patch --]
[-- Type: text/x-patch, Size: 3436 bytes --]

From 0aaa52eefc8022b8b62fe9ab7134b8f9c38b3737 Mon Sep 17 00:00:00 2001
From: John Kitchin <jkitchin@andrew.cmu.edu>
Date: Tue, 5 Jul 2016 10:21:50 -0400
Subject: [PATCH 05/20] Update `org-activate-bracket-links'

* lisp/org.el (org-activate-bracket-links): Use `org-link-parameters' to
  build link properties.
---
 lisp/org.el | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-------
 1 file changed, 63 insertions(+), 8 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index 886c288..a7aa4ee 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -6168,14 +6168,67 @@ by a #."
   (when (and (re-search-forward org-bracket-link-regexp limit t)
 	     (not (org-in-src-block-p)))
     (let* ((hl (match-string-no-properties 1))
-	   (help (concat "LINK: " (save-match-data (org-link-unescape hl))))
-	   (ip (list 'invisible 'org-link
-		     'keymap org-mouse-map 'mouse-face 'highlight
-		     'font-lock-multiline t 'help-echo help
-		     'htmlize-link `(:uri ,hl)))
-	   (vp (list 'keymap org-mouse-map 'mouse-face 'highlight
-		     'font-lock-multiline t 'help-echo help
-		     'htmlize-link `(:uri ,hl))))
+	   (type (save-match-data
+		   (and (string-match org-plain-link-re hl)
+			(match-string-no-properties 1 hl))))
+	   (path (save-match-data
+		   (and (string-match org-plain-link-re hl)
+			(match-string-no-properties 2 hl))))
+	   (link-start (match-beginning 0))
+	   (link-end (match-end 0))
+	   (bracketp t)
+	   (help-echo (org-link-get-parameter type :help-echo))
+	   (help (cond
+		  ((stringp help-echo)
+		   help-echo)
+		  ((functionp help-echo)
+		   help-echo)
+		  (t
+		   (concat "LINK: "
+			   (save-match-data
+			     (org-link-unescape hl))))))
+	   (link-face (org-link-get-parameter type :face))
+	   (face (cond
+		  ;; A function that returns a face
+		  ((functionp link-face)
+		   (funcall link-face path))
+		  ;; a face
+		  ((facep link-face)
+		   link-face)
+		  ;; An anonymous face
+		  ((consp link-face)
+		   link-face)
+		  ;; default
+		  (t
+		   'org-link)))
+	   (keymap (or (org-link-get-parameter type :keymap)
+		       org-mouse-map))
+	   (mouse-face (or (org-link-get-parameter type :mouse-face)
+			   'highlight))
+	   (htmlize (org-link-get-parameter type :htmlize-link))
+	   (htmlize-link (cond
+			  ((functionp htmlize)
+			   (funcall htmlize))
+			  (t
+			   `(:uri ,(format "%s:%s" type path)))))
+	   (activate-func (org-link-get-parameter type :activate-func))
+	   ;; invisible part
+	   (ip (list 'invisible (or
+				 (org-link-get-parameter type :display)
+				 'org-link)
+		     'face face
+		     'keymap keymap
+		     'mouse-face mouse-face
+		     'font-lock-multiline t
+		     'help-echo help
+		     'htmlize-link htmlize-link))
+	   ;; visible part
+	   (vp (list 'keymap keymap
+		     'face face
+		     'mouse-face mouse-face
+		     'font-lock-multiline t
+		     'help-echo help
+		     'htmlize-link htmlize-link)))
       ;; We need to remove the invisible property here.  Table narrowing
       ;; may have made some of this invisible.
       (org-remove-flyspell-overlays-in (match-beginning 0) (match-end 0))
@@ -6195,6 +6248,8 @@ by a #."
 	(org-rear-nonsticky-at (match-end 1))
 	(add-text-properties (match-end 1) (match-end 0) ip)
 	(org-rear-nonsticky-at (match-end 0)))
+      (when activate-func
+	(funcall activate-func link-start link-end path bracketp))
       t)))
 
 (defun org-activate-dates (limit)
-- 
2.9.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #7: 0006-Make-plain-and-bracketed-link-properties-stick.patch --]
[-- Type: text/x-patch, Size: 1301 bytes --]

From 8be88f99413786a38f358b0901a2a1ffaa9651f7 Mon Sep 17 00:00:00 2001
From: John Kitchin <jkitchin@andrew.cmu.edu>
Date: Tue, 5 Jul 2016 10:22:24 -0400
Subject: [PATCH 06/20] Make plain and bracketed link properties stick

* lisp/org.el (org-set-font-lock-defaults): If t is after the face, than
  org-link clobbers everything from the activation functions.
---
 lisp/org.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index a7aa4ee..3843dab 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -6521,8 +6521,8 @@ needs to be inserted at a specific position in the font-lock sequence.")
 	   ;; Links
 	   (when (memq 'tag lk) '(org-activate-tags (1 'org-tag prepend)))
 	   (when (memq 'angle lk) '(org-activate-angle-links (0 'org-link t)))
-	   (when (memq 'plain lk) '(org-activate-plain-links (0 'org-link t)))
-	   (when (memq 'bracket lk) '(org-activate-bracket-links (0 'org-link t)))
+	   (when (memq 'plain lk) '(org-activate-plain-links (0 'org-link)))
+	   (when (memq 'bracket lk) '(org-activate-bracket-links (0 'org-link)))
 	   (when (memq 'radio lk) '(org-activate-target-links (1 'org-link t)))
 	   (when (memq 'date lk) '(org-activate-dates (0 'org-date t)))
 	   (when (memq 'footnote lk) '(org-activate-footnote-links))
-- 
2.9.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #8: 0007-Update-bbdb-link-definition.patch --]
[-- Type: text/x-patch, Size: 963 bytes --]

From d2142696b4da3a262dc550c0cbadbcec324023fb Mon Sep 17 00:00:00 2001
From: John Kitchin <jkitchin@andrew.cmu.edu>
Date: Tue, 5 Jul 2016 10:25:39 -0400
Subject: [PATCH 07/20] Update bbdb link definition

* lisp/org-bbdb.el ("bbdb"):

Change link definition to org-link-set-parameters
---
 lisp/org-bbdb.el | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/lisp/org-bbdb.el b/lisp/org-bbdb.el
index 8d886cd..5f3971b 100644
--- a/lisp/org-bbdb.el
+++ b/lisp/org-bbdb.el
@@ -194,10 +194,12 @@ date year)."
   :group 'org-bbdb-anniversaries
   :require 'bbdb)
 
-
 ;; Install the link type
-(org-add-link-type "bbdb" 'org-bbdb-open 'org-bbdb-export)
-(add-hook 'org-store-link-functions 'org-bbdb-store-link)
+(org-link-set-parameters "bbdb"
+			 :follow #'org-bbdb-open
+			 :export #'org-bbdb-export
+			 :complete #'org-bbdb-complete-link
+			 :store #'org-bbdb-store-link)
 
 ;; Implementation
 (defun org-bbdb-store-link ()
-- 
2.9.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #9: 0008-Update-bibtex-link-definition.patch --]
[-- Type: text/x-patch, Size: 929 bytes --]

From f1be7da9a58afc8ee8109738758eefa67e3c724e Mon Sep 17 00:00:00 2001
From: John Kitchin <jkitchin@andrew.cmu.edu>
Date: Tue, 5 Jul 2016 10:26:04 -0400
Subject: [PATCH 08/20] Update bibtex link definition

* lisp/org-bibtex.el ("bibtex"):

Change link definition to use org-link-set-parameters
---
 lisp/org-bibtex.el | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lisp/org-bibtex.el b/lisp/org-bibtex.el
index 74e32f7..e740353 100644
--- a/lisp/org-bibtex.el
+++ b/lisp/org-bibtex.el
@@ -452,8 +452,9 @@ With optional argument OPTIONAL, also prompt for optional fields."
 
 \f
 ;;; Bibtex link functions
-(org-add-link-type "bibtex" 'org-bibtex-open)
-(add-hook 'org-store-link-functions 'org-bibtex-store-link)
+(org-link-set-parameters "bibtex"
+			 :follow #'org-bibtex-open
+			 :store #'org-bibtex-store-link)
 
 (defun org-bibtex-open (path)
   "Visit the bibliography entry on PATH."
-- 
2.9.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #10: 0009-Update-docview-link-definition.patch --]
[-- Type: text/x-patch, Size: 1059 bytes --]

From db83d9940464171936bc2f04cf5827fc33003990 Mon Sep 17 00:00:00 2001
From: John Kitchin <jkitchin@andrew.cmu.edu>
Date: Tue, 5 Jul 2016 10:26:28 -0400
Subject: [PATCH 09/20] Update docview link definition

* lisp/org-docview.el ("docview"):

Update link definition with org-link-set-parameters.
---
 lisp/org-docview.el | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lisp/org-docview.el b/lisp/org-docview.el
index fbc5551..3d4df40 100644
--- a/lisp/org-docview.el
+++ b/lisp/org-docview.el
@@ -49,8 +49,10 @@
 (declare-function doc-view-goto-page "doc-view" (page))
 (declare-function image-mode-window-get "image-mode" (prop &optional winprops))
 
-(org-add-link-type "docview" 'org-docview-open 'org-docview-export)
-(add-hook 'org-store-link-functions 'org-docview-store-link)
+(org-link-set-parameters "docview"
+			 :follow #'org-docview-open
+			 :export #'org-docview-export
+			 :store #'org-docview-store-link)
 
 (defun org-docview-export (link description format)
   "Export a docview link from Org files."
-- 
2.9.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #11: 0010-Update-eshell-link-definition.patch --]
[-- Type: text/x-patch, Size: 871 bytes --]

From 199678c0007461b7a57cc4e6b251792d1cae9663 Mon Sep 17 00:00:00 2001
From: John Kitchin <jkitchin@andrew.cmu.edu>
Date: Tue, 5 Jul 2016 10:27:03 -0400
Subject: [PATCH 10/20] Update eshell link definition

* lisp/org-eshell.el ("eshell"):

Update to use org-link-set-parameters.
---
 lisp/org-eshell.el | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lisp/org-eshell.el b/lisp/org-eshell.el
index 1919f6d..6f9a18a 100644
--- a/lisp/org-eshell.el
+++ b/lisp/org-eshell.el
@@ -27,8 +27,9 @@
 (require 'eshell)
 (require 'esh-mode)
 
-(org-add-link-type "eshell" 'org-eshell-open)
-(add-hook 'org-store-link-functions 'org-eshell-store-link)
+(org-link-set-parameters "eshell"
+			 :follow #'org-eshell-open
+			 :store #'org-eshell-store-link)
 
 (defun org-eshell-open (link)
   "Switch to am eshell buffer and execute a command line.
-- 
2.9.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #12: 0011-Update-gnus-link-definition.patch --]
[-- Type: text/x-patch, Size: 800 bytes --]

From 25a9106eb4d29f9996a599ff9fdee980ef9ef785 Mon Sep 17 00:00:00 2001
From: John Kitchin <jkitchin@andrew.cmu.edu>
Date: Tue, 5 Jul 2016 10:27:14 -0400
Subject: [PATCH 11/20] Update gnus link definition

* lisp/org-gnus.el ("gnus"):
Update link definition with org-link-set-parameters.
---
 lisp/org-gnus.el | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/lisp/org-gnus.el b/lisp/org-gnus.el
index 386d6dc..13e28cc 100644
--- a/lisp/org-gnus.el
+++ b/lisp/org-gnus.el
@@ -74,8 +74,7 @@ this variable to t."
   :type 'boolean)
 
 ;; Install the link type
-(org-add-link-type "gnus" 'org-gnus-open)
-(add-hook 'org-store-link-functions 'org-gnus-store-link)
+(org-link-set-parameters "gnus" :follow #'org-gnus-open :store #'org-gnus-store-link)
 
 ;; Implementation
 
-- 
2.9.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #13: 0012-Update-info-link-definition.patch --]
[-- Type: text/x-patch, Size: 1345 bytes --]

From b285b6d04d85f13e6d7612e7c39635e99178d1cb Mon Sep 17 00:00:00 2001
From: John Kitchin <jkitchin@andrew.cmu.edu>
Date: Tue, 5 Jul 2016 10:27:32 -0400
Subject: [PATCH 12/20] Update info link definition

* lisp/org-info.el ("info"):
Update link definition with org-link-set-parameters and change a doc string to
point to org-link-parameters.
---
 lisp/org-info.el | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/lisp/org-info.el b/lisp/org-info.el
index 9e8fde0..8765c53 100644
--- a/lisp/org-info.el
+++ b/lisp/org-info.el
@@ -40,8 +40,10 @@
 (defvar Info-current-node)
 
 ;; Install the link type
-(org-add-link-type "info" 'org-info-open 'org-info-export)
-(add-hook 'org-store-link-functions 'org-info-store-link)
+(org-link-set-parameters "info"
+			 :follow #'org-info-open
+			 :export #'org-info-export
+			 :store #'org-info-store-link)
 
 ;; Implementation
 (defun org-info-store-link ()
@@ -113,7 +115,7 @@ emacs related documents. See `org-info-official-gnu-document' and
 
 (defun org-info-export (path desc format)
   "Export an info link.
-See `org-add-link-type' for details about PATH, DESC and FORMAT."
+See `org-link-parameters' for details about PATH, DESC and FORMAT."
   (when (eq format 'html)
     (or (string-match "\\(.*\\)[#:]:?\\(.*\\)" path)
 	(string-match "\\(.*\\)" path))
-- 
2.9.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #14: 0013-Update-irc-link-definition.patch --]
[-- Type: text/x-patch, Size: 873 bytes --]

From 5148d0b901aed5a773dbacf0e5149fd56578787c Mon Sep 17 00:00:00 2001
From: John Kitchin <jkitchin@andrew.cmu.edu>
Date: Tue, 5 Jul 2016 10:27:45 -0400
Subject: [PATCH 13/20] Update irc link definition

* lisp/org-irc.el ("irc"):
Define link with org-link-set-parameters.
---
 lisp/org-irc.el | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/lisp/org-irc.el b/lisp/org-irc.el
index 81d0296..5b9c839 100644
--- a/lisp/org-irc.el
+++ b/lisp/org-irc.el
@@ -71,9 +71,7 @@
 
 ;; Generic functions/config (extend these for other clients)
 
-(add-to-list 'org-store-link-functions 'org-irc-store-link)
-
-(org-add-link-type "irc" 'org-irc-visit nil)
+(org-link-set-parameters "irc" :follow #'org-irc-visit :store #'org-irc-store-link)
 
 (defun org-irc-visit (link)
   "Parse LINK and dispatch to the correct function based on the client found."
-- 
2.9.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #15: 0014-Update-mhe-link-definition.patch --]
[-- Type: text/x-patch, Size: 819 bytes --]

From 9556cf43dc421abce0d51632c08fcc2abfc90ab2 Mon Sep 17 00:00:00 2001
From: John Kitchin <jkitchin@andrew.cmu.edu>
Date: Tue, 5 Jul 2016 10:27:55 -0400
Subject: [PATCH 14/20] Update mhe link definition.

* lisp/org-mhe.el ("mhe"):
Define link with org-link-set-parameters.
---
 lisp/org-mhe.el | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/lisp/org-mhe.el b/lisp/org-mhe.el
index 2ee21de..c793eed 100644
--- a/lisp/org-mhe.el
+++ b/lisp/org-mhe.el
@@ -74,8 +74,7 @@ supported by MH-E."
 (defvar mh-search-regexp-builder)
 
 ;; Install the link type
-(org-add-link-type "mhe" 'org-mhe-open)
-(add-hook 'org-store-link-functions 'org-mhe-store-link)
+(org-link-set-parameters "mhe" :follow #'org-mhe-open :store #'org-mhe-store-link)
 
 ;; Implementation
 (defun org-mhe-store-link ()
-- 
2.9.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #16: 0015-Update-rmail-link-definition.patch --]
[-- Type: text/x-patch, Size: 844 bytes --]

From 6ec1112fcef7f93292125b578a3ee8f88a250d2b Mon Sep 17 00:00:00 2001
From: John Kitchin <jkitchin@andrew.cmu.edu>
Date: Tue, 5 Jul 2016 10:28:09 -0400
Subject: [PATCH 15/20] Update rmail link definition

* lisp/org-rmail.el ("rmail"):
Use org-link-set-parameters to define link.
---
 lisp/org-rmail.el | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/lisp/org-rmail.el b/lisp/org-rmail.el
index 0bf44b8..35bf073 100644
--- a/lisp/org-rmail.el
+++ b/lisp/org-rmail.el
@@ -43,8 +43,7 @@
 (defvar rmail-file-name)        ; From rmail.el
 
 ;; Install the link type
-(org-add-link-type "rmail" 'org-rmail-open)
-(add-hook 'org-store-link-functions 'org-rmail-store-link)
+(org-link-set-parameters "rmail" :follow #'org-rmail-open :store #'org-rmail-store-link)
 
 ;; Implementation
 (defun org-rmail-store-link ()
-- 
2.9.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #17: 0016-Update-w3m-link-definition.patch --]
[-- Type: text/x-patch, Size: 771 bytes --]

From 484349af5e3c751672d3ac5fe29cab7638ab5f8f Mon Sep 17 00:00:00 2001
From: John Kitchin <jkitchin@andrew.cmu.edu>
Date: Tue, 5 Jul 2016 10:28:38 -0400
Subject: [PATCH 16/20] Update w3m link definition

* lisp/org-w3m.el ("w3m"):
Update to use org-link-set-parameters.
---
 lisp/org-w3m.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/org-w3m.el b/lisp/org-w3m.el
index 57ecafe..28bc492 100644
--- a/lisp/org-w3m.el
+++ b/lisp/org-w3m.el
@@ -46,7 +46,7 @@
 (defvar w3m-current-url)
 (defvar w3m-current-title)
 
-(add-hook 'org-store-link-functions 'org-w3m-store-link)
+(org-link-set-parameters "w3m" :store #'org-w3m-store-link)
 (defun org-w3m-store-link ()
   "Store a link to a w3m buffer."
   (when (eq major-mode 'w3m-mode)
-- 
2.9.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #18: 0017-Update-the-id-link-with-org-link-set-parameters.patch --]
[-- Type: text/x-patch, Size: 702 bytes --]

From c57fb8d7741362c3583844c6eb9ae8ed40732eb0 Mon Sep 17 00:00:00 2001
From: John Kitchin <jkitchin@andrew.cmu.edu>
Date: Tue, 5 Jul 2016 16:11:08 -0400
Subject: [PATCH 17/20] Update the "id" link with org-link-set-parameters

* lisp/org-id.el:
---
 lisp/org-id.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/org-id.el b/lisp/org-id.el
index 2646c80..5ad7f00 100644
--- a/lisp/org-id.el
+++ b/lisp/org-id.el
@@ -675,7 +675,7 @@ optional argument MARKERP, return the position as a new marker."
     (move-marker m nil)
     (org-show-context)))
 
-(org-add-link-type "id" 'org-id-open)
+(org-link-set-parameters "id" :follow #'org-id-open)
 
 (provide 'org-id)
 
-- 
2.9.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #19: 0018-Update-the-texinfo-for-link-parameters-documentation.patch --]
[-- Type: text/x-patch, Size: 3088 bytes --]

From 52a2fa192ec2f2ce5e5138b97cf695abf2aeffaf Mon Sep 17 00:00:00 2001
From: John Kitchin <jkitchin@andrew.cmu.edu>
Date: Tue, 5 Jul 2016 10:29:07 -0400
Subject: [PATCH 18/20] Update the texinfo for link parameters documentation

---
 doc/org.texi | 27 +++++++++++++++------------
 1 file changed, 15 insertions(+), 12 deletions(-)

diff --git a/doc/org.texi b/doc/org.texi
index e92788f..f962a58 100644
--- a/doc/org.texi
+++ b/doc/org.texi
@@ -3711,11 +3711,11 @@ them with @key{up} and @key{down} (or @kbd{M-p/n}).
 valid link prefixes like @samp{http:} or @samp{ftp:}, including the prefixes
 defined through link abbreviations (@pxref{Link abbreviations}).  If you
 press @key{RET} after inserting only the @var{prefix}, Org will offer
-specific completion support for some link types@footnote{This works by
-calling a special function @code{org-PREFIX-complete-link}.}  For
-example, if you type @kbd{file @key{RET}}, file name completion (alternative
-access: @kbd{C-u C-c C-l}, see below) will be offered, and after @kbd{bbdb
-@key{RET}} you can complete contact names.
+specific completion support for some link types@footnote{This works if a
+completion function is defined in the :complete property of a link in
+@var{org-link-parameters}.}  For example, if you type @kbd{file @key{RET}},
+file name completion (alternative access: @kbd{C-u C-c C-l}, see below) will
+be offered, and after @kbd{bbdb @key{RET}} you can complete contact names.
 @orgkey C-u C-c C-l
 @cindex file name completion
 @cindex completion, of file names
@@ -3887,10 +3887,13 @@ can define them in the file with
 
 @noindent
 In-buffer completion (@pxref{Completion}) can be used after @samp{[} to
-complete link abbreviations.  You may also define a function
-@code{org-PREFIX-complete-link} that implements special (e.g., completion)
-support for inserting such a link with @kbd{C-c C-l}.  Such a function should
-not accept any arguments, and return the full link with prefix.
+complete link abbreviations.  You may also define a function that implements
+special (e.g., completion) support for inserting such a link with @kbd{C-c
+C-l}.  Such a function should not accept any arguments, and return the full
+link with prefix.  You can add a completion function to a link like this:
+
+@code{(org-link-set-parameters ``type'' :complete #'some-function)}
+
 
 @node Search options
 @section Search options in file links
@@ -18005,9 +18008,9 @@ the link description when the link is later inserted into an Org
 buffer with @kbd{C-c C-l}.
 
 When it makes sense for your new link type, you may also define a function
-@code{org-PREFIX-complete-link} that implements special (e.g., completion)
-support for inserting such a link with @kbd{C-c C-l}.  Such a function should
-not accept any arguments, and return the full link with prefix.
+that implements special (e.g., completion) support for inserting such a link
+with @kbd{C-c C-l}.  Such a function should not accept any arguments, and
+return the full link with prefix.
 
 @node Adding export back-ends
 @section Adding export back-ends
-- 
2.9.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #20: 0019-Update-NEWS-with-link-announcement.patch --]
[-- Type: text/x-patch, Size: 912 bytes --]

From b60f795819c1294be2315c9208f4ac64d89088e4 Mon Sep 17 00:00:00 2001
From: John Kitchin <jkitchin@andrew.cmu.edu>
Date: Tue, 5 Jul 2016 10:31:30 -0400
Subject: [PATCH 19/20] Update NEWS with link announcement

---
 etc/ORG-NEWS | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 9909910..6ff7442 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -353,6 +353,8 @@ first footnote.
 *** The ~org-block~ face is inherited by ~src-blocks~
 This works also when =org-src-fontify-natively= is non-nil.  It is also
 possible to specify per-languages faces.  See the manual for details.
+*** Links are now customizable
+Links can now have custom colors, tooltips, keymaps, display behavior, etc... Links are now centralized in ~org-link-parameters~.
 ** New functions
 *** ~org-next-line-empty-p~
 It replaces the deprecated ~next~ argument to ~org-previous-line-empty-p~.
-- 
2.9.0


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #21: 0020-Update-the-contrib-manual.patch --]
[-- Type: text/x-patch, Size: 2681 bytes --]

From ea975f48749776e1d7b3a84d1ed3598c059bf9a6 Mon Sep 17 00:00:00 2001
From: John Kitchin <jkitchin@andrew.cmu.edu>
Date: Tue, 5 Jul 2016 10:38:42 -0400
Subject: [PATCH 20/20] Update the contrib manual

---
 contrib/orgmanual.org | 27 +++++++++++++++------------
 1 file changed, 15 insertions(+), 12 deletions(-)

diff --git a/contrib/orgmanual.org b/contrib/orgmanual.org
index e48ae97..07d9e8d 100644
--- a/contrib/orgmanual.org
+++ b/contrib/orgmanual.org
@@ -3300,12 +3300,16 @@ can define them in the file with
   ,#+LINK: google    http://www.google.com/search?q=%s
 #+end_src
 
-{{{noindent}}} In-buffer completion (see [[Completion]]) can be used after
-{{{samp([)}}} to complete link abbreviations.  You may also define a
-function ~org-PREFIX-complete-link~ that implements special (e.g.,
-completion) support for inserting such a link with {{{kbd(C-c C-l)}}}.
-Such a function should not accept any arguments, and return the full
-link with prefix.
+{{{noindent}}} In-buffer completion (see [[Completion]]) can be used
+after {{{samp([)}}} to complete link abbreviations.  You may also
+define a function that implements special (e.g., completion) support
+for inserting such a link with {{{kbd(C-c C-l)}}}.  Such a function
+should not accept any arguments, and return the full link with
+prefix.  You can set the link completion function like this:
+
+#+BEGIN_SRC emacs-lisp
+(org-link-set-parameter "type" :complete #'some-completion-function)
+#+END_SRC
 
 ** Search options
    :PROPERTIES:
@@ -16998,10 +17002,9 @@ description when the link is later inserted into an Org buffer with
 {{{kbd(C-c C-l)}}}.
 
 When it makes sense for your new link type, you may also define a
-function ~org-PREFIX-complete-link~ that implements special (e.g.,
-completion) support for inserting such a link with {{{kbd(C-c C-l)}}}.
-Such a function should not accept any arguments, and return the full
-link with prefix.
+function that implements special (e.g., completion) support for
+inserting such a link with {{{kbd(C-c C-l)}}}.  Such a function should
+not accept any arguments, and return the full link with prefix.
 
 ** Context-sensitive commands
    :PROPERTIES:
@@ -19181,8 +19184,8 @@ from the list of stored links.  To keep it in the list later use, use a
 triple {{{kbd(C-u)}}} prefix argument to {{{kbd(C-c C-l)}}}, or
 configure the option ~org-keep-stored-link-after-insertion~.
 
-[fn:37] This works by calling a special function
-~org-PREFIX-complete-link~.
+[fn:37] This works if a function has been defined in the :complete
+property of a link in ~org-link-parameters~.
 
 [fn:38] See the variable ~org-display-internal-link-with-indirect-buffer~.
 
-- 
2.9.0


[-- Attachment #22: Type: text/plain, Size: 192 bytes --]




-- 
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu

  reply	other threads:[~2016-07-18 15: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
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 [this message]
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

  List information: https://www.orgmode.org/

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

  git send-email \
    --in-reply-to=m2eg6rrn0h.fsf@andrew.cmu.edu \
    --to=jkitchin@andrew.cmu.edu \
    --cc=emacs-orgmode@gnu.org \
    --cc=mail@nicolasgoaziou.fr \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).