diff options
author | Nicolas Goaziou <n.goaziou@gmail.com> | 2011-01-26 21:36:39 +0100 |
---|---|---|
committer | Nicolas Goaziou <n.goaziou@gmail.com> | 2011-02-18 12:45:12 +0100 |
commit | f7ebd6bcf0ab741d0cd1c840a3fb7e7b21e84d41 (patch) | |
tree | 9c7bde712670232a3c596a2493102636ba2dab24 | |
parent | 349196def43d45e4789a4504bdf057a6a19817bf (diff) | |
download | org-mode-f7ebd6bcf0ab741d0cd1c840a3fb7e7b21e84d41.tar.gz |
org-list: ignore inline tasks when shifting an item, and fix indentation
* lisp/org-list.el (org-list-struct-apply-struct): inline tasks along
with their content must stay at column 0 even if the item is gaining
indentation. Moreover, fix indentation of text in an inline task,
now it can be in such a task within a list.
-rw-r--r-- | lisp/org-list.el | 11 | ||||
-rw-r--r-- | lisp/org.el | 10 |
2 files changed, 17 insertions, 4 deletions
diff --git a/lisp/org-list.el b/lisp/org-list.el index a6f7ff7..f5e04fe 100644 --- a/lisp/org-list.el +++ b/lisp/org-list.el @@ -1586,6 +1586,8 @@ have changed. Initial position of cursor is restored after the changes." (let* ((pos (copy-marker (point))) + (inlinetask-re (and (featurep 'org-inlinetask) + (org-inlinetask-outline-regexp))) (item-re (org-item-re)) (shift-body-ind (function @@ -1598,9 +1600,14 @@ Initial position of cursor is restored after the changes." (while (or (> (point) beg) (and (= (point) beg) (not (looking-at item-re)))) - (when (org-looking-at-p "^[ \t]*\\S-") + (cond + ;; Skip inline tasks + ((and inlinetask-re (looking-at inlinetask-re)) + (org-inlinetask-goto-beginning)) + ;; Shift only non-empty lines + ((org-looking-at-p "^[ \t]*\\S-") (let ((i (org-get-indentation))) - (org-indent-line-to (+ i delta)))) + (org-indent-line-to (+ i delta))))) (forward-line -1))))) (modify-item (function diff --git a/lisp/org.el b/lisp/org.el index 64a5979..23137ec 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -18833,6 +18833,8 @@ If point is in an inline task, mark that task instead." (org-drawer-regexp (or org-drawer-regexp "\000")) (inline-task-p (and (featurep 'org-inlinetask) (org-inlinetask-in-task-p))) + (inline-re (and inline-task-p + (org-inlinetask-outline-regexp))) column bpos bcol tpos tcol) (beginning-of-line 1) (cond @@ -18880,8 +18882,12 @@ If point is in an inline task, mark that task instead." (beginning-of-line 0) (while (and (not (bobp)) (not (looking-at org-drawer-regexp)) - ;; skip comments, verbatim, empty lines, tables, - ;; inline tasks, lists, drawers and blocks + ;; When point started in an inline task, do not move + ;; above task starting line. + (not (and inline-task-p + (looking-at inline-re))) + ;; Skip comments, verbatim, empty lines, tables, + ;; inline tasks, lists, drawers and blocks. (or (and (looking-at "[ \t]*:END:") (re-search-backward org-drawer-regexp nil t)) (and (looking-at "[ \t]*#\\+end_") |