emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Charles Berry <ccberry@ucsd.edu>
To: emacs-orgmode@gnu.org
Subject: Re: [babel] Commenting out src blocks for tangling
Date: Sun, 3 Mar 2013 03:44:07 +0000 (UTC)	[thread overview]
Message-ID: <loom.20130303T040744-877@post.gmane.org> (raw)
In-Reply-To: 87ppzinjj2.fsf@bzg.ath.cx

Bastien <bzg <at> altern.org> writes:

> 
> Hi Rainer,
> 
> Rainer M Krug <r.m.krug <at> 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,
> 

  reply	other threads:[~2013-03-03  3:44 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-27 17:53 [babel] Commenting out src blocks for tangling Eric S Fraga
2013-02-27 18:10 ` Aaron Ecay
2013-02-27 18:22   ` Eric S Fraga
2013-02-27 19:18 ` Alan L Tyree
2013-02-27 19:32   ` Eric S Fraga
2013-02-27 23:33     ` Darlan Cavalcante Moreira
2013-02-28  9:01       ` Rainer M Krug
2013-02-28  9:25         ` Bastien
2013-02-28  9:27           ` Rainer M Krug
2013-02-28  9:30           ` Sebastien Vauban
2013-02-28  9:42             ` Rainer M Krug
2013-02-28  9:47               ` Sebastien Vauban
2013-02-28 12:30                 ` Rainer M Krug
2013-03-02 10:31                   ` Bastien
2013-03-03  3:44                     ` Charles Berry [this message]
2013-03-03  6:18                       ` Bastien
2013-02-28  9:44             ` Bastien
2013-02-28  9:51           ` Rasmus
2013-02-28 10:05             ` Bastien
2013-02-28 19:45           ` Eric S Fraga
2013-10-18 14:37           ` Alan Schmitt
2013-10-18 16:43             ` Eric Schulte
2013-10-19  6:06               ` Alan Schmitt
2013-10-19 21:56                 ` Eric Schulte
2013-10-20 17:05                   ` Alan Schmitt
2013-10-20 21:58                     ` Eric Schulte
2013-10-21  6:49                       ` Alan Schmitt

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=loom.20130303T040744-877@post.gmane.org \
    --to=ccberry@ucsd.edu \
    --cc=emacs-orgmode@gnu.org \
    /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).