Skip to content

Commit 47ba087

Browse files
committed
fix: allow the user to set the default todo state
As the order of the org_todo_keywords define the order of the todo in the agenda, a user may want to have a default TODO state different than the first one in the org_todo_keywords list
1 parent 6bb6fec commit 47ba087

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

lua/orgmode/config/defaults.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ local DefaultConfig = {
77
org_agenda_files = '',
88
org_default_notes_file = '',
99
org_todo_keywords = { 'TODO', '|', 'DONE' },
10+
org_todo_default_state = nil,
1011
org_todo_repeat_to_state = nil,
1112
org_todo_keyword_faces = {},
1213
org_deadline_warning_days = 14,

lua/orgmode/org/mappings.lua

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -739,7 +739,11 @@ function OrgMappings:insert_heading_respect_content(suffix)
739739
end
740740

741741
function OrgMappings:insert_todo_heading_respect_content()
742-
return self:insert_heading_respect_content(config:get_todo_keywords():first_by_type('TODO').value .. ' ')
742+
local first_todo_keyword = config.org_todo_default_state or config:get_todo_keywords():first_by_type('TODO').value
743+
if not first_todo_keyword then
744+
error('No default TODO keyword found')
745+
end
746+
return self:insert_heading_respect_content(first_todo_keyword .. ' ')
743747
end
744748

745749
function OrgMappings:insert_todo_heading()

0 commit comments

Comments
 (0)