-
-
Notifications
You must be signed in to change notification settings - Fork 168
Closed
Description
When capturing content, which contains a headline, the following error could occur.
Error executing vim.schedule lua callback: ...tributions/orgmode/lua/orgmode/utils/treesitter/init.lua:153: Invalid buffer id: -1
stack traceback:
[C]: in function 'nvim_buf_get_changedtick'
...tributions/orgmode/lua/orgmode/utils/treesitter/init.lua:153: in function 'get_matches'
...ts/nvim/contributions/orgmode/lua/orgmode/org/indent.lua:251: in function 'indentexpr'
...vim/contributions/orgmode/lua/orgmode/files/headline.lua:138: in function 'modifier'
...vim/contributions/orgmode/lua/orgmode/files/headline.lua:1031: in function '_adapt_headline_level'
.../nvim/contributions/orgmode/lua/orgmode/capture/init.lua:177: in function '_refile_from_capture_buffer'
.../nvim/contributions/orgmode/lua/orgmode/capture/init.lua:113: in function ''
vim/_editor.lua: in function ''
vim/_editor.lua: in function <vim/_editor.lua:0>
I took a look at the code and found out, that an invalid buffer is not handled properly in the virtual indent code. While refiling captured content, it can acctually happen, that the buffer is already invalid, when the code runs.
I created a PR #825.
@kristijanhusak: I also find, that the refiling code is quite long and a lot can happen, which let's refiling fail and the user is faced with a stack trace. I played around with some refactoring and more fine granular error handling. Would you appreciate such a refactoring or should we keep it as it is?
Metadata
Metadata
Assignees
Labels
No labels