2

In org-mode, is there a way to insert an item after all of its children? Instead of the default behavior that inserts an item after the current item but before its children?

Example

Say I am in this list with the point at X.

  - A X
    - 1
    - 2
  - B
  - C

If I run the command org-insert-item (interpreted from M-return), then it produces the following.

  - A
  - X
    - 1
    - 2
  - B
  - C

What I would like to produce is the following.

  - A
    - 1
    - 2
  - X
  - B
  - C

This seems very similar to org-insert-heading-respect-content. I couldn't find anything like org-insert-item-respect-content, though.

1 Answer 1

2

org-M-RET-may-split-line is the variable that will give the behavior you're looking for.

Documentation
Non-nil means M-RET will split the line at the cursor position.

When nil, it will go to the end of the line before making a
new line.
You may also set this option in a different way for different
contexts.  Valid contexts are:

headline  when creating a new headline
item      when creating a new item
table     in a table field
default   the value to be used for all contexts not explicitly
          customized

Quick solution to try it out: set that to ((default))

Better solution: customize it to be nil in the item context, something like ((default . t) (item . nil)).


Yes, this ought to be cleaned up a bit to match the -respect-content convention for heading behavior. If you get the time, please submit it to the org-mode issue list.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.