lang/org: use correct todo keyword on M-RET

Previously, new TODO headers created with M-RET or M-S-RET (bound to
+org/insert-item) would use the first TODO keyword in org-todo-keywords
in the new header. This wouldn't necessarily match the previous header.
e.g.

* [ ] Item 1
* TODO |

This fix ensures new headers will preserve the correct header, even if
the previous one is in a DONE state.

* [ ] Item 1
* [ ] |
This commit is contained in:
Henrik Lissner 2018-10-17 01:24:26 -04:00
parent 9bb5b4ef72
commit baa6f64025
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -203,8 +203,9 @@ wrong places)."
(save-excursion (save-excursion
(insert "\n") (insert "\n")
(if (= level 1) (insert "\n"))))) (if (= level 1) (insert "\n")))))
(when (org-element-property :todo-type context) (when-let* ((todo-keyword (org-element-property :todo-keyword context)))
(org-todo 'todo)))) (org-todo (or (get-text-property 0 'org-todo-head todo-keyword)
'todo)))))
(t (user-error "Not a valid list, heading or table"))) (t (user-error "Not a valid list, heading or table")))