conjure icon indicating copy to clipboard operation
conjure copied to clipboard

:wqa results in "E948: Job still running" because invisible terminal window

Open positron opened this issue 1 year ago • 4 comments

Running :wqa tries to save all buffers then close them all. This fails, surprisingly if you never opened the conjure log buffer, because it is open but invisible.

Reproduction steps:

  • nvim test.clj
  • :wqa
    E948: Job still running
    E676: No matching autocommands for buftype= buffer
    
  • :ls!                                                                                                                                                                                                                                                                                                                                                                                                                                                                     
      1 %a   "test.clj"           line 76                                                                                                                                                                                                                                                                                                                                                                                                                          
      2u h   "conjure-log-74563.cljc"       line 0                                                                                                                                                                                                                                                                                                                                                                                                                           
      3 #hR  "term://~/projects/foo//74574:bb nrepl-server localhost:52386" line 1  
    
  • :bwipeout! 3 - force kill the nrepl terminal
  • :wqa - now works

positron avatar Feb 04 '25 17:02 positron

Thanks for reporting this! I can reproduce it and I think basically have a fix in place, just in the middle of prep before a long bit of travelling 😅 it might end up getting finished tonight, tomorrow, or on an 8 hour flight to India...

Should be a fairly quick fix though, just need to mark the terminal buffer appropriately so it's not attached to a file as we do with the log buffer.

Disabling the auto REPL for Clojure will also temporarily fix this, although you'll lose the auto bb REPL which might suck for your workflow.

Olical avatar Feb 04 '25 19:02 Olical

Oh! It looks like this might just be a Neovim thing that I can't work around! https://vi.stackexchange.com/questions/42547/cant-use-wqa-with-open-terminal-buffers

I tried to set the buftype to nofile but you can't set a terminal buffer type to anything other than terminal.

Here's an upstream neovim issue for this too https://github.com/neovim/neovim/issues/14061

And there's always this workaround: https://github.com/kevinhwang91/rnvimr/issues/76#issuecomment-1677064899

You could maybe create your own override for wqa essentially that avoids the issue? I didn't even know the command existed until today 😅

Olical avatar Feb 04 '25 21:02 Olical

Oh wow, bummer you can't work around that right now.

Thanks for looking in to it super quick! Love the plugin, I just switched from vim-fireplace.

positron avatar Feb 04 '25 22:02 positron

This autocommand worked for me as a work-around:

	vim.api.nvim_create_autocmd("ExitPre", {
		pattern = "*",
		callback = function(event)
			for _, buf in ipairs(vim.api.nvim_list_bufs()) do
				if vim.api.nvim_buf_get_option(buf, "buftype") == "terminal" then
					vim.api.nvim_buf_delete(buf, { force = true })
				end
			end
		end,
	})

archie-judd avatar Mar 03 '25 11:03 archie-judd