>From e056405efe7b98b7f6575b18daa8671194851763 Mon Sep 17 00:00:00 2001 From: John Kitchin 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 7b12404..4ed4503 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,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 @@ -10796,8 +10796,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 +10846,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