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

Errors When Creating Nodes: Trying to Delete Buffer that is in use #73

Open
cat-phish opened this issue Jan 13, 2025 · 4 comments
Open
Labels
nvim-orgmode Issue is related to the nvim-orgmode plugin question Further information is requested

Comments

@cat-phish
Copy link

cat-phish commented Jan 13, 2025

I am running into errors when trying to create a node. For one thing it's not appearing to generate an ID at all. This is what's created in the scratch buffer with nf

:PROPERTIES:
:ID: 
:ROAM_ORIGIN: 
:END:
#+TITLE: test

test test

And then it seems according to your video it's supposed to switch to that buffer on save. But on save it only writes the tmp file, and if I try to quit or delete the windows it gives me an error for trying to delete a buffer in use.

Heres from trying to :q out of the scratch buffer

10:52:15 PM msg_show "/tmp/nvim.jordan/M8ZrZb/0.org" 
10:52:15 PM msg_show "/tmp/nvim.jordan/M8ZrZb/0.org" [New] 7L, 65B
10:52:16 PM msg_show "/tmp/nvim.jordan/M8ZrZb/0.org" 
10:52:16 PM msg_show "/tmp/nvim.jordan/M8ZrZb/0.org" 7L, 65B
10:51:59 PM msg_showcmd :
10:52:20 PM msg_show   wq "/tmp/nvim.jordan/M8ZrZb/0.org" 
10:52:20 PM msg_show   wq "/tmp/nvim.jordan/M8ZrZb/0.org" 7L, 65B
10:52:23 PM msg_show   wq Error running notification service: ...eovimPackages/start/nvim-notify/lua/notify/util/init.lua:80: Vim:E937: Attempt to delete a buffer that is in use: /tmp/nvim.jordan/M8ZrZb/0.org
10:52:23 PM msg_show   wq Error detected while processing BufWipeout Autocommands for "<buffer=40>":
10:52:23 PM msg_show   wq Error executing vim.schedule lua callback: ...re/nvim/lazy/smear-cursor.nvim/lua/smear_cursor/draw.lua:80: Vim:E937: Attempt to delete a buffer that is in use: /tmp/nvim.jordan/M8ZrZb/0.org
stack traceback:
	[C]: in function 'nvim_open_win'
	...re/nvim/lazy/smear-cursor.nvim/lua/smear_cursor/draw.lua:80: in function 'get_window'
	...re/nvim/lazy/smear-cursor.nvim/lua/smear_cursor/draw.lua:108: in function 'draw_character'
	...re/nvim/lazy/smear-cursor.nvim/lua/smear_cursor/draw.lua:151: in function 'draw_partial_block'
	...re/nvim/lazy/smear-cursor.nvim/lua/smear_cursor/draw.lua:315: in function 'draw_horizontally_shifted_sub_block'
	...re/nvim/lazy/smear-cursor.nvim/lua/smear_cursor/draw.lua:601: in function 'draw_quad'
	...im/lazy/smear-cursor.nvim/lua/smear_cursor/animation.lua:210: in function ''
	vim/_editor.lua: in function <vim/_editor.lua:0>
	[C]: in function 'wait'
	...ovimPackages/start/orgmode/lua/orgmode/utils/promise.lua:283: in function 'load_file_sync'
	...yNeovimPackages/start/orgmode/lua/orgmode/files/init.lua:189: in function 'get'
	...eovimPackages/start/orgmode/lua/orgmode/capture/init.lua:538: in function '_get_refile_vars'
	...eovimPackages/start/orgmode/lua/orgmode/capture/init.lua:97: in function <...eovimPackages/start/orgmode/lua/orgmode/capture/init.lua:95>
