emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Eric Schulte" <schulte.eric@gmail.com>
To: Erik Iverson <eriki@ccbr.umn.edu>
Cc: Org Mode <emacs-orgmode@gnu.org>
Subject: Re: [babel] `org-babel-tangle-w-comments' controls comment insertion in tangled code
Date: Fri, 28 May 2010 09:57:06 -0600	[thread overview]
Message-ID: <878w746mul.fsf@gmail.com> (raw)
In-Reply-To: <4BFFE4A7.9070300@ccbr.umn.edu> (Erik Iverson's message of "Fri, 28 May 2010 10:43:35 -0500")

Hi Erik,

explanation below

Erik Iverson <eriki@ccbr.umn.edu> writes:

> Eric Schulte wrote:
>> Hi,
>>
>> The insertion of automatically generated comments in tangled source code
>> is now controlled by the new `org-babel-tangle-w-comments' variable.
>> Setting this variable to non-nil will allow org-babel to insert comments
>> for those languages with comment support.
>
> Can you briefly elaborate on what this means?  I'm used to seeing,
> when I tangle an R file, something like:
>
> ## [[file:~/private/R-org-babel/test.org::*cube%20lets%20go%20to%20the][block-2]]
>
> cube <- function(x) {
>   # a test comment
>   x * x * x * x
> }
> ## block-2 ends here
>

what was previously exported as


will now be exported as

--8<---------------cut here---------------start------------->8---
cube <- function(x) {
  # a test comment
  x * x * x * x
}
--8<---------------cut here---------------end--------------->8---

unless the `org-babel-tangle-w-comments' variable is set to a non-nil
value.

>
> So, you mean that all three of the comments would no longer appear by
> default?  Or you mean that only my inline function comment would not
> appear?
>

The outer two comments of

 ## [[file:~/private/R-org-babel/test.org::*cube%20lets%20go%20to%20the][block-2]]

and

 ## block-2 ends here

will not appear.  Your own comments inside of the source-code block will
still appear.  Is that clear?  Thanks for pointing out the insufficient
explanation.

>
> One more idea I had was that it might be interesting to be able to
> maintain properties for headlines that indicate the headline/body
> should be included as a comment in a specific source file.  The reason
> I say this is that even if I write my code in org-mode, and in effect
> comment the code using org-mode constructs like headlines and free
> text, someone who just wants the tangled file might want to see
> comments, for example, function headers or something like that.
>
> Any thoughts on that?

Yes, that sounds like a good idea.

Maybe we should allow either exporting just the headlines of the
org-mode file or exporting the entire org-mode file -- possibly after an
ASCII export -- this would have the effect of prefixing every line in
the org-mode file behind a comment *except* for the tangled source-code
blocks.

Implementation wise I'm not sure how easy/difficult this would be, but I
definitely think it's worth looking into.

Have I understood your suggestion?

Best -- Eric

  parent reply	other threads:[~2010-05-28 15:57 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-28 14:55 [babel] `org-babel-tangle-w-comments' controls comment insertion in tangled code Eric Schulte
2010-05-28 15:43 ` Erik Iverson
2010-05-28 15:47   ` Erik Iverson
2010-05-28 15:57   ` Eric Schulte [this message]
2010-05-28 16:24     ` Erik Iverson
2010-05-28 18:08       ` Thomas S. Dye
2010-05-28 18:41         ` Erik Iverson
2010-05-28 19:17           ` Thomas S. Dye
2010-06-17  3:57             ` Eric Schulte

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=878w746mul.fsf@gmail.com \
    --to=schulte.eric@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=eriki@ccbr.umn.edu \
    /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).