From mboxrd@z Thu Jan 1 00:00:00 1970 From: Antti Kaihola Subject: Re: [babel] [BUG] incorrect indentation when tangling with org-src-preserve-indentation Date: Sat, 9 Oct 2010 15:22:03 +0300 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Return-path: Received: from [140.186.70.92] (port=50879 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P4YRB-0005mX-W1 for emacs-orgmode@gnu.org; Sat, 09 Oct 2010 08:22:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1P4YRB-0005hV-3S for emacs-orgmode@gnu.org; Sat, 09 Oct 2010 08:22:05 -0400 Received: from mail-iw0-f169.google.com ([209.85.214.169]:41552) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1P4YRA-0005hJ-VM for emacs-orgmode@gnu.org; Sat, 09 Oct 2010 08:22:05 -0400 Received: by iwn1 with SMTP id 1so2116278iwn.0 for ; Sat, 09 Oct 2010 05:22:04 -0700 (PDT) In-Reply-To: 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 The following changes fix the indenting problem for first lines of source code blocks but introduces extra blank lines: diff --git a/lisp/ob-python.el b/lisp/ob-python.el index c172756..27936e8 100644 --- a/lisp/ob-python.el +++ b/lisp/ob-python.el @@ -58,3 +58,3 @@ (nth 1 (or processed-params (org-babel-process-params params))) "\n") - "\n" (org-babel-trim body) "\n")) + "\n" body "\n")) diff --git a/lisp/ob-tangle.el b/lisp/ob-tangle.el index a9429c4..ba6387a 100644 --- a/lisp/ob-tangle.el +++ b/lisp/ob-tangle.el @@ -365,3 +365,3 @@ form (insert (format "%s\n" (replace-regexp-in-string - "^," "" (org-babel-trim body)))) + "^," "" body))) (when link-p 2010/10/9 Antti Kaihola : > 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.