emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Orgmode] [BUG] incorrect indentation when tangling with org-src-preserv


From: Antti Kaihola
Subject: [Orgmode] [BUG] incorrect indentation when tangling with org-src-preserve-indentation
Date: Sat, 9 Oct 2010 14:09:24 +0300

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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]