Skip to content

Commit

Permalink
feat(log-state): align with the emacs orgmode format
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
milanglacier committed Dec 9, 2024
1 parent 6c39469 commit 1ec03d1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions lua/orgmode/org/mappings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -460,10 +460,10 @@ function OrgMappings:_todo_change_state(direction)

local prompt_repeat_note = config.org_log_repeat == 'note'
local log_repeat_enabled = config.org_log_repeat ~= false
local repeat_note_template = ('%s- State "%s" from "%s" [%s]'):format(
local repeat_note_template = ('%s- State %-12s from %-12s [%s]'):format(
indent,
new_todo,
old_state,
[["]] .. new_todo .. [["]],
[["]] .. old_state .. [["]],
Date.now():to_string()
)
local repeat_note_title = ('Insert note for state change from "%s" to "%s"'):format(old_state, new_todo)
Expand Down
16 changes: 8 additions & 8 deletions tests/plenary/ui/mappings/todo_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ describe('Todo mappings', function()
' :PROPERTIES:',
' :LAST_REPEAT: [' .. now:to_string() .. ']',
' :END:',
' - State "DONE" from "TODO" [' .. now:to_string() .. ']',
' - State "DONE" from "TODO" [' .. now:to_string() .. ']',
'',
'* TODO Another task',
}, vim.api.nvim_buf_get_lines(0, 2, 10, false))
Expand Down Expand Up @@ -137,7 +137,7 @@ describe('Todo mappings', function()
' :LAST_REPEAT: [' .. now:to_string() .. ']',
' :END:',
' :LOGBOOK:',
' - State "DONE" from "TODO" [' .. now:to_string() .. ']',
' - State "DONE" from "TODO" [' .. now:to_string() .. ']',
' :END:',
'',
'* TODO Another task',
Expand All @@ -154,8 +154,8 @@ describe('Todo mappings', function()
' :LAST_REPEAT: [' .. now:to_string() .. ']',
' :END:',
' :LOGBOOK:',
' - State "DONE" from "TODO" [' .. now:to_string() .. ']',
' - State "DONE" from "TODO" [' .. now:to_string() .. ']',
' - State "DONE" from "TODO" [' .. now:to_string() .. ']',
' - State "DONE" from "TODO" [' .. now:to_string() .. ']',
' :END:',
'',
'* TODO Another task',
Expand Down Expand Up @@ -282,7 +282,7 @@ describe('Todo mappings', function()
' :LAST_REPEAT: [' .. now:to_string() .. ']',
' :END:',
' :LOGBOOK:',
' - State "DONE" from "PHONECALL" [' .. now:to_string() .. ']',
' - State "DONE" from "PHONECALL" [' .. now:to_string() .. ']',
' :END:',
}, vim.api.nvim_buf_get_lines(0, 2, 11, false))
end)
Expand Down Expand Up @@ -318,7 +318,7 @@ describe('Todo mappings', function()
' :LAST_REPEAT: [' .. now:to_string() .. ']',
' :END:',
' :LOGBOOK:',
' - State "DONE" from "MEET" [' .. now:to_string() .. ']',
' - State "DONE" from "MEET" [' .. now:to_string() .. ']',
' :END:',
}, vim.api.nvim_buf_get_lines(0, 2, 10, false))
end)
Expand Down Expand Up @@ -361,7 +361,7 @@ describe('Todo mappings', function()
' :LAST_REPEAT: [' .. now:to_string() .. ']',
' :END:',
' :LOGBOOK:',
' - State "DONE" from "MEET" [' .. now:to_string() .. ']',
' - State "DONE" from "MEET" [' .. now:to_string() .. ']',
' :END:',
}, vim.api.nvim_buf_get_lines(0, 2, 11, false))
end)
Expand Down Expand Up @@ -404,7 +404,7 @@ describe('Todo mappings', function()
' :LAST_REPEAT: [' .. now:to_string() .. ']',
' :END:',
' :LOGBOOK:',
' - State "DONE" from "MEET" [' .. now:to_string() .. ']',
' - State "DONE" from "MEET" [' .. now:to_string() .. ']',
' :END:',
}, vim.api.nvim_buf_get_lines(0, 2, 11, false))
end)
Expand Down

0 comments on commit 1ec03d1

Please sign in to comment.