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

Error: QuitPre autocommands #105

Open
ray-x opened this issue Oct 6, 2022 · 5 comments
Open

Error: QuitPre autocommands #105

ray-x opened this issue Oct 6, 2022 · 5 comments

Comments

@ray-x
Copy link

ray-x commented Oct 6, 2022

Error messages:

Error detected while processing QuitPre Autocommands for "*":
Error executing lua callback: .../pack/packer/opt/true-zen.nvim/lua/true-zen/ataraxis.lua:239: Expected Lua number
stack traceback:
        [C]: in function 'nvim_win_is_valid'
        .../pack/packer/opt/true-zen.nvim/lua/true-zen/ataraxis.lua:239: in function 'off'
        ...te/pack/packer/opt/true-zen.nvim/lua/true-zen/narrow.lua:114: in function 'off'
        ...te/pack/packer/opt/true-zen.nvim/lua/true-zen/narrow.lua:90: in function <...te/pack/packer/opt/true-zen.nvim/lua/true-zen/narrow.lua:89>

Reproduce:

  • visual mode, select lines
  • TZNarrow
  • Split the narrow window
  • finish edition, use :q to exit split
  • see errors
    image
@dithmer
Copy link

dithmer commented Oct 17, 2022

+1

Experiencing the same issue.

Does not only happen if you split the TZNarrow, but also if you:

  • Have multiple buffers open in split view
  • TZNarrow
  • :q to quit TZNarrow-View
  • :q to quit the buffer which was opened in TZNarrow

@richardhttps
Copy link

richardhttps commented Oct 27, 2022

Same issue

  • Happens in any mode
  • Any number of buffers
  • Happens after TZNarrow is toggled off the second time and the times afterward (not necessarily consecutively)
  • Toggling off TZAtaraxis results in the same error, but only if it happens with TZNarrow first

Neovim 0.8
Plugins:
lsp lualine cmp treesitter symbols-outline telescope orgmode gitsigns nnn which-key toggleterm mason colorizer leap indent-blankline comment bufferline autopairs todo-comments true-zen

@beautiful-boyyy
Copy link

Same issue

  • Happens in any mode
  • Any number of buffers
  • Happens after TZNarrow is toggled off the second time and the times afterward (not necessarily consecutively)
  • Toggling off TZAtaraxis results in the same error, but only if it happens with TZNarrow first

Neovim 0.8 Plugins: lsp lualine cmp treesitter symbols-outline telescope orgmode gitsigns nnn which-key toggleterm mason colorizer leap indent-blankline comment bufferline autopairs todo-comments true-zen

add vim.wo.foldmethod = manual solved the problem for me.

@CesarGuzmanLopez
Copy link
Contributor

CesarGuzmanLopez commented Jan 22, 2023

I added silent to my keybidings but obviously it's not a solution, it just doesn't bother me while I work. They will have a slightly more efficient solution, I don't know enough lua to try to fix it myself.

vim.api.nvim_set_keymap("n", "<c-z>n", ":silent! TZNarrow<CR>", {})
vim.api.nvim_set_keymap("v", "<c-z>n", ":'<,'>TZNarrow<CR>", {})
vim.api.nvim_set_keymap("n", "<c-z>f", ":silent! TZFocus<CR>", {})
vim.api.nvim_set_keymap("n", "<c-z>o", ":silent! TZAtaraxis<CR>", {})

this only hides the messages but they are still there removing it with the command :q

maybe change in ataraxis.lua in the M.off function
This

	if api.nvim_win_is_valid(win.main) then
		if win.main ~= api.nvim_get_current_win() then
			fn.win_gotoid(win.main)
		end
		cursor_pos = fn.getpos(".")
	end
	cmd("only")
	if fn.filereadable(fn.expand("%:p")) == 1 then
		cmd("q")
	end

for this another one

	if pcall(function() api.nvim_win_is_valid(win.main) end) and  api.nvim_win_is_valid(win.main) then
		if win.main ~= api.nvim_get_current_win() then
			fn.win_gotoid(win.main)
		end
		cursor_pos = fn.getpos(".")
	else
		data.do_callback("ataraxis", "close", "pos")
		return 1 -- already off
	end
    cmd("only")
    if fn.filereadable(fn.expand("%:p")) == 1 then
		pcall(function () pcall(cmd("q")) end)
	end

By adding pcall to the problematic function, this seems to be enough to not see the error messages again.

CesarGuzmanLopez added a commit to CesarGuzmanLopez/true-zen.nvim that referenced this issue Jan 23, 2023
@dandennison84
Copy link

dandennison84 commented Jun 7, 2023

Same issue, the proposed patch fixed this issue, but caused a new one. I'll put details in #111.

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

No branches or pull requests

6 participants