Hi,

Thanks for you reply. I cannot understand the design of `org-src-preserve-indentation`. 

Setting it to `nil` cause what described in my previous mail. 
Setting it to `t` lose the leading two spaces indentation/alignment in the origin org buffer. 

If it is `nil`, why inserting 2 leading spaces to the code in the org buffer except the line containing only spaces?

How can I get 

#+BEGIN_SRC python
    a = 1
    b = 2
    for i in range(10):
        # 6 spaces before '#'
#+END_SRC

after exit `org-edit-special` ?

Best regards,
Jiajian Huang

On Sat, Jan 7, 2017 at 12:31 AM, Nicolas Goaziou <mail@nicolasgoaziou.fr> wrote:
Hello,

Jiajian Huang <ispinfx@gmail.com> writes:

> Reproduce steps:
>
> Launch emacs by `emacs -Q`, eval the following snippet(assumed org 9.x
> is installed via elpa)
>
>     (package-initialize)
>     (require 'org)
>
> open a org buffer, input the source by <s and type `python`
>
> #+BEGIN_SRC python
>
> #+END_SRC
>
> use C-c ' to edit the block and input
>
>     for i in range(10):      # input this line and <enter>
>         # there are 4 spaces before the '#' now
>
> use C-c ' to close the source block buffer and back to org-mode, we can
> see the first line of the block is indented 2 spaces by org while the blank
> line
> isn't.

This is not a bug. See `org-src-preserve-indentation'.

Regards,

--
Nicolas Goaziou