From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Schulte Subject: Re: Not overwriting unchanged source code files when tangling Date: Fri, 18 Nov 2011 12:42:01 -0700 Message-ID: <87pqgpgqtt.fsf@gmail.com> References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([140.186.70.92]:35993) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RRUKl-000092-3k for emacs-orgmode@gnu.org; Fri, 18 Nov 2011 14:42:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RRUKg-00051X-M8 for emacs-orgmode@gnu.org; Fri, 18 Nov 2011 14:42:47 -0500 Received: from mail-iy0-f169.google.com ([209.85.210.169]:38070) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RRUKg-0004ym-Ik for emacs-orgmode@gnu.org; Fri, 18 Nov 2011 14:42:42 -0500 Received: by mail-iy0-f169.google.com with SMTP id k3so5116249iae.0 for ; Fri, 18 Nov 2011 11:42:42 -0800 (PST) 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: Brian Wightman Cc: Holger Hoefling , emacs-orgmode@gnu.org, Carsten Dominik 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/