From mboxrd@z Thu Jan 1 00:00:00 1970 From: Achim Gratz Subject: Re: Not overwriting unchanged source code files when tangling Date: Fri, 18 Nov 2011 21:10:02 +0100 Message-ID: <87wrax8a5h.fsf@Rainer.invalid> References: <87pqgpgqtt.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([140.186.70.92]:49480) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RRUlW-0006G5-JC for emacs-orgmode@gnu.org; Fri, 18 Nov 2011 15:10:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RRUlS-0003Vq-FR for emacs-orgmode@gnu.org; Fri, 18 Nov 2011 15:10:26 -0500 Received: from lo.gmane.org ([80.91.229.12]:41204) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RRUlS-0003To-1n for emacs-orgmode@gnu.org; Fri, 18 Nov 2011 15:10:22 -0500 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1RRUlL-0002M3-HP for emacs-orgmode@gnu.org; Fri, 18 Nov 2011 21:10:15 +0100 Received: from p57aaa6ec.dip.t-dialin.net ([87.170.166.236]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 18 Nov 2011 21:10:15 +0100 Received: from Stromeko by p57aaa6ec.dip.t-dialin.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 18 Nov 2011 21:10:15 +0100 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: emacs-orgmode@gnu.org Eric Schulte 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