Function: org-export-link--remote-local-copy
org-export-link--remote-local-copy is a byte-compiled function defined
in ox.el.gz.
Signature
(org-export-link--remote-local-copy LINK)
Documentation
Download the remote resource specified by LINK, and return its local path.
Source Code
;; Defined in /usr/src/emacs/lisp/org/ox.el.gz
(defun org-export-link--remote-local-copy (link)
"Download the remote resource specified by LINK, and return its local path."
;; TODO work this into ol.el as a link parameter, say :download.
(let* ((location-type
(pcase (org-element-property :type link)
((or "http" "https" "ftp") 'url)
((and "file" (guard (file-remote-p
(org-element-property :path link))))
'file)
(_ (error "Cannot copy %s:%s to a local file"
(org-element-property :type link)
(org-element-property :path link)))))
(path
(pcase location-type
('url
(concat (org-element-property :type link)
":" (org-element-property :path link)))
('file
(org-element-property :path link)))))
(or (org-persist-read location-type path)
(org-persist-register location-type path
:write-immediately t))))