From 1ec03d136f87aeb1bc30b58271b0e59218ca8a6a Mon Sep 17 00:00:00 2001 From: Milan Glacier Date: Sun, 8 Dec 2024 23:52:28 -0500 Subject: [PATCH] feat(log-state): align with the emacs orgmode format 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. --- lua/orgmode/org/mappings.lua | 6 +++--- tests/plenary/ui/mappings/todo_spec.lua | 16 ++++++++-------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/lua/orgmode/org/mappings.lua b/lua/orgmode/org/mappings.lua index 52fc770f5..ae63928e2 100644 --- a/lua/orgmode/org/mappings.lua +++ b/lua/orgmode/org/mappings.lua @@ -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) diff --git a/tests/plenary/ui/mappings/todo_spec.lua b/tests/plenary/ui/mappings/todo_spec.lua index 82dd175fb..2767f3605 100644 --- a/tests/plenary/ui/mappings/todo_spec.lua +++ b/tests/plenary/ui/mappings/todo_spec.lua @@ -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)) @@ -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', @@ -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', @@ -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) @@ -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) @@ -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) @@ -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)