From mboxrd@z Thu Jan 1 00:00:00 1970 From: Antti Kaihola Subject: [BUG] incorrect indentation when tangling with org-src-preserve-indentation Date: Sat, 9 Oct 2010 14:09:24 +0300 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Return-path: Received: from [140.186.70.92] (port=35967 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P4XIw-0003AF-Cv for emacs-orgmode@gnu.org; Sat, 09 Oct 2010 07:09:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1P4XIt-0002iU-8D for emacs-orgmode@gnu.org; Sat, 09 Oct 2010 07:09:28 -0400 Received: from mail-iw0-f169.google.com ([209.85.214.169]:55704) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1P4XIt-0002iQ-4P for emacs-orgmode@gnu.org; Sat, 09 Oct 2010 07:09:27 -0400 Received: by iwn1 with SMTP id 1so2038981iwn.0 for ; Sat, 09 Oct 2010 04:09:26 -0700 (PDT) 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 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.