Skip to content

Commit 605a50a

Browse files
fix: adding archive timestamps when headline content ends with empty line. Closes #355
1 parent 220f7f0 commit 605a50a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lua/orgmode/org/mappings.lua

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,10 @@ function OrgMappings:archive()
5050
archive_location,
5151
vim.schedule_wrap(function()
5252
Files.update_file(archive_location, function(archive_file)
53-
local last_item = archive_file:get_closest_headline(vim.fn.line('$'))
53+
-- Jump to last headline in archive file
54+
vim.cmd('normal! G')
55+
vim.fn.search([[^\*\+\s\+]], 'b')
56+
local last_item = archive_file:get_closest_headline()
5457
if not last_item then
5558
return
5659
end

0 commit comments

Comments
 (0)