Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: schedule write action for edit-special. #758

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

milanglacier
Copy link
Contributor

@milanglacier milanglacier commented Jun 14, 2024

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.

@milanglacier
Copy link
Contributor Author

milanglacier commented Jun 14, 2024

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?

@kristijanhusak
Copy link
Member

Can you give me the steps to reproduce the issue? I can't reproduce it so can't really help.

@milanglacier
Copy link
Contributor Author

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.

@xav-ie
Copy link

xav-ie commented Jun 17, 2024

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!

@milanglacier
Copy link
Contributor Author

milanglacier commented Jun 17, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants