nvim-orgmode / orgmode

Orgmode clone written in Lua for Neovim 0.9+.

Home Page:https://nvim-orgmode.github.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error opening orgmode files after the most recent updates

bridgesense opened this issue · comments

Describe the bug

Recently, within the past week, I've been having issues opening my orgmode files.

All healthchecks check out good. I've dumped my ~/.local/share/nvim directory and reinstalled everything fresh a few times. I still get the same errors consistantly.

Here's the error I get when opening new orgmode files:

[Neo-tree ERROR] Error opening file: vim/_editor.lua:0: nvim_exec2()..BufReadPost Autocommands for "*": Vim(append):Error executing lua callback: /usr/local/share/nvim/runtime/filetype.lua:30: Error executing lua: /usr/local/share/nvim/runtime/filetype.lua:31: nvim_exec2()..BufReadPost Autocommands for "*"..FileType Autocommands for "org": Vim(append):Error executing lua callback: ...ncis/.local/share/nvim/lazy/orgmode/lua/orgmode/init.lua:51: loop or previous error loading module 'orgmode.agenda'
stack traceback:
	[C]: in function 'require'
	...ncis/.local/share/nvim/lazy/orgmode/lua/orgmode/init.lua:51: in function 'init'
	...ncis/.local/share/nvim/lazy/orgmode/lua/orgmode/init.lua:74: in function <...ncis/.local/share/nvim/lazy/orgmode/lua/orgmode/init.lua:73>
	[C]: in function 'nvim_cmd'
	/usr/local/share/nvim/runtime/filetype.lua:31: in function </usr/local/share/nvim/runtime/filetype.lua:30>
	[C]: in function 'nvim_buf_call'
	/usr/local/share/nvim/runtime/filetype.lua:30: in function </usr/local/share/nvim/runtime/filetype.lua:10>
	[C]: in function 'nvim_exec2'
	vim/_editor.lua: in function <vim/_editor.lua:0>
	[C]: in function 'pcall'
	...hare/nvim/lazy/neo-tree.nvim/lua/neo-tree/utils/init.lua:714: in function 'open_file'
	...y/neo-tree.nvim/lua/neo-tree/sources/common/commands.lua:729: in function 'open'
	...y/neo-tree.nvim/lua/neo-tree/sources/common/commands.lua:751: in function 'open_with_cmd'
	...y/neo-tree.nvim/lua/neo-tree/sources/common/commands.lua:760: in function 'open'
	...o-tree.nvim/lua/neo-tree/sources/filesystem/commands.lua:184: in function <...o-tree.nvim/lua/neo-tree/sources/filesystem/commands.lua:183>
stack traceback:
	[C]: in function 'nvim_cmd'
	/usr/local/share/nvim/runtime/filetype.lua:31: in function </usr/local/share/nvim/runtime/filetype.lua:30>
	[C]: in function 'nvim_buf_call'
	/usr/local/share/nvim/runtime/filetype.lua:30: in function </usr/local/share/nvim/runtime/filetype.lua:10>
	[C]: in function 'nvim_exec2'
	vim/_editor.lua: in function <vim/_editor.lua:0>
	[C]: in function 'pcall'
	...hare/nvim/lazy/neo-tree.nvim/lua/neo-tree/utils/init.lua:714: in function 'open_file'
	...y/neo-tree.nvim/lua/neo-tree/sources/common/commands.lua:729: in function 'open'
	...y/neo-tree.nvim/lua/neo-tree/sources/common/commands.lua:751: in function 'open_with_cmd'
	...y/neo-tree.nvim/lua/neo-tree/sources/common/commands.lua:760: in function 'open'
	...o-tree.nvim/lua/neo-tree/sources/filesystem/commands.lua:184: in function <...o-tree.nvim/lua/neo-tree/sources/filesystem/commands.lua:183>
