From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Charles C. Berry" Subject: Re: Asks user what to do with each tangle-file before overriding? Date: Sun, 18 Jun 2017 10:12:33 -0700 Message-ID: References: <87mv95daj2.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:46694) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dMdkg-0005HH-KU for emacs-orgmode@gnu.org; Sun, 18 Jun 2017 13:12:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dMdkb-0006TY-LR for emacs-orgmode@gnu.org; Sun, 18 Jun 2017 13:12:42 -0400 Received: from iport-acv9-out.ucsd.edu ([132.239.0.167]:14154) by eggs.gnu.org with esmtps (TLS1.0:RSA_ARCFOUR_SHA1:16) (Exim 4.71) (envelope-from ) id 1dMdkb-0006TM-5S for emacs-orgmode@gnu.org; Sun, 18 Jun 2017 13:12:37 -0400 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" To: Chunyang Xu Cc: emacs-orgmode@gnu.org, Nicolas Goaziou On Sun, 18 Jun 2017, Chunyang Xu wrote: > Nicolas Goaziou 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