From baa6f640253507b5a87bfc1333a8a049ff53407f Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Wed, 17 Oct 2018 01:24:26 -0400 Subject: [PATCH] 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 * [ ] | --- modules/lang/org/autoload/org.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/lang/org/autoload/org.el b/modules/lang/org/autoload/org.el index f4f586cb1..4a8138c69 100644 --- a/modules/lang/org/autoload/org.el +++ b/modules/lang/org/autoload/org.el @@ -203,8 +203,9 @@ wrong places)." (save-excursion (insert "\n") (if (= level 1) (insert "\n"))))) - (when (org-element-property :todo-type context) - (org-todo 'todo)))) + (when-let* ((todo-keyword (org-element-property :todo-keyword context))) + (org-todo (or (get-text-property 0 'org-todo-head todo-keyword) + 'todo))))) (t (user-error "Not a valid list, heading or table")))