From mboxrd@z Thu Jan 1 00:00:00 1970 From: Charles Berry Subject: Re: [babel] Commenting out src blocks for tangling Date: Sun, 3 Mar 2013 03:44:07 +0000 (UTC) Message-ID: References: <87r4k18wy2.fsf@ucl.ac.uk> <87mwup8t0q.fsf@breezy.my.home> <87bob58sdi.fsf@ucl.ac.uk> <512e97cf.82c1ec0a.76d4.ffffc5f1@mx.google.com> <512F1CDF.80906@gmail.com> <877glsg57i.fsf@bzg.ath.cx> <867gls9451.fsf@somewhere.org> <512F26A1.7020807@gmail.com> <86y5e87osz.fsf@somewhere.org> <512F4DEB.7050202@gmail.com> <87ppzinjj2.fsf@bzg.ath.cx> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([208.118.235.92]:35153) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UBzqa-0008RP-VF for emacs-orgmode@gnu.org; Sat, 02 Mar 2013 22:44:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UBzqZ-0004HH-2t for emacs-orgmode@gnu.org; Sat, 02 Mar 2013 22:44:24 -0500 Received: from plane.gmane.org ([80.91.229.3]:37156) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UBzqY-0004Ge-Rn for emacs-orgmode@gnu.org; Sat, 02 Mar 2013 22:44:22 -0500 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1UBzqr-0004Mp-BI for emacs-orgmode@gnu.org; Sun, 03 Mar 2013 04:44:41 +0100 Received: from 137.110.34.176 ([137.110.34.176]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 03 Mar 2013 04:44:41 +0100 Received: from ccberry by 137.110.34.176 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 03 Mar 2013 04:44:41 +0100 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 Bastien altern.org> writes: > > Hi Rainer, > > Rainer M Krug gmail.com> writes: > > > Follow up: would it be possible to have the same mechanism for tangling, i.e. a tag :notangle:? > > functioning would be equivalent to property tangle: no but more visible and consistent with the > > :noexport:? One could also define properties to be tangled and not tangled for different scenarios? > > One approach could be to use export filters here. Why not use the new exporter, rather than org-babel-tangle? Below, there is a minimal backend called R-src-blocks that only exports src-blocks for language "R" and the headline titles as comments. R-src-blocks backend is just an illustration - I don't intend that anyone actually use it. I guess I am suggesting that tangling is just exporting code; with full access to all the export machinery (like exclude_tags and backend specific options), it might be better to head toward backends that yield code than to elaborate org-babel-tangle. Chuck #+BEGIN_SRC emacs-lisp (require 'ox-ascii) (defun comment-headline (headline contents info) (concat "### * " (org-element-property :raw-value headline) "\n\n" contents)) (org-export-define-backend R-src-blocks ((src-block . (lambda (src-block contents info) (and (string= (org-element-property :language src-block) "R") (car (org-export-unravel-code src-block))))) (section . org-ascii-section) (headline . comment-headline))) #+END_SRC > > I'd rather let (or someone else) find out if this approach is > easy enough before considering adding a new keyword like :notangle:. > But if you (or someone else) come up with a patch implementing the > :notangle: approach, of course we might consider it too. > > Thanks, >