From mboxrd@z Thu Jan 1 00:00:00 1970 From: Holger Hoefling Subject: Re: Not overwriting unchanged source code files when tangling Date: Sat, 19 Nov 2011 01:49:30 +0100 Message-ID: References: <87pqgpgqtt.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=20cf307ca4be89daa404b20bd3fb Return-path: Received: from eggs.gnu.org ([140.186.70.92]:52099) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RRZ7c-0008Ke-TI for emacs-orgmode@gnu.org; Fri, 18 Nov 2011 19:49:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RRZ7b-00028v-4I for emacs-orgmode@gnu.org; Fri, 18 Nov 2011 19:49:32 -0500 Received: from mail-vx0-f169.google.com ([209.85.220.169]:37883) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RRZ7a-00028q-Rt for emacs-orgmode@gnu.org; Fri, 18 Nov 2011 19:49:31 -0500 Received: by vcbfo1 with SMTP id fo1so3355441vcb.0 for ; Fri, 18 Nov 2011 16:49:30 -0800 (PST) In-Reply-To: <87pqgpgqtt.fsf@gmail.com> 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-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Eric Schulte Cc: Brian Wightman , emacs-orgmode@gnu.org, Carsten Dominik --20cf307ca4be89daa404b20bd3fb Content-Type: text/plain; charset=ISO-8859-1 Hi Eric, sounds like the problem may after all not be that simple.Could the code blocks be written incrementally to the buffer (or a temporary file on disk) and only after everything has been tangled out all temporary buffers or files checked against the ones on disk? Unfortunately, I do not think that breaking up the org-file into smaller org-files is a solution to my problem. I am running longer analyses (20 script files or more) each doing various things and files in parts depending on each other. If I break up the org-file into so many small parts, a large part of the advantage of using org (i.e. complete analysis in a single file with extensive documentation) will be lost. True, I can still include the subfiles during export - but i hardly ever export code blocks at all (I instead hide the code from export and produce a beamer presentation or latex article using the output from my earlier code). So overall, I would really like to keep everything together in one file. Someone else earlier suggested just tangling out to a temporary directory myself and synching in the makefile. This suggestion is close to what I would like to do and I may use it. However, it is still not quite satisfactory as this brings other problems. Source files sometimes call each other -> when they are in a different directory after tangling than they are during the make file execution (due to synching), then either execution from within org may break, or the execution from the make file. If I knew more about e-lisp, I would just hack up a solution myself. I think org-mode is a really awesome tool. Thanks for your help and suggestions Holger On Fri, Nov 18, 2011 at 8:42 PM, Eric Schulte wrote: > Brian Wightman writes: > > > On Fri, Nov 18, 2011 at 11:02 AM, Carsten Dominik > > wrote: > >> How about changing the make file so that the dependence is on the Org > file, not on the source file? > >> You could then arrange for make to call emacs in batch-mode to tangle > the source file and then compile it? > > > > The original question was trying to avoid recompiling everything > > generated from a tangle if the content didn't actually change. > > Because retangling the source rewrites /all/ of the files, and resets > > the dates, even if nothing has changed, make will then rebuild > > everything that was tangled, not just the partial set of tangled files > > that actually changed. > > > > I think the best approach in this case would be to tangle each file out > to a temporary buffer, and then just before exiting the tangle function > the content of these temporary buffers could be checked against the > files on disk, and only those buffers which differ from disk would be > written. See ob-tangle.el around line 240 for the relevant code. > Unfortunately this would not be trivial, as currently content is written > to the target files incrementally block by block. > > If the code in the .org file is grouped by subtree it may be possible to > place calls to org-narrow-to-subtree in the Makefile before tangling, so > that only part of the file is tangled. > > Finally, it may be easiest simply to play make's game as it were and > break up the Org-mode file into multiple files. These multiple files > could still be combined during export using #+INCLUDE lines from a > single master Org-mode file. > > Best -- Eric > > > > > Brian > > > > -- > Eric Schulte > http://cs.unm.edu/~eschulte/ > --20cf307ca4be89daa404b20bd3fb Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hi Eric,

sounds like the problem may after all not be that simple.Co= uld the code blocks be written incrementally to the buffer (or a temporary = file on disk) and only after everything has been tangled out all temporary = buffers or files checked against the ones on disk?

Unfortunately, I do not think that breaking up the org-file into smalle= r org-files is a solution to my problem. I am running longer analyses (20 s= cript files or more) each doing various things and files in parts depending= on each other. If I break up the org-file into so many small parts, a larg= e part of the advantage of using org (i.e. complete analysis in a single fi= le with extensive documentation) will be lost. True, I can still include th= e subfiles during export - but i hardly ever export code blocks at all (I i= nstead hide the code from export and produce a beamer presentation or latex= article using the output from my earlier code). So overall, I would really= like to keep everything together in one file.

Someone else earlier suggested just tangling out to a temporary directo= ry myself and synching in the makefile. This suggestion is close to what I = would like to do and I may use it. However, it is still not quite satisfact= ory as this brings other problems. Source files sometimes call each other -= > when they are in a different directory after tangling than they are du= ring the make file execution (due to synching), then either execution from = within org may break, or the execution from the make file.

If I knew more about e-lisp, I would just hack up a solution myself. I = think org-mode is a really awesome tool.

Thanks for your help and s= uggestions

Holger

On Fri, Nov 18, = 2011 at 8:42 PM, Eric Schulte <schulte.eric@gmail.com> wrote:
Brian Wig= htman <brian@wightmanfam.org> writes:

> On Fri, Nov 18, 2011 at 11:02 AM, Carsten Dominik
> <
carsten.dominik@gmail= .com> wrote:
>> How about changing the make file so that the dependence is on the = Org file, not on the source file?
>> You could then arrange for make to call emacs in batch-mode to tan= gle the source file and then compile it?
>
> The original question was trying to avoid recompiling everything
> generated from a tangle if the content didn't actually change.
> Because retangling the source rewrites /all/ of the files, and resets<= br> > the dates, even if nothing has changed, make will then rebuild
> everything that was tangled, not just the partial set of tangled files=
> that actually changed.
>

I think the best approach in this case would be to tangle each = file out
to a temporary buffer, and then just before exiting the tangle function
the content of these temporary buffers could be checked against the
files on disk, and only those buffers which differ from disk would be
written. =A0See ob-tangle.el around line 240 for the relevant code.
Unfortunately this would not be trivial, as currently content is written to the target files incrementally block by block.

If the code in the .org file is grouped by subtree it may be possible to place calls to org-narrow-to-subtree in the Makefile before tangling, so that only part of the file is tangled.

Finally, it may be easiest simply to play make's game as it were and break up the Org-mode file into multiple files. =A0These multiple files
could still be combined during export using #+INCLUDE lines from a
single master Org-mode file.

Best -- Eric

>
> Brian
>

--
Eric Schulte
http://cs.unm.= edu/~eschulte/

--20cf307ca4be89daa404b20bd3fb--