10:52:23 PM msg_show   wq Error running notification service: ...eovimPackages/start/nvim-notify/lua/notify/util/init.lua:80: Vim:E937: Attempt to delete a buffer that is in use: /tmp/nvim.jordan/M8ZrZb/0.org
10:52:23 PM msg_show   wq Error executing vim.schedule lua callback: ...re/nvim/lazy/smear-cursor.nvim/lua/smear_cursor/draw.lua:80: Vim:E937: Attempt to delete a buffer that is in use: /tmp/nvim.jordan/M8ZrZb/0.org
stack traceback:
	[C]: in function 'nvim_open_win'
	...re/nvim/lazy/smear-cursor.nvim/lua/smear_cursor/draw.lua:80: in function 'get_window'
	...re/nvim/lazy/smear-cursor.nvim/lua/smear_cursor/draw.lua:108: in function 'draw_character'
	...re/nvim/lazy/smear-cursor.nvim/lua/smear_cursor/draw.lua:151: in function 'draw_partial_block'
	...re/nvim/lazy/smear-cursor.nvim/lua/smear_cursor/draw.lua:315: in function 'draw_horizontally_shifted_sub_block'
	...re/nvim/lazy/smear-cursor.nvim/lua/smear_cursor/draw.lua:601: in function 'draw_quad'
	...im/lazy/smear-cursor.nvim/lua/smear_cursor/animation.lua:210: in function ''
	vim/_editor.lua: in function <vim/_editor.lua:0>
	[C]: in function 'wait'
	...ovimPackages/start/orgmode/lua/orgmode/utils/promise.lua:283: in function 'load_file_sync'
	...yNeovimPackages/start/orgmode/lua/orgmode/files/init.lua:189: in function 'get'
	...eovimPackages/start/orgmode/lua/orgmode/capture/init.lua:538: in function '_get_refile_vars'
	...eovimPackages/start/orgmode/lua/orgmode/capture/init.lua:97: in function <...eovimPackages/start/orgmode/lua/orgmode/capture/init.lua:95>
   Error  10:52:23 PM msg_show.lua_error   wq Error executing vim.schedule lua callback: ...re/nvim/lazy/smear-cursor.nvim/lua/smear_cursor/draw.lua:80: Vim:E937: Attempt to delete a buffer that is in use: /tmp/nvim.jordan/M8ZrZb/0.org
stack traceback:
	[C]: in function 'nvim_open_win'
	...re/nvim/lazy/smear-cursor.nvim/lua/smear_cursor/draw.lua:80: in function 'get_window'
	...re/nvim/lazy/smear-cursor.nvim/lua/smear_cursor/draw.lua:108: in function 'draw_character'
	...re/nvim/lazy/smear-cursor.nvim/lua/smear_cursor/draw.lua:151: in function 'draw_partial_block'
	...re/nvim/lazy/smear-cursor.nvim/lua/smear_cursor/draw.lua:315: in function 'draw_horizontally_shifted_sub_block'
	...re/nvim/lazy/smear-cursor.nvim/lua/smear_cursor/draw.lua:601: in function 'draw_quad'
	...im/lazy/smear-cursor.nvim/lua/smear_cursor/animation.lua:210: in function ''
	vim/_editor.lua: in function <vim/_editor.lua:0>
	[C]: in function 'wait'
	...ovimPackages/start/orgmode/lua/orgmode/utils/promise.lua:283: in function 'load_file_sync'
	...yNeovimPackages/start/orgmode/lua/orgmode/files/init.lua:189: in function 'get'
	...eovimPackages/start/orgmode/lua/orgmode/capture/init.lua:538: in function '_get_refile_vars'
	...eovimPackages/start/orgmode/lua/orgmode/capture/init.lua:97: in function <...eovimPackages/start/orgmode/lua/orgmode/capture/init.lua:95>
10:52:23 PM msg_show Error running notification service: ...eovimPackages/start/nvim-notify/lua/notify/util/init.lua:80: Vim:E937: Attempt to delete a buffer that is in use: /tmp/nvim.jordan/M8ZrZb/0.org
   Error  10:52:23 PM msg_show.emsg Error detected while processing BufEnter Autocommands for "*":
10:52:23 PM msg_show E315: ml_get: Invalid lnum: 1
10:52:23 PM msg_show.echomsg [orgmode] Wrote /home/jordan/.roam/20250112225208-test.org

and here is from trying to delete the window. When I try to delete the window I get a blank confirmation box through Noice that seems to have the options Y or N and when select Y this happens:

