forked from mirrors/org-mode
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*.
This commit is contained in:
parent
9bc2940034
commit
a5f5fedf3e
20
lisp/org.el
20
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))
|
||||
|
|
Loading…
Reference in New Issue