Bugfix: Make sure TODO keyword is inserted at the right position

Wanrong Lin writes:

>  Suppose I have an org file with following lines:
>
>  * Test1
>  Test2
>
>  Now if I put the cursor at the beginning of the "Test2" line and
>  press "M-S-RET"  (Alt-Shift-Return on my machine), I got this:
>
>  * Test1
>  * Test2TODO
>
>  The "TODO" keyword was inserted at the end instead of the
>  beginning of the task text. This seems a bug to me.

Yes, this is a bug that occurs in the special case when the
heading stars are inserted in front of an existing line.  The
commit adds code to make sure the correct position is used.
This commit is contained in:
Carsten Dominik 2009-03-10 17:27:10 +01:00
parent 9382d960ca
commit a2a7550591
2 changed files with 6 additions and 1 deletions

View File

@ -1,5 +1,8 @@
2009-03-10 Carsten Dominik <carsten.dominik@gmail.com>
* org.el (org-insert-todo-heading): Make sure the keyword is
inserted at the correct position.
* org-publish.el (org-publish-project-alist)
(org-publish-projects, org-publish-org-index): Change default anme
for the index of file names to "sitemap.org".

View File

@ -5283,7 +5283,9 @@ state (TODO by default). Also with prefix arg, force first state."
(run-hook-with-args-until-success
'org-todo-get-default-hook new-mark-x nil)
new-mark-x)))
(insert new-mark " "))
(beginning-of-line 1)
(and (looking-at "\\*+ ") (goto-char (match-end 0))
(insert new-mark " ")))
(when org-provide-todo-statistics
(org-update-parent-todo-statistics))))