emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Indentation of code blocks within lists


From: Francesco Pizzolante
Subject: Re: [O] Indentation of code blocks within lists
Date: Fri, 24 May 2013 16:33:37 +0200
User-agent: Gnus/5.130004 (Ma Gnus v0.4) Emacs/24.2 (windows-nt)


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

[Prev in Thread] Current Thread [Next in Thread]