Replies: 2 comments 1 reply
-
Can you try modifying your snippet to this? vim.api.nvim_create_autocmd('BufWritePost', {
pattern = '*.org',
callback = function(ev)
if vim.b[ev.buffer].org_tmp_edit_window then
return
end
local bufnr = vim.fn.bufnr('orgagenda') or -1
if bufnr > -1 then
require('orgmode').agenda:redo()
end
end
}) This should prevent the temporary buffer to trigger the redo, but when you edit a normal org file, it should work. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Yes! Wow, the magician strikes again! :) |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi all,
I'm not filing this as an "official" issue, because it's a bug that only happens with a custom orgmode setup. Specifically, I'm using the following snippet suggested by @kristijanhusak in #656 to redo the agenda every time an org file is written:
The issue is when I am in the agenda buffer and I re-schedule a task from there. In fact, it only happens if I re-schedule at least two things. I figured out that a race condition is happening: the above snippet causes a re-do of the agenda, but when re-scheduling from the agenda buffer, orgmode automatically causes a re-do as well, causing the agenda to be re-done twice. The following error occurs:
I believe what's happening is that the one agenda re-doing makes the agenda buffer modifiable, then the other re-doing tries to make it modifiabe (but it already is), and then the first re-doing makes it unmodifiable again, causing the second re-do to throw an error. Does anyone have an idea how to go about fixing this?
P.S.: Since there is clearly a lot of interest in having the agenda auto-update when org files are changed (see all the participants in #656), I think maybe we could think about robustly supporting agenda re-doing by default or at least as a configurable option?
Beta Was this translation helpful? Give feedback.
All reactions