From 041138e47c1664ae7aa3eefb3faea2ee3add28c3 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Fri, 28 Feb 2020 01:30:30 +0100 Subject: [PATCH] Remove `org-export-link-as-file' * lisp/ol.el (org-link-parameters): Remove reference to the function. * lisp/ox.el (org-export-link-as-file): Remove function. * testing/lisp/test-ox.el (test-org-export/link-as-file): Remove test. The current implementation is not satisfactory, and not useful in the code base. Using a pre-export hook turning custom link type into "file" is enough for now. See "attachement" links for an example. --- etc/ORG-NEWS | 8 ++++---- lisp/ol.el | 4 ---- lisp/org-attach.el | 1 - lisp/ox.el | 15 --------------- testing/lisp/test-ox.el | 26 -------------------------- 5 files changed, 4 insertions(+), 50 deletions(-) diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index 17f3e6a36..8f23dded2 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -186,11 +186,11 @@ When this startup option is set, display headings as numeroted. Use =#+startup: nonum= to turn this off. -*** New tools for custom links +*** New tool for custom links -Org provides two new tools, ~org-link-open-as-file~ and -~org-export-link-as-file~, useful when defining new link types similar -to "file"-type links. See docstring for details. +Org provides a new tool ~org-link-open-as-file~, useful when defining +new link types similar to "file"-type links. See docstring for +details. *** =ob-clojure.el= supports inf-clojure.el and ClojureScript evaluation diff --git a/lisp/ol.el b/lisp/ol.el index 2910c75d3..4f927a0b0 100644 --- a/lisp/ol.el +++ b/lisp/ol.el @@ -112,10 +112,6 @@ below. - the export back-end, - the export communication channel, as a plist. - If the new link type is meant to be exported as a \"file\"-link - (or as an image), consider using `org-export-link-as-file', - either as an helper function, or as a value for this parameter. - When nil, export for that type of link is delegated to the back-end. diff --git a/lisp/org-attach.el b/lisp/org-attach.el index 443485ab4..429d69021 100644 --- a/lisp/org-attach.el +++ b/lisp/org-attach.el @@ -42,7 +42,6 @@ (declare-function dired-dwim-target-directory "dired-aux") (declare-function org-element-property "org-element" (property element)) (declare-function org-element-type "org-element" (element)) -(declare-function org-export-link-as-file "org-export" (path description backend info)) (defgroup org-attach nil "Options concerning attachments in Org mode." diff --git a/lisp/ox.el b/lisp/ox.el index f266a0912..6f5e81af2 100644 --- a/lisp/ox.el +++ b/lisp/ox.el @@ -4185,21 +4185,6 @@ meant to be translated with `org-export-data' or alike." (org-define-error 'org-link-broken "Unable to resolve link; aborting") -(defun org-export-link-as-file (path description backend info) - "Pretend PATH is a file name, and export it. - -DESCRIPTION, when non-nil, is the description of the link, as -a string. BACKEND is the symbol representing the back-end used -for export. INFO is the communication channel, as a plist. - -This function is meant to be used as a possible tool for -`:export' property in `org-link-parameters'." - (org-export-data-with-backend - (org-element-parse-secondary-string - (org-link-make-string (concat "file:" path) description) '(link)) - backend - info)) - (defun org-export-custom-protocol-maybe (link desc backend &optional info) "Try exporting LINK object with a dedicated function. diff --git a/testing/lisp/test-ox.el b/testing/lisp/test-ox.el index 08b55169d..841422766 100644 --- a/testing/lisp/test-ox.el +++ b/testing/lisp/test-ox.el @@ -2965,32 +2965,6 @@ Para2" ;;; Links -(ert-deftest test-org-export/link-as-file () - "Test `org-export-link-as-file' specifications." - ;; Export path as a "file"-type link. - (should - (equal "success" - (let ((backend - (org-export-create-backend - :name 'test - :transcoders - '((link . (lambda (l _c _i) - (if (equal "file" (org-element-property :type l)) - "success" - "failure"))))))) - (org-export-link-as-file "foo.org" nil backend nil)))) - ;; Exported path handles "file"-type specific properties, - ;; e.g., :search-option. - (should - (equal "bar" - (let ((backend - (org-export-create-backend - :name 'test - :transcoders - '((link . (lambda (l _c _i) - (org-element-property :search-option l))))))) - (org-export-link-as-file "foo.org::bar" nil backend nil))))) - (ert-deftest test-org-export/custom-protocol-maybe () "Test `org-export-custom-protocol-maybe' specifications." (should