From mboxrd@z Thu Jan 1 00:00:00 1970 From: Neeum Zawan Subject: Re: Literate Programming - Continue a Source Block? Date: Wed, 08 Jun 2011 14:20:57 -0700 Message-ID: <877h8wj9za.fsf@fester.com> References: <87pqmokh6d.fsf@fester.com> <80k4cw22uf.fsf@somewhere.org> <87fwnkjqoh.fsf@fester.com> <87mxhsnmcf.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from eggs.gnu.org ([140.186.70.92]:57128) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QUQ9j-0002rE-RS for emacs-orgmode@gnu.org; Wed, 08 Jun 2011 17:19:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QUQ9i-0004lB-7F for emacs-orgmode@gnu.org; Wed, 08 Jun 2011 17:19:15 -0400 Received: from lo.gmane.org ([80.91.229.12]:38302) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QUQ9h-0004kw-Ls for emacs-orgmode@gnu.org; Wed, 08 Jun 2011 17:19:14 -0400 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1QUQ9e-0001rm-3j for emacs-orgmode@gnu.org; Wed, 08 Jun 2011 23:19:10 +0200 Received: from c-71-237-233-41.hsd1.or.comcast.net ([71.237.233.41]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 08 Jun 2011 23:19:10 +0200 Received: from mailinglists by c-71-237-233-41.hsd1.or.comcast.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 08 Jun 2011 23:19:10 +0200 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: emacs-orgmode@gnu.org Eric Schulte writes: >>> Second solution: create one sole block that will be tangled, and which >>> contains your other blocks (using the <> syntax), in the order you want. >> >> I had thought of this, but I find it somewhat lacking. Consider my >> example above. I could have created a <> in my >> <> block. However: >> >> 1. That requires me to know I'm going to need it later when I write >> visual-config. >> > > nit picking here, but while this does require a small edit to > <>, there is no need for prior knowledge of the need for > <>. > >> >> 2. If I didn't know I'd need it, I'd have to continually modify various >> parts of the org document every time I add a new feature to my code. I >> find this suboptimal and error prone. >> > > Technically only one edit per new block introduced, which does not seem > overly onerous. In this case, yes. In a real programming project, it could be a number of them. For example, I may have a code block dedicated to imports/includes which I want to be on the top of the file - and I may have to append to that when adding a new feature. And then the actual code for the new feature may require edits to other parts of one's program. Ideally, everything should be decoupled, but reality rarely follows the ideal ;-) >> Now the original noweb allows what I'm asking for. If you begin a >> source block with a name of an existing block but append an "=" >> symbol, it knows to append to that source block. >> >> It would be great if org-mode could add that capability. > > I agree, and the functionality you describe shouldn't be overly > difficult to implement. > > I like the concision of the "=original-name" syntax used by noweb, but I > would lean towards the use of a ":noweb-append" type header argument as > suggested above because currently the names of blocks in Babel carry no > semantic content and I'd prefer to leave it this way. I suppose it may also break compatibility in case someone out there uses the =symbol. Had it been thought of earlier, I would have preferred the default behavior being append if you have multiple blocks of the same name, and an explicit option *not* to append but to overwrite, but your idea makes the most sense with respect to preserving backward compatibility. In addition to append, there probably should be another option for overwriting instead of appending (neither is possible right now). Also, just on the side, I'm not sure it's documented anywhere what happens if you have multiple source code blocks of the same name. At the moment, it seems only the first is used (I would have expected the last). > Thanks for the motivating example and the thorough explanation of > behavior. > > I'll certainly put this on my long-term development queue, however, that > does not guarantee an implementation in the near future. If anyone is > interested in this functionality and is up for writing some elisp I am > happy to offer advice and code pointers immediately. Wish I knew elisp. Anyway, hopefully someone will get it done one day. Thanks.