emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Not overwriting unchanged source code files when tangling


From: Achim Gratz
Subject: Re: [O] Not overwriting unchanged source code files when tangling
Date: Fri, 18 Nov 2011 21:10:02 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.91 (gnu/linux)

Eric Schulte <address@hidden> writes:
> 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.

It would be wise to follow an age-old tradition and not clobber an
existing file with before it is known that the process will finish
without error.  A temporary file is easily trashed when something goes
wrong and the previous result still available.  If all went well, the
old file can be deleted (or renamed to a backup file) and the temporary
file can be moved to where the old one was if the two SHA1 differ.

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

I don't think that would work very well, see my other post.  It is the
content of the resulting file that needs to be compared, not the steps
in which that result is produced.

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

Well, I've been wondering about this for some time: can one make sort of
an "indirect buffer" from the contents of multiple other buffers in
Emacs?  That would make such #+INCLUDEs much more seamless.


Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

SD adaptation for Waldorf rackAttack V1.04R1:
http://Synth.Stromeko.net/Downloads.html#WaldorfSDada




reply via email to

[Prev in Thread] Current Thread [Next in Thread]