diff options
author | Nicolas Goaziou <n.goaziou@gmail.com> | 2011-01-23 12:06:32 +0100 |
---|---|---|
committer | Nicolas Goaziou <n.goaziou@gmail.com> | 2011-02-18 12:45:11 +0100 |
commit | 89c066a10cee93b80998b64a64911e71c3f5ddf7 (patch) | |
tree | 25acbca15170ce880eed1136fd90fe7cc8022b09 | |
parent | dcf23c416f8c132e716a718357fd398dc93bc09c (diff) | |
download | org-mode-89c066a10cee93b80998b64a64911e71c3f5ddf7.tar.gz |
Newline-and-indent respects list structure
* lisp/org.el (org-return): when called from inside an item with the
indent flag, function should keep text moved inside the item. This
allows to use C-j to separate lines in an item: cursor won't go back
to column 0.
-rw-r--r-- | lisp/org.el | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lisp/org.el b/lisp/org.el index 2e6bd3b..2b2501a 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -17490,6 +17490,18 @@ See the individual commands for more information." ((org-at-table-p) (org-table-justify-field-maybe) (call-interactively 'org-table-next-row)) + ;; when `newline-and-indent' is called within a list, make sure + ;; text moved stays inside the item. + ((and (org-in-item-p) indent) + (if (and (org-at-item-p) (>= (point) (match-end 0))) + (progn + (newline) + (org-indent-line-to (length (match-string 0)))) + (let ((ind (org-get-indentation))) + (newline) + (if (org-looking-back org-list-end-re) + (org-indent-line-function) + (org-indent-line-to ind))))) ((and org-return-follows-link (eq (get-text-property (point) 'face) 'org-link)) (call-interactively 'org-open-at-point)) |