[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: |
Tue, 21 May 2013 10:25:07 +0200 |
User-agent: |
Gnus/5.130004 (Ma Gnus v0.4) Emacs/24.2 (windows-nt) |
Hi,
May I bump up this thread?
Thanks,
Francesco
"Francesco Pizzolante" wrote:
> Hi All,
>
> I'd like to let you know about issues I'm having while trying to put source
> code blocks within lists.
>
> Here's my example and how I indent it:
>
> * First situation
>
> - My first bullet
>
> We need to do this:
>
> #+begin_src emacs-lisp
> (message "this is a string")
> (defun x()
> "Doc..."
> (interactive)
> (message "hello"))
> #+end_src
>
> - My second bullet
>
> #+begin_src emacs-lisp
> "test"
> #+end_src
>
> #+results:
> : test
>
> - Sub-point of second bullet
>
> We need to do this as well:
>
> #+begin_src emacs-lisp
> (sort)
> #+end_src
>
> This way if indenting code blocks has the following advantages:
>
> - it looks nice;
>
> - thanks to the indentation, you directly know at which list level the code
> block belongs to;
>
> - you can easily use Emacs commands (like `C-x TAB') on regions or Org
> promote/demote commands on items or subtrees to edit and reorganize your
> text: "relative" indentation is preserved in all cases.
>
> But, I have 2 issues with it:
>
> - when using `C-c '' (`org-edit-special'), I see spaces before my code, while
> I would expect to see my code starting at column 0 in the edit buffer (the
> "reference" column for the "margin" being, here, the column with the '#'
> from '#+begin_src';
>
> - when exporting, the spaces from column 0 to the start of my code are also
> exported, while I would again expect these spaces to be ignored for the
> export.
>
> The only way I found to fix these issues is to edit my text like this (and
> make any code to start in column 0):
>
> - My first bullet
>
> We need to do this:
>
> #+begin_src emacs-lisp
> (message "this is a string")
> (defun x()
> "Doc..."
> (interactive)
> (message "hello"))
> #+end_src
>
> - My second bullet
>
> #+begin_src emacs-lisp
> "test"
> #+end_src
>
> #+results:
> : test
>
> - Sub-point of second bullet
>
> We need to do this as well:
>
> #+begin_src emacs-lisp
> (sort)
> #+end_src
>
> But:
>
> - as you can see, the text does not look anymore as nice as in the previous
> example;
>
> - I'm no longer able to edit and reorganize the text using Emacs `C-x TAB'
> command. That command becomes "forbidden" as it can't correctly respect the
> indentation requirements:
>
> + starting at column 0 for code;
>
> + relative for list items (depending on their depth);
>
> - even Org promote/demote commands are buggy in this case: as a simple
> example, when I try to promote (with M-Shift-Left) the last point "Sub-point
> of second bullet" I get an error ("indent-line-to: Wrong type argument:
> wholenump, -2" ) and the following half-baked result:
>
> - Sub-point of second bullet
>
> We need to do this:
>
> #+begin_src emacs-lisp
> (sort)
> #+end_src
>
> The "#+end_src" line got misaligned.
>
> So, my question is the following: is there a way to edit my text as shown in
> the first example and edit/export it ignoring the "margin" spaces?
>
> Any help is welcome.
>
> Thanks a lot,
> Francesco
- [O] Indentation of code blocks within lists, Francesco Pizzolante, 2013/05/13
- Re: [O] Indentation of code blocks within lists,
Francesco Pizzolante <=
- Re: [O] Indentation of code blocks within lists, Sebastien Vauban, 2013/05/23
- Re: [O] Indentation of code blocks within lists, Nicolas Goaziou, 2013/05/24
- Re: [O] Indentation of code blocks within lists, Francesco Pizzolante, 2013/05/24
- Re: [O] Indentation of code blocks within lists, Sebastien Vauban, 2013/05/24
- Re: [O] Indentation of code blocks within lists, Nicolas Goaziou, 2013/05/25
- Re: [O] Indentation of code blocks within lists, Francesco Pizzolante, 2013/05/27
- Re: [O] Indentation of code blocks within lists, Sebastien Vauban, 2013/05/27
- Re: [O] Indentation of code blocks within lists, Sebastien Vauban, 2013/05/27