diff options
author | Allen Li <vianchielfaura@gmail.com> | 2017-10-18 22:48:16 +0200 |
---|---|---|
committer | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2017-10-18 22:48:16 +0200 |
commit | 8c5c030c646941d057ef76e7845e3503d3fdf3a8 (patch) | |
tree | 6865b5010bed4e5484d80ffb8ba51d779839cfdc | |
parent | 90d283f1894d473449a7f23fd09e3a264ed9c15d (diff) | |
download | org-mode-8c5c030c646941d057ef76e7845e3503d3fdf3a8.tar.gz |
Fix `org-insert-todo-heading'
* lisp/org.el (org-insert-todo-heading): Insert TODO keyword relative
to the original headline, not to the headline above.
* testing/lisp/test-org.el (test-org/insert-todo-heading-respect-content):
Add test.
-rw-r--r-- | lisp/org.el | 3 | ||||
-rw-r--r-- | testing/lisp/test-org.el | 7 |
2 files changed, 8 insertions, 2 deletions
diff --git a/lisp/org.el b/lisp/org.el index abb173b..68e90ff 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -7947,8 +7947,7 @@ unchecked check box." (org-insert-heading (or (and (equal arg '(16)) '(16)) force-heading)) (save-excursion - (org-back-to-heading) - (outline-previous-heading) + (org-forward-heading-same-level -1) (let ((case-fold-search nil)) (looking-at org-todo-line-regexp))) (let* ((new-mark-x (if (or (equal arg '(4)) diff --git a/testing/lisp/test-org.el b/testing/lisp/test-org.el index 3bc8c7b..d067c04 100644 --- a/testing/lisp/test-org.el +++ b/testing/lisp/test-org.el @@ -1416,6 +1416,13 @@ (org-test-with-temp-text "* H\n- an item\n- another one" (search-forward "an ") (org-insert-todo-heading-respect-content) + (buffer-substring-no-properties (line-beginning-position) (point-max))))) + ;; Use the same TODO keyword as current heading. + (should + (equal + "* TODO \n" + (org-test-with-temp-text "* TODO\n** WAITING\n" + (org-insert-todo-heading-respect-content) (buffer-substring-no-properties (line-beginning-position) (point-max)))))) (ert-deftest test-org/clone-with-time-shift () |