From mboxrd@z Thu Jan 1 00:00:00 1970 From: Holger Hoefling Subject: Re: Not overwriting unchanged source code files when tangling Date: Fri, 18 Nov 2011 20:01:55 +0100 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=f46d04388de57d2de304b206f8d6 Return-path: Received: from eggs.gnu.org ([140.186.70.92]:35082) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RRThK-0006Kb-76 for emacs-orgmode@gnu.org; Fri, 18 Nov 2011 14:02:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RRThE-0004ma-4B for emacs-orgmode@gnu.org; Fri, 18 Nov 2011 14:02:02 -0500 Received: from mail-vx0-f169.google.com ([209.85.220.169]:34157) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RRThE-0004mW-0h for emacs-orgmode@gnu.org; Fri, 18 Nov 2011 14:01:56 -0500 Received: by vcbfo1 with SMTP id fo1so3034692vcb.0 for ; Fri, 18 Nov 2011 11:01:55 -0800 (PST) In-Reply-To: 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: Carsten Dominik Cc: emacs-orgmode@gnu.org --f46d04388de57d2de304b206f8d6 Content-Type: text/plain; charset=ISO-8859-1 Hi Carsten, thanks for the suggestion, but as I agree with Brian. If there is more than one source file in the org-file, then the whole project would still be recompiled, not just the updated file. To be more exact, I actually don't want to compile things, but run R scripts using make. So the waiting time if a computationally intensive step is repeated although it is not necessary can be substantial. I wonder how difficult the following change would be (no emacs lisp experience, also do not know the org source code): - would it be possible to write out the source files when tangling into a temporary directory, then compare to the actual target files and overwrite only if something has changed? Then the time stamps would stay fixed. Hopefully, this would not involve too much work: - creating temporary files and remembering the mapping to true files - tangling out as usual into temporary files (so probably little change there) - compare temporary file to true file (does emacs already have a diff utility that could be used?) - overwrite true file if any changes - delete temporary files Especially, with this method no dependencies would be necessary and it would not be necessary to keep track in the org files which source blocks have been changed since the last tangling Thank you for your suggestion Holger On Fri, Nov 18, 2011 at 6:02 PM, Carsten Dominik wrote: > > On 18.11.2011, at 14:17, Holger Hoefling wrote: > > > Hi, > > > > 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. > > > > Is there an option for org-mode to only overwrite source code files that > get tangled out if they have truly changed? > > 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? > > Something along the lines of.... (untested, and probably wrong in this > way...) > > file.o: somefile.org > emacs -batch --eval '(org-babel-tangle-file "somefile.org")' > cc file.o .... > > - Carsten --f46d04388de57d2de304b206f8d6 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hi Carsten,

thanks for the suggestion, but as I agree with Brian. I= f there is more than one source file in the org-file, then the whole projec= t would still be recompiled, not just the updated file.

To be more e= xact, I actually don't want to compile things, but run R scripts using = make. So the waiting time if a computationally intensive step is repeated a= lthough it is not necessary can be substantial.

I wonder how difficult the following change would be (no emacs lisp exp= erience, also do not know the org source code):

- would it be possib= le to write out the source files when tangling into a temporary directory, = then compare to the actual target files and overwrite only if something has= changed? Then the time stamps would stay fixed. Hopefully, this would not = involve too much work:
- creating temporary files and remembering the mapping to true files
- t= angling out as usual into temporary files (so probably little change there)=
- compare temporary file to true file (does emacs already have a diff u= tility that could be used?)
- overwrite true file if any changes
- delete temporary files

Esp= ecially, with this method no dependencies would be necessary and it would n= ot be necessary to keep track in the org files which source blocks have bee= n changed since the last tangling

Thank you for your suggestion

Holger


--f46d04388de57d2de304b206f8d6--