Browse Source

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.
Nicolas Goaziou 14 years ago
parent
commit
f7ebd6bcf0
2 changed files with 17 additions and 4 deletions
  1. 9 2
      lisp/org-list.el
  2. 8 2
      lisp/org.el

+ 9 - 2
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

+ 8 - 2
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_")