Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit f8c0fd3

Browse files
authored
feat(log-state): align with the emacs orgmode format (#837)
In emacs orgmode, the org-log-note-headings is defined as follows: (state . "State %-12s from %-12S %t") This commit changes the log state format so that it is aligned with emacs orgmode.
1 parent 3f37829 commit f8c0fd3

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

lua/orgmode/org/mappings.lua

+3-3
Original file line numberDiff line numberDiff line change
@@ -460,10 +460,10 @@ function OrgMappings:_todo_change_state(direction)
460460

461461
local prompt_repeat_note = config.org_log_repeat == 'note'
462462
local log_repeat_enabled = config.org_log_repeat ~= false
463-
local repeat_note_template = ('%s- State "%s" from "%s" [%s]'):format(
463+
local repeat_note_template = ('%s- State %-12s from %-12s [%s]'):format(
464464
indent,
465-
new_todo,
466-
old_state,
465+
[["]] .. new_todo .. [["]],
466+
[["]] .. old_state .. [["]],
467467
Date.now():to_string()
468468
)
469469
local repeat_note_title = ('Insert note for state change from "%s" to "%s"'):format(old_state, new_todo)

tests/plenary/ui/mappings/todo_spec.lua

+8-8
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ describe('Todo mappings', function()
6969
' :PROPERTIES:',
7070
' :LAST_REPEAT: [' .. now:to_string() .. ']',
7171
' :END:',
72-
' - State "DONE" from "TODO" [' .. now:to_string() .. ']',
72+
' - State "DONE" from "TODO" [' .. now:to_string() .. ']',
7373
'',
7474
'* TODO Another task',
7575
}, vim.api.nvim_buf_get_lines(0, 2, 10, false))
@@ -137,7 +137,7 @@ describe('Todo mappings', function()
137137
' :LAST_REPEAT: [' .. now:to_string() .. ']',
138138
' :END:',
139139
' :LOGBOOK:',
140-
' - State "DONE" from "TODO" [' .. now:to_string() .. ']',
140+
' - State "DONE" from "TODO" [' .. now:to_string() .. ']',
141141
' :END:',
142142
'',
143143
'* TODO Another task',
@@ -154,8 +154,8 @@ describe('Todo mappings', function()
154154
' :LAST_REPEAT: [' .. now:to_string() .. ']',
155155
' :END:',
156156
' :LOGBOOK:',
157-
' - State "DONE" from "TODO" [' .. now:to_string() .. ']',
158-
' - State "DONE" from "TODO" [' .. now:to_string() .. ']',
157+
' - State "DONE" from "TODO" [' .. now:to_string() .. ']',
158+
' - State "DONE" from "TODO" [' .. now:to_string() .. ']',
159159
' :END:',
160160
'',
161161
'* TODO Another task',
@@ -282,7 +282,7 @@ describe('Todo mappings', function()
282282
' :LAST_REPEAT: [' .. now:to_string() .. ']',
283283
' :END:',
284284
' :LOGBOOK:',
285-
' - State "DONE" from "PHONECALL" [' .. now:to_string() .. ']',
285+
' - State "DONE" from "PHONECALL" [' .. now:to_string() .. ']',
286286
' :END:',
287287
}, vim.api.nvim_buf_get_lines(0, 2, 11, false))
288288
end)
@@ -318,7 +318,7 @@ describe('Todo mappings', function()
318318
' :LAST_REPEAT: [' .. now:to_string() .. ']',
319319
' :END:',
320320
' :LOGBOOK:',
321-
' - State "DONE" from "MEET" [' .. now:to_string() .. ']',
321+
' - State "DONE" from "MEET" [' .. now:to_string() .. ']',
322322
' :END:',
323323
}, vim.api.nvim_buf_get_lines(0, 2, 10, false))
324324
end)
@@ -361,7 +361,7 @@ describe('Todo mappings', function()
361361
' :LAST_REPEAT: [' .. now:to_string() .. ']',
362362
' :END:',
363363
' :LOGBOOK:',
364-
' - State "DONE" from "MEET" [' .. now:to_string() .. ']',
364+
' - State "DONE" from "MEET" [' .. now:to_string() .. ']',
365365
' :END:',
366366
}, vim.api.nvim_buf_get_lines(0, 2, 11, false))
367367
end)
@@ -404,7 +404,7 @@ describe('Todo mappings', function()
404404
' :LAST_REPEAT: [' .. now:to_string() .. ']',
405405
' :END:',
406406
' :LOGBOOK:',
407-
' - State "DONE" from "MEET" [' .. now:to_string() .. ']',
407+
' - State "DONE" from "MEET" [' .. now:to_string() .. ']',
408408
' :END:',
409409
}, vim.api.nvim_buf_get_lines(0, 2, 11, false))
410410
end)

0 commit comments

Comments
 (0)