diff options
author | John Kitchin <jkitchin@andrew.cmu.edu> | 2016-07-07 10:02:29 -0400 |
---|---|---|
committer | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2016-07-18 22:47:48 +0200 |
commit | a5f5fedf3e183944ea5678a90f66c19c7372e514 (patch) | |
tree | ef722757289a59a97ed7fe292a3799354d7d1144 | |
parent | 9bc294003417a17c58b1c25156a885b5ac109309 (diff) | |
download | org-mode-a5f5fedf3e183944ea5678a90f66c19c7372e514.tar.gz |
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*.
-rw-r--r-- | lisp/org.el | 20 | ||||
-rw-r--r-- | lisp/ox.el | 2 |
2 files changed, 12 insertions, 10 deletions
diff --git a/lisp/org.el b/lisp/org.el index bd278c0..949899a 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -10756,10 +10756,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)) @@ -10767,7 +10767,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' @@ -10781,7 +10781,9 @@ 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 @@ -10796,8 +10798,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)) @@ -10846,7 +10848,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) @@ -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)) |