Skip to content

Commit 65bc2e3

Browse files
Fix parsing DONE keyword types from org_todo_keywords when separator is not set.
1 parent 2b5edda commit 65bc2e3

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

lua/orgmode/config/init.lua

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,10 +141,14 @@ function Config:get_todo_keywords()
141141
end
142142
local types = { TODO = {}, DONE = {}, ALL = {}, KEYS = {}, FAST_ACCESS = {}, has_fast_access = false }
143143
local type = 'TODO'
144-
for _, word in ipairs(self.opts.org_todo_keywords) do
144+
local has_separator = vim.tbl_contains(self.opts.org_todo_keywords, '|')
145+
for i, word in ipairs(self.opts.org_todo_keywords) do
145146
if word == '|' then
146147
type = 'DONE'
147148
else
149+
if not has_separator and i == #self.opts.org_todo_keywords then
150+
type = 'DONE'
151+
end
148152
local data = parse_todo(word)
149153
if not types.has_fast_access and data.custom_shortcut then
150154
types.has_fast_access = true
@@ -163,9 +167,6 @@ function Config:get_todo_keywords()
163167
})
164168
end
165169
end
166-
if #types.DONE == 0 then
167-
types.DONE = { table.remove(types.TODO, #types.TODO) }
168-
end
169170
self.todo_keywords = types
170171
return types
171172
end

0 commit comments

Comments
 (0)