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 20:51:34 +0100 Message-ID: <871ut59pkp.fsf@Rainer.invalid> References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([140.186.70.92]:35302) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RRUTY-00027Z-M7 for emacs-orgmode@gnu.org; Fri, 18 Nov 2011 14:51:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RRUTX-0007ON-1b for emacs-orgmode@gnu.org; Fri, 18 Nov 2011 14:51:52 -0500 Received: from lo.gmane.org ([80.91.229.12]:46274) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RRUTW-0007Nx-IF for emacs-orgmode@gnu.org; Fri, 18 Nov 2011 14:51:50 -0500 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1RRUTU-0003QA-Rx for emacs-orgmode@gnu.org; Fri, 18 Nov 2011 20:51:48 +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 20:51:48 +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 20:51:48 +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 Holger Hoefling writes: > I have a problem/request for org-mode and was looking for help. I am > using org-mode to write source code files and tangle them out. I want > to compile them using make. My problem now is that org-mode overwrites > the old files every time I tangle them out, therefore also updating > the time stamp - even if nothing has changed. Subsequently, when I run > make, everything gets recompiled, not just the changed source code > files as all time stamps have changed. Make really doesn't have the smarts to deal with builds that it doesn't fully control. In your case, the actual source aren't the tangled files, but really (parts of) an orgmode file. With a bit of clever organization it should be possible to employ git to keep track of the "sources" for make. In a nutshell, you'd check in the sources into a repository and only compile those that are different from the last commit. After the successful compile you autocommit the tangled files. Since you will probably don't need version control of the tangled files (although that might be useful for debugging of the tangling process itself), you could either amend each commit or just periodically chop the repository and do a garbage collect. Putting the smarts into orgmode to keep track of each tangle block looks complicated in the general case; while possible is a bit of a stretch IMHO. It would also produce false positives for a lot of cases that I'd consider useful (splitting or fusioning tangle blocks without changing the result). But the solution outlined above could be used if the content of each file to be tangled was always available in full in a buffer before writing to the tangled file. The buffer could just be dropped if the SHA1 of the file on disk and the buffer content is identical. Regards, Achim. -- +<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+ Wavetables for the Terratec KOMPLEXER: http://Synth.Stromeko.net/Downloads.html#KomplexerWaves