Allow org-file-contents to fetch file contents from a URL
commit1e92f5ed39541a473f295b414e8c89f6b0390f83
authorKaushal Modi <kaushal.modi@gmail.com>
Tue, 13 Jun 2017 15:41:14 +0000 (13 11:41 -0400)
committerKaushal Modi <kaushal.modi@gmail.com>
Tue, 13 Jun 2017 15:41:58 +0000 (13 11:41 -0400)
tree0f81dc59cf54db8be7a4abc165353cc457622884
parent49dc91c55ead629a460f31198b40a98d4ca2060d
Allow org-file-contents to fetch file contents from a URL

* lisp/org.el (org--file-cache): New variable.
(org-reset-file-cache):
(org-file-url-p): New function.
(org-mode-restart): Use new function.

* lisp/org.el (org-file-contents): Allow the FILE argument to be a
URL.  If the URL contents are already cached, return the cache
contents, else download the file and return contents of that.  The
file is automatically cached each time it is downloaded.  Add a new
optional argument NOCACHE.  If this is non-nil, the URL is always
downloaded afresh.  Use `org--file-cache' and `org-file-url-p'.

* lisp/org.el (org-edit-special): Do not allow editing the "file" if a
URL is specified for the "#+SETUPFILE".

* lisp/ox.el (org-export--list-bound-variables)
(org-export--prepare-file-contents):
* lisp/org-macro.el (org-macro--collect-macros) : Adapt to the
possibility that the input to `org-file-contents' can be a URL too.

* doc/org.texi (Export settings, In-buffer settings)
(The very busy C-c C-c key): Mention that #+SETUPFILE keyword can now
take a URL as a value, and that C-c C-c on the #+SETUPFILE line will
clear the org file cache.

* testing/lisp/test-org.el (test-org/org-file-contents-url)
(test-org/org-file-contents-file): Add tests for org-file-contents.

* testing/lisp/test-ox.el (test-org-export/get-inbuffer-options): Add
test for reading setupfile specified via a URL.
doc/org.texi
etc/ORG-NEWS
lisp/org-macro.el
lisp/org.el
lisp/ox.el
testing/lisp/test-org.el
testing/lisp/test-ox.el