From mboxrd@z Thu Jan 1 00:00:00 1970 From: Noah Hoffman Subject: Fwd: left padding added each time a code block is edited Date: Thu, 7 Aug 2014 16:08:34 -0700 Message-ID: References: <87r40r9b42.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:41203) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XFWno-0002hs-F8 for emacs-orgmode@gnu.org; Thu, 07 Aug 2014 19:08:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XFWnn-0007ZA-EZ for emacs-orgmode@gnu.org; Thu, 07 Aug 2014 19:08:56 -0400 Received: from mail-wi0-x22a.google.com ([2a00:1450:400c:c05::22a]:37504) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XFWnn-0007Z5-7c for emacs-orgmode@gnu.org; Thu, 07 Aug 2014 19:08:55 -0400 Received: by mail-wi0-f170.google.com with SMTP id f8so1733443wiw.1 for ; Thu, 07 Aug 2014 16:08:54 -0700 (PDT) In-Reply-To: <87r40r9b42.fsf@gmail.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode Noah Hoffman writes: Hello, > Each time I edit a code block using =C-c '= (org-edit-special) and > then return to the org-mode buffer, two spaces are added to the left > margin of the code. For example, > > #+BEGIN_SRC python > print "hello" > #+END_SRC > > becomes > > #+BEGIN_SRC python > print "hello" > #+END_SRC > > after one round-trip. This is particularly problematic for python code > blocks since leading whitespace is meaningful. > > This is behavior that has been present in org-mode for so long that I > suspect that it's not a bug - but I'd love to know how to disable it. At the risk of being critizised by this mailing-list's QC department I give you this (unedited) hint: ,----[ C-h v org-edit-src-content-indentation RET ] | org-edit-src-content-indentation is a variable defined in `org-src.el'. | Its value is 2 | | Documentation: | Indentation for the content of a source code block. | This should be the number of spaces added to the indentation of the #+begin | line in order to compute the indentation of the block content after | editing it with M-x org-edit-src-code. Has no effect if | `org-src-preserve-indentation' is non-nil. `---- -- cheers, Thorsten Thanks a lot, Thorsten - that's perfect. If I may provide some suggestions/feedback to the list: 1. A more sensible value for this variable in python code blocks in particular would be 0 if language-specific defaults are possible (though I'll be setting my default to 0 for all languages). 2. While this variable is very well documented, it isn't very discoverable via apropos or the html manual (at least, I wasn't able to discover it). Perhaps a reference can be added to this variable in the docstring for org-edit-src-code? Best, Noah