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.
This commit is contained in:
Nicolas Goaziou 2020-02-28 01:30:30 +01:00
parent 0e0df5abf3
commit 041138e47c
5 changed files with 4 additions and 50 deletions

View File

@ -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

View File

@ -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.

View File

@ -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."

View File

@ -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.

View File

@ -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