org-capture: Better indentation when creating a new list
commit587280ea68e45f542634c05737dbc0a5540a1b88
authorAndrew Burgess <andrew.burgess@embecosm.com>
Tue, 7 Oct 2014 15:59:23 +0000 (7 16:59 +0100)
committerNicolas Goaziou <mail@nicolasgoaziou.fr>
Tue, 14 Oct 2014 20:24:30 +0000 (14 22:24 +0200)
treede2f9f47625ca53a94bff955601c77ec8c44dd69
parentbc342011e933c6abb19a6edc0e8ce50c3d0b0dbf
org-capture: Better indentation when creating a new list

lisp/org-capture.el (org-capture-place-item): When starting a new list
use org-indent-line to establish the correct indentation rather than
just using 0.

Creating an entry in org-capture-templates of type item adds entries
into a list, however, currently, if the list is empty then the first
list item will always be indented to depth 0 (so hard on the left),
which looks like this:

  * Top Level
  ** Second Level
  - item #1
  - item #2
  - item #3

This is fine if org-adapt-indentation is nil, however, with the
default value of t lists should be indented more like this:

  * Top Level
  ** Second Level
     - item #1
     - item #2
     - item #3

The patch below changes org-capture-place-item so that, when starting
a new list, the items are indented as above.

Care is taken to preserve two features of the existing behaviour,
first, when adding to an existing list, new items are indented to
match the items already in the list.  And secondly, when there is some
introductory text before the list new items are inserted after the
text, like this:

  * Top Level
  ** Second Level
     This is some introductory text:
     - item #1
     - item #2
     - item #3

TINYCHANGE
lisp/org-capture.el