emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Holger Hoefling <hhoeflin@gmail.com>
To: Eric Schulte <schulte.eric@gmail.com>
Cc: Brian Wightman <brian@wightmanfam.org>,
	emacs-orgmode@gnu.org,
	Carsten Dominik <carsten.dominik@gmail.com>
Subject: Re: Not overwriting unchanged source code files when tangling
Date: Sat, 19 Nov 2011 01:49:30 +0100	[thread overview]
Message-ID: <CAFDswJvWjFpGoPG7YbGDNLGyfN4B5x3BYOA9KW16c6h8P4nV3Q@mail.gmail.com> (raw)
In-Reply-To: <87pqgpgqtt.fsf@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 3499 bytes --]

Hi Eric,

sounds like the problem may after all not be that simple.Could the code
blocks be written incrementally to the buffer (or a temporary file on disk)
and only after everything has been tangled out all temporary buffers or
files checked against the ones on disk?

Unfortunately, I do not think that breaking up the org-file into smaller
org-files is a solution to my problem. I am running longer analyses (20
script files or more) each doing various things and files in parts
depending on each other. If I break up the org-file into so many small
parts, a large part of the advantage of using org (i.e. complete analysis
in a single file with extensive documentation) will be lost. True, I can
still include the subfiles during export - but i hardly ever export code
blocks at all (I instead hide the code from export and produce a beamer
presentation or latex article using the output from my earlier code). So
overall, I would really like to keep everything together in one file.

Someone else earlier suggested just tangling out to a temporary directory
myself and synching in the makefile. This suggestion is close to what I
would like to do and I may use it. However, it is still not quite
satisfactory as this brings other problems. Source files sometimes call
each other -> when they are in a different directory after tangling than
they are during the make file execution (due to synching), then either
execution from within org may break, or the execution from the make file.

If I knew more about e-lisp, I would just hack up a solution myself. I
think org-mode is a really awesome tool.

Thanks for your help and suggestions

Holger

On Fri, Nov 18, 2011 at 8:42 PM, Eric Schulte <schulte.eric@gmail.com>wrote:

> Brian Wightman <brian@wightmanfam.org> writes:
>
> > On Fri, Nov 18, 2011 at 11:02 AM, Carsten Dominik
> > <carsten.dominik@gmail.com> 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/
>

[-- Attachment #2: Type: text/html, Size: 4203 bytes --]

  parent reply	other threads:[~2011-11-19  0:49 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-18 13:17 Not overwriting unchanged source code files when tangling Holger Hoefling
2011-11-18 14:23 ` Brian Wightman
2011-11-18 16:46   ` Tom Prince
2011-11-18 17:14     ` Brian Wightman
2011-11-18 14:27 ` Sebastien Vauban
2011-11-18 17:02 ` Carsten Dominik
2011-11-18 17:28   ` Brian Wightman
2011-11-18 19:42     ` Eric Schulte
2011-11-18 20:10       ` Achim Gratz
2011-11-18 20:24         ` Eric Schulte
2011-11-19  0:49       ` Holger Hoefling [this message]
2011-11-18 19:01   ` Holger Hoefling
2011-11-18 19:32     ` Nick Dokos
2011-11-19  0:51       ` Holger Hoefling
2011-11-19  4:00         ` Nick Dokos
2011-11-19  6:58           ` Holger Hoefling
2011-11-19 18:32             ` Holger Hoefling
2011-11-22 21:17               ` Allen S. Rout
2011-11-22 21:43                 ` Nick Dokos
2011-11-19 18:06     ` cberry
2011-11-18 19:51 ` Achim Gratz
  -- strict thread matches above, loose matches on Subject: below --
2011-11-19 15:31 Rustom Mody
2011-11-19 15:51 ` Rustom Mody

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAFDswJvWjFpGoPG7YbGDNLGyfN4B5x3BYOA9KW16c6h8P4nV3Q@mail.gmail.com \
    --to=hhoeflin@gmail.com \
    --cc=brian@wightmanfam.org \
    --cc=carsten.dominik@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=schulte.eric@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).