On Sun, 18 Jun 2017, Chunyang Xu wrote:

Nicolas Goaziou <m...@nicolasgoaziou.fr> writes:

[...]

I don't think it is a good idea to have file that can be both edited
manually, and auto-generated (i.e., tangled). Or, to put it differently,
the idea behind tangling is that you only handle the code block, not the
file itself.

I still think overriding exist files is dangerous, user can lost data
because of it, so it should be safer if org-babel-tangle can let user
decide how to deal with it.

Besides, if a code block is not changed and I have already tangled it
before, I don't want org-babel-tangle to update the last modified
timestamp of the tangle-file every time I tangle, as along as there is
no actual changes. It is simply unnecessary to me and makes the last
modified timestamp more or less useless. So I would like
org-babel-tangle let me choose what I want.

[...]

It sounds like you are re-inventing version control and wanting it to be implemented in org-babel-tangle.

`org-babel-tangle' can do a lot of work to assemble the files that result from tangling. Modifying `org-babel-tangle' to do what you ask would be far from trivial and make a complicated function even more tortuous.

IMHO, it is better to solve your problem as follows: Set up a separate directory into which files are tangled. Use version control on that directory. Inspect changes after each tangle using the version control system's diff tools, commit good changes, and revert unwanted ones. Then run a script that uses the VC's data to identify changed files and copy those files to the location on your system where they will be used.

HTH,

Chuck

Reply via email to