FIX detect spaces after headlines

This commit is contained in:
Nathan Dwarshuis 2021-08-28 23:29:27 -04:00
parent 12a45ed767
commit db2b0f74e5
2 changed files with 14 additions and 4 deletions

View File

@ -293,11 +293,16 @@ the current time."
;; helper function ;; 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 () (defun org-x--headline-get-level ()
"Return level of the current headline. "Return level of the current headline.
Assumes point is at the start of a headline." Assumes point is at the start of a headline."
(save-excursion (save-excursion
(forward-char 1)
(while (= ?* (following-char)) (forward-char 1)) (while (= ?* (following-char)) (forward-char 1))
(current-column))) (current-column)))
@ -328,9 +333,11 @@ to the children one level down from the current headline."
(<= target-level cur-level) (<= target-level cur-level)
(= 0 (forward-line 1))) (= 0 (forward-line 1)))
(when (= ?* (following-char)) (when (= ?* (following-char))
(setq cur-level (org-x--headline-get-level)) (org-x--forward-stars)
(when (= 32 (following-char))
(setq cur-level (current-column))
(when (= cur-level target-level) (when (= cur-level target-level)
,@body)))))) ,@body)))))))
(defun org-x--headline-has-children (test-fun) (defun org-x--headline-has-children (test-fun)
"Return t if heading has a child for whom TEST-FUN is t. "Return t if heading has a child for whom TEST-FUN is t.

View File

@ -238,9 +238,12 @@ Forms are denoted like %(FORM)%."
"CLOSED: %(org-x-gen-ts (- (* (1+ org-x-archive-delay) 24 60 60)))%") "CLOSED: %(org-x-gen-ts (- (* (1+ org-x-archive-delay) 24 60 60)))%")
=> :archivable => :archivable
;; the bold thingy should make this choke unless we specifically detect stars
;; with a space after them
"done-incomplete (subtask TODO)" "done-incomplete (subtask TODO)"
("* DONE project" ("* DONE project"
"CLOSED: %(org-x-gen-ts (- (* (1+ org-x-archive-delay) 24 60 60)))%" "CLOSED: %(org-x-gen-ts (- (* (1+ org-x-archive-delay) 24 60 60)))%"
"*bold thingy*"
"** TODO task 1") "** TODO task 1")
=> :done-incomplete => :done-incomplete