stack traceback:
	[C]: in function 'nvim_buf_call'
	/usr/local/share/nvim/runtime/filetype.lua:30: in function </usr/local/share/nvim/runtime/filetype.lua:10>
	[C]: in function 'nvim_exec2'
	vim/_editor.lua: in function <vim/_editor.lua:0>
	[C]: in function 'pcall'
	...hare/nvim/lazy/neo-tree.nvim/lua/neo-tree/utils/init.lua:714: in function 'open_file'
	...y/neo-tree.nvim/lua/neo-tree/sources/common/commands.lua:729: in function 'open'
	...y/neo-tree.nvim/lua/neo-tree/sources/common/commands.lua:751: in function 'open_with_cmd'
	...y/neo-tree.nvim/lua/neo-tree/sources/common/commands.lua:760: in function 'open'
	...o-tree.nvim/lua/neo-tree/sources/filesystem/commands.lua:184: in function <...o-tree.nvim/lua/neo-tree/sources/filesystem/commands.lua:183>

If I open an orgmode file that is recovered from cache, I get the following view. Subsequently, when I open orgmode files that weren't trapped in cache and displayed the error above, I get the same view as noted here (see image). So, in order to get orgmode partially working, I have to open one of the trapped-in-cache files, restore it, then open the orgmode files that I couldn't before.

Alt Text

Steps to reproduce

  1. Open Nvim
  2. Open orgmode file

Expected behavior

I get the error as noted above.

Emacs functionality

No response

Minimal init.lua

local tmp_dir = vim.env.TMPDIR or vim.env.TMP or vim.env.TEMP or "/tmp"
local nvim_root = tmp_dir .. "/nvim_orgmode"
local lazy_root = nvim_root .. "/lazy"
local lazypath = lazy_root .. "/lazy.nvim"

-- Install lazy.nvim if not already installed
if not vim.loop.fs_stat(lazypath) then
	vim.fn.system({
		"git",
		"clone",
		"--filter=blob:none",
		"https://github.com/folke/lazy.nvim.git",
		"--branch=stable", -- latest stable release
		lazypath,
	})
end
vim.opt.rtp:prepend(lazypath)

require("lazy").setup({
	{
		"nvim-orgmode/orgmode",
		dependencies = {
			{ "nvim-treesitter/nvim-treesitter", lazy = true },
		},
		event = "VeryLazy",
		config = function()
			-- Load treesitter grammar for org
			require("orgmode").setup_ts_grammar()

			-- Setup treesitter
			require("nvim-treesitter.configs").setup({
				highlight = {
					enable = true,
				},
				ensure_installed = { "org" },
			})

			-- Setup orgmode
			require("orgmode").setup()
		end,
	},
}, {
	root = lazy_root,
	lockfile = nvim_root .. "/lazy.json",
	install = {
		missing = false,
	},
})

require("lazy").sync({
	wait = true,
	show = false,
})

-- Load custom treesitter grammar for org filetype
require("orgmode").setup_ts_grammar()

-- Treesitter configuration
require("nvim-treesitter.configs").setup({
	highlight = {
		enable = true,
	},
	ensure_installed = { "org" }, -- Or run :TSUpdate org
})

require("orgmode").setup({
	org_agenda_files = { "~/Zoho WorkDrive/My Folders/org/*" },
	org_default_notes_file = "~/Zoho WorkDrive/My Folders/org/refile.org",
})

Screenshots and recordings

No response

OS / Distro

Unbuntu 22.04

Neovim version/commit

v0.10.0-dev-1962+gc26dc1f77

Additional context

No response

The error was introduced in commit: 53e0404

When I roll back prior to that commit, everything is fine, and works as it should.

I can't replicate the above errors with the provided minimal init on the latest nightly.

  1. Can you update to the latest nightly version of Neovim? It should be v0.10.0-dev-2407+g9bb046d1b
  2. Can you reinstall the treesitter parser for org? :TSInstall org
  3. How are you opening the org file? A lot of the stack trace provided seems to be tied to Neo-Tree, are you running nvim <your-file-here.org> or opening it in a different way?

Typically when I see filetype.lua errors from Neovim's own provided runtime files I find it's usually resolved by updating treesitter parsers/updating nvim-treesitter.

If you could check on those three things above and report back, I'll gladly see what I can do 🙂.

As @PriceHiller pointed out, do these:

  1. Update Neovim nightly to the latest version
  2. Run :TSUpdate org once you open Neovim to get most recent version of tree-sitter parser for org

Yep. That worked. Thank you, both.