Skip to content

Commit c480161

Browse files
fix(agenda): correctly re-render agenda on repeated todo state changed
In Emacs Orgmode, toggling todo state of a headline in agenda leaves the headline visible in agenda until the next re-render. We do the same, but only for headlines that do not add new lines to the file content. If it adds new lines, we need to re-read the file and re-render the agenda because the locations of other headlines can be stale and invalid. We had this fix in place for some time now, but it got moved in some of the refactorings and check was failing.
1 parent dc9864f commit c480161

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

lua/orgmode/agenda/init.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -578,15 +578,15 @@ function Agenda:_remote_edit(opts)
578578
if not headline then
579579
return
580580
end
581+
local old_range = headline:get_range()
582+
581583
local update = headline.file:update(function(_)
582584
vim.fn.cursor({ headline:get_range().start_line, 1 })
583585
return Promise.resolve(require('orgmode').action(action)):next(function()
584586
return self.files:get_closest_headline_or_nil()
585587
end)
586588
end)
587589

588-
local old_range = headline:get_range()
589-
590590
update:next(function(updated_headline)
591591
---@cast updated_headline OrgHeadline
592592
if opts.redo then

0 commit comments

Comments
 (0)