From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Eric Schulte" Subject: Re: org-babel-tangle indentation Date: Thu, 08 Oct 2009 08:31:14 -0600 Message-ID: References: <86skduat8g.fsf@portan.ibr.cs.tu-bs.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Mvu1g-0000cW-UQ for emacs-orgmode@gnu.org; Thu, 08 Oct 2009 10:31:28 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Mvu1c-0000Zn-7U for emacs-orgmode@gnu.org; Thu, 08 Oct 2009 10:31:28 -0400 Received: from [199.232.76.173] (port=35350 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mvu1c-0000Zg-1p for emacs-orgmode@gnu.org; Thu, 08 Oct 2009 10:31:24 -0400 Received: from mail-px0-f202.google.com ([209.85.216.202]:56336) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Mvu1b-0000QR-LH for emacs-orgmode@gnu.org; Thu, 08 Oct 2009 10:31:23 -0400 Received: by pxi40 with SMTP id 40so6323805pxi.24 for ; Thu, 08 Oct 2009 07:31:21 -0700 (PDT) In-Reply-To: <86skduat8g.fsf@portan.ibr.cs.tu-bs.de> (Chris Gray's message of "Thu, 08 Oct 2009 15:51:59 +0200") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Hi Chris, You have touched upon a true limitation in the current tangle functionality. I think this issue has two parts (one of which you address below). 1) it is impossible to specify a piece of heavily indented code in a source-code block. For example --8<---------------cut here---------------start------------->8--- #+begin_src python 9 #+end_src --8<---------------cut here---------------end--------------->8--- will always be exported as --8<---------------cut here---------------start------------->8--- 9 --8<---------------cut here---------------end--------------->8--- because Org-babel strips off any leading spaces. This problem is exacerbated by the fact that C-' org-edit-special also strips off leading spaces. 2) There is no way to specify the level at which the contents of a source block should be indented. You provided a good solution to this second issue below, and I'm adding it to the org-babel task stack. Thanks -- Eric Chris Gray writes: > Hi, > > I've been using org-babel for a couple of weeks now and I really like it > for programming. One thing I've noticed, though, is that source blocks > are not indented when they are output by org-babel-tangle. This makes > the output source hard to read, and incorrect for languages where > indentation is important. > > For example, the following bit of python does not compile when tangled. > > * Introduction > > This is some intro text. > > #+srcname: the first block > #+begin_src python :tangle foo :exports none > print '1 + 1' > if 1 + 1 == 2: > print 'oh no' > else: > # <> > #+end_src > > Some more text. > > #+srcname: do the other thing > #+begin_src python :tangle no :exports none > print 'oh yes' > #+end_src > > My preference would be for source blocks to be indented to the level of > the comment that caused them to be inserted. > > Cheers, > Chris > > > > _______________________________________________ > Emacs-orgmode mailing list > Remember: use `Reply All' to send replies to the list. > Emacs-orgmode@gnu.org > http://lists.gnu.org/mailman/listinfo/emacs-orgmode