emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [BUG] incorrect indentation when tangling with org-src-preserve-indentation
@ 2010-10-09 11:09 Antti Kaihola
  2010-10-09 12:22 ` [babel] " Antti Kaihola
  0 siblings, 1 reply; 7+ messages in thread
From: Antti Kaihola @ 2010-10-09 11:09 UTC (permalink / raw)
  To: emacs-orgmode

As pointed out in the documentation, when tangling Python code, it's
important to set org-src-preserve-indentation to a non-nil value.
However, tangling still doesn't seem to work correcly: If the first
line of a source code block is indented, it ends up dedented to the
first column in the resulting .py file.


An example:

--8<----8<----8<----8<-- test.org
-*- org-src-preserve-indentation: t -*-

* Main heading

A bit of introduction

#+begin_src python :tangle yes
class ClassDefinition(IsNotIndented):
    class_variable = 'is correctly indented'
#+end_src

#+begin_src python :tangle yes
    def method_definition(self, is_not_indented_correctly):
        print 'the method body'
        print 'is indented correctly'
#+end_src
--8<----8<----8<----8<-- test.org ends


The resulting file after tangling:

--8<----8<----8<----8<-- test.py

class ClassDefinition(IsNotIndented):
    class_variable = 'is correctly indented'

def method_definition(self, is_not_indented_correctly):
        print 'the method body'
        print 'is indented correctly'
--8<----8<----8<----8<-- test.py ends


Note that the "def method_definition" line should be indented with four spaces.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2010-10-15  7:14 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-09 11:09 [BUG] incorrect indentation when tangling with org-src-preserve-indentation Antti Kaihola
2010-10-09 12:22 ` [babel] " Antti Kaihola
2010-10-09 15:36   ` Antti Kaihola
2010-10-12 14:54     ` Dan Davison
2010-10-12 16:40       ` Achim Gratz
2010-10-13  5:03         ` Eric Schulte
2010-10-15  7:14       ` Antti Kaihola

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).