diff --git a/local/lib/org-x/org-x.el b/local/lib/org-x/org-x.el index 08ca3b8..03b312e 100644 --- a/local/lib/org-x/org-x.el +++ b/local/lib/org-x/org-x.el @@ -293,11 +293,16 @@ the current time." ;; helper function +(defun org-x--forward-stars () + "Move point forward until a star is not encountered." + (forward-char 1) + (while (= ?* (following-char)) + (forward-char 1))) + (defun org-x--headline-get-level () "Return level of the current headline. Assumes point is at the start of a headline." (save-excursion - (forward-char 1) (while (= ?* (following-char)) (forward-char 1)) (current-column))) @@ -328,9 +333,11 @@ to the children one level down from the current headline." (<= target-level cur-level) (= 0 (forward-line 1))) (when (= ?* (following-char)) - (setq cur-level (org-x--headline-get-level)) - (when (= cur-level target-level) - ,@body)))))) + (org-x--forward-stars) + (when (= 32 (following-char)) + (setq cur-level (current-column)) + (when (= cur-level target-level) + ,@body))))))) (defun org-x--headline-has-children (test-fun) "Return t if heading has a child for whom TEST-FUN is t. diff --git a/local/lib/org-x/test/org-x-test.el b/local/lib/org-x/test/org-x-test.el index dac56c4..1c1e89a 100644 --- a/local/lib/org-x/test/org-x-test.el +++ b/local/lib/org-x/test/org-x-test.el @@ -238,9 +238,12 @@ Forms are denoted like %(FORM)%." "CLOSED: %(org-x-gen-ts (- (* (1+ org-x-archive-delay) 24 60 60)))%") => :archivable + ;; the bold thingy should make this choke unless we specifically detect stars + ;; with a space after them "done-incomplete (subtask TODO)" ("* DONE project" "CLOSED: %(org-x-gen-ts (- (* (1+ org-x-archive-delay) 24 60 60)))%" + "*bold thingy*" "** TODO task 1") => :done-incomplete