Template key: 
10:58:12 PM msg_show "/tmp/nvim.jordan/WOAIxP/0.org" 
10:58:12 PM msg_show "/tmp/nvim.jordan/WOAIxP/0.org" [New] 6L, 42B
10:57:59 PM msg_showcmd ^Wc
10:58:31 PM msg_show Error running notification service: ...eovimPackages/start/nvim-notify/lua/notify/util/init.lua:80: Vim:E937: Attempt to delete a buffer that is in use: /tmp/nvim.jordan/WOAIxP/0.org
10:58:31 PM msg_show Error running notification service: ...eovimPackages/start/nvim-notify/lua/notify/util/init.lua:80: Vim:E937: Attempt to delete a buffer that is in use: /tmp/nvim.jordan/WOAIxP/0.org
   Error  10:58:31 PM msg_show.emsg Error detected while processing BufEnter Autocommands for "*":
10:58:31 PM msg_show E315: ml_get: Invalid lnum: 1
10:58:31 PM msg_show.echomsg [orgmode] Wrote /home/jordan/.roam/20250112225811-test2.org
   Error  10:58:32 PM msg_show.lua_error Error executing vim.schedule lua callback: unhandled promise rejection: { 'vim/_editor.lua:0: nvim_exec2()..BufEnter Autocommands for "*": Vim(lua):E315: ml_get: Invalid lnum: 1' }
stack traceback:
	[C]: in function 'error'
	...ovimPackages/start/orgmode/lua/orgmode/utils/promise.lua:72: in function <...ovimPackages/start/orgmode/lua/orgmode/utils/promise.lua:70>

I've tried removing all of my UI plugins but I think there's something else going on.

I should note that it does actually write the files. But still without the ID's.

@cat-phish cat-phish changed the title Errors When Creating Nodes Errors When Creating Nodes: Trying to Delete Buffer that is in use Jan 13, 2025
@chipsenkbeil
Copy link
Owner

What happens if you put a number in for the ID before saving? It can be anything.

Feels like nvim-orgmode id generation isn't working. What version of orgmode and roam are you using?

@cat-phish
Copy link
Author

Hmm, I get this when I try to add a random number into the scratch buffer and then save and delete the window.

 
Template key: 
09:28:57 AM msg_show "/tmp/nvim.jordan/coyG02/0.org" 
09:28:57 AM msg_show "/tmp/nvim.jordan/coyG02/0.org" [New] 7L, 77B
09:28:59 AM msg_show "/tmp/nvim.jordan/coyG02/0.org" 
09:28:59 AM msg_show "/tmp/nvim.jordan/coyG02/0.org" 7L, 77B
09:29:01 AM msg_show "/tmp/nvim.jordan/coyG02/0.org" 
09:29:01 AM msg_show "/tmp/nvim.jordan/coyG02/0.org" 7L, 77B
09:28:46 AM msg_showcmd ^Wc
09:29:07 AM msg_show Error running notification service: ...eovimPackages/start/nvim-notify/lua/notify/util/init.lua:80: Vim:E937: Attempt to delete a buffer that is in use: /tmp/nvim.jordan/coyG02/0.org
   Error  09:29:08 AM msg_show.emsg Error detected while processing BufEnter Autocommands for "*":
09:29:08 AM msg_show E315: ml_get: Invalid lnum: 1
09:29:08 AM msg_show.echomsg [orgmode] Wrote /home/jordan/.roam/20250113092839-test3.org
09:29:08 AM msg_show.echomsg [org-roam] [WARN  09:29:08] org-roam/api/node.lua:500: node "2438927292 " does not exist, so not visiting

I'm using the latest releases from both orgmode and roam.

@chipsenkbeil
Copy link
Owner

@kristijanhusak it looks like issues with temporary capture buffers are still floating around. I'm assuming also connected to nvim-orgmode/orgmode#758

@cat-phish the ml_get: Invalid lnum: 1 is actually a core neovim issue and should be reported upstream. What we can do from nvim-orgmode and org-roam.nvim is try to avoid whatever is causing it. Can you disable nvim-notify and try again?

@chipsenkbeil chipsenkbeil added question Further information is requested nvim-orgmode Issue is related to the nvim-orgmode plugin labels Jan 13, 2025
@kristijanhusak
Copy link

@chipsenkbeil is there a way to reproduce it somehow? The linked issue is for the edit-special buffer which is different from capture window.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
nvim-orgmode Issue is related to the nvim-orgmode plugin question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants