From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: Allow #+SETUPFILE to point to an URL for the org file Date: Sun, 28 May 2017 09:35:57 +0200 Message-ID: <87o9ud77s2.fsf@nicolasgoaziou.fr> References: <87h96eh4qb.fsf@nicolasgoaziou.fr> <871sxigkhk.fsf@nicolasgoaziou.fr> <87twaef3iq.fsf@nicolasgoaziou.fr> <874lybp5ua.fsf@nicolasgoaziou.fr> <87shjtb5wd.fsf@nicolasgoaziou.fr> <87o9ug83fb.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:49140) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dEsk6-0006RG-5x for emacs-orgmode@gnu.org; Sun, 28 May 2017 03:36:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dEsk5-0003uj-6n for emacs-orgmode@gnu.org; Sun, 28 May 2017 03:36:02 -0400 Received: from relay4-d.mail.gandi.net ([2001:4b98:c:538::196]:35379) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dEsk4-0003uX-Vr for emacs-orgmode@gnu.org; Sun, 28 May 2017 03:36:01 -0400 In-Reply-To: (Kaushal Modi's message of "Fri, 26 May 2017 20:24:00 +0000") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Kaushal Modi Cc: emacs-org list Hello, Kaushal Modi writes: > I have attached a patch, rebased to master and with all suggestions > implemented. Thank you. > There are some additional changes in the patch this time: > - Prevent org-edit-special from attempting to open the "file" for editing > if the value is a URL. This is a good idea. We could even display a read-only buffer with the contents of the document, using new `org-file-contents'. Anyway, this can be done in a different patch. > I liked your C-c C-c idea below! :) Great! > +indirectly through a file included using @samp{#+SETUPFILE: filename/URL} filename/URL > file name or URL > +@item #+SETUPFILE: file/URL file/URL > file name or URL > +The setup file or a URL pointing to such file is for additional in-buffer > +settings. Org loads this file and parses it for any settings in it only when > +Org opens the main file. If URL is specified, the contents are downloaded > +and stored in a temporary cache. @kbd{C-c C-c} on the settings line will > +also parse and load. @kbd{C-c C-c} on the @code{#+SETUPFILE:} line will also > +reset the temporary file cache. Org also parses and loads the file/URL file/URL > document > +during normal exporting process. Org parses the contents of this > file/URL as file/URL document > +if it was included in the buffer. It can be another Org file. To visit the > +file (not a URL), @kbd{C-c '} while the cursor is on the line with the file > name. > @item #+STARTUP: > @cindex #+STARTUP > @@ -17395,7 +17398,9 @@ If any highlights shown in the buffer from the creation of a sparse tree, or > from clock display, remove such highlights. > @item > If the cursor is in one of the special @code{#+KEYWORD} lines, scan the > -buffer for these lines and update the information. > +buffer for these lines and update the information. Also reset the org file org > Org > +(defvar ffap-url-regexp) ;Silence byte-compiler I think this can go at the beginning of the "org.el". > + ;; Reset the cache of files downloaded by `org-file-contents'. > + (clrhash org--file-cache)) Note that we can still implement a non-interactive `org-reset-setupfile-cache' function and call it here instead. (clrhash org--file-cache) may be a bit low level at this point. Otherwise, LGTM. Would you want to throw in some tests? You can use cl-letf to bind `url-retrieve-synchronously' to a function returning a buffer containing some dumb (valid or invalid) output. Regards, -- Nicolas Goaziou