orgmode
orgmode copied to clipboard
fix: schedule write action for edit-special.
The action of writing to the original buffer need to be schedule wrapped. otherwise, on the first time writing the change to the org buffer, it will issue an "E315: ml_get: invalid lnum: 1" error. I guess this might be some race conditions? Anyway schedule this call makes this error disappear.
I see some tests are failed. However, I have no idea why scheduling this action would fail so many tests? In my use case, it works well. I think this might because vim.schedule makes the write action async and the tests are assumed it is synchronized?
Can you give me the steps to reproduce the issue? I can't reproduce it so can't really help.
This is a problem that's are really hard to reproduce.
The same config can yield the "E315: ml_get: invalid lnum: 1" on macos, but not on linux. And I cannot create a minimal config either. May need to spend more time on this to find what's triggering the issue.
Another interesting thing is that: :h E315 shows that"
*E315* >
ml_get: invalid lnum: {number}
This is an internal Vim error. Please try to find out how it can be
reproduced, and submit a |bug-report|.
So this might point to a C source code error.
I was encountering this error on task creation until I set org_agenda_files and org_default_notes_file. I think it was because this plugin was trying to create refile.org in a location it could not. I was also using noice.nvim and, for some reason, it just spawns an empty confirm window when I tried to make a new agenda task. Confirming/closing the empty window showed this error, broke noice to no longer work for the rest of the session, and failed to create the task.
It was not until I set these two variables the error went away.
Just thought I should comment here if someone else finds this error, too!
I don’ t use noice.
Add some context to see if I can help, but the sad thing is that I cannot reproduce the problem…
I encounter this problem when trying to use org-edit-special to edit a SQL code block, and treesitter-sql grammar is installed, and I use efm language server for SQL (to use sql-formatter).
If I am editing another code block (e.g. not SQL), then I do not encounter that error. And if I don’t use efm with SQL, the problem disapperas too. There are too many variables to control and I cannot reproduce.