Hi Nicolas,

> I also cannot reproduce OP's problem. It may be related to
> `org-src-preserve-indentation' value.

Thanks for your answer.

I checked the `org-src-preserve-indentation' variable and saw that it was non
`nil'.

Setting this variable to `nil' fixes the demonstrated issue. But, even then, I
still have an indentation problem.

In the following example (with `org-src-preserve-indentation' set to `nil'):

- in the first headline, I have a code block in a list which is correctly
  exported ignoring the spaces due to the indentation of the Org list;

- in the second headline, I have the same source code but it is split in
  several code blocks in order to better document it. The last 2 blocks are
  not correctly exported as *all spaces before the code* (even those I
  manually added) are ignored.

--8<---------------cut here---------------start------------->8---
* First situation

My list:

- Example which works

  #+begin_src emacs-lisp
  (if complex-condition
      then-block
    else-block)
  #+end_src

* Second situation

My list:

- Example which does not work anymore

  #+begin_src emacs-lisp
  (if complex-condition
  #+end_src

  The "then" block does this:

  #+begin_src emacs-lisp
      then-block
  #+end_src

  The else-block does that:

  #+begin_src emacs-lisp
    else-block)
  #+end_src
--8<---------------cut here---------------end--------------->8---

I think that only the spaces due to the Org indentation (here the number of
spaces before the `#' which delimits the source block, hence 2 spaces) should
be ignored.

IOW, just the "margin" should be removed, and the margin is (IMO) defined as
the spaces from column 0 up to the `#' character.

Thanks for your help.

Regards,
 Francesco



Reply via email to