nvim-orgmode / orgmode

Orgmode clone written in Lua for Neovim 0.9+.
https://nvim-orgmode.github.io/
MIT License
3.04k stars 134 forks source link

Agenda prompt's any entry leads to undefined variable #479

Closed szebenyib closed 1 year ago

szebenyib commented 1 year ago

Describe the bug

If I press any "menu letter" in the agenda prompt I get the following error: [orgmode] ...te/pack/packer/start/orgmode/lua/orgmode/agenda/init.lua:82: Vim(lua):E5108: Error executing lua ...k/packer/start/orgmode/lua/ orgmode/colors/highlights.lua:60: Vim(while):E121: Undefined variable: g:org_heading_highlight_levels
stack traceback:
[C]: in function 'cmd'
...k/packer/start/orgmode/lua/orgmode/colors/highlights.lua:60: in function 'define_agenda_colors'
[string ":lua"]:1: in main chunk
[C]: in function 'cmd'
...te/pack/packer/start/orgmode/lua/orgmode/agenda/init.lua:82: in function 'open_window'
...te/pack/packer/start/orgmode/lua/orgmode/agenda/init.lua:39: in function 'open_agenda_view'
...te/pack/packer/start/orgmode/lua/orgmode/agenda/init.lua:56: in function <...te/pack/packer/start/orgmode/lua/orgmode/agenda/init .lua:55>
[C]: in function 'pcall'
...nvim/site/pack/packer/start/orgmode/lua/orgmode/init.lua:159: in function 'action'
[string ":lua"]:1: in main chunk

Steps to reproduce

1: Open neovim with nvim 2: oa 3: Agenda prompt opens 4: Press either a or t 5: Error

Expected behavior

No error should be seen but the agenda

Emacs functionality

No response

Minimal init.lua

vim.cmd('source ' .. '~/.vimrc') local ensure_packer = function() local fn = vim.fn local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim' if fn.empty(fn.glob(install_path)) > 0 then fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path}) vim.cmd [[packadd packer.nvim]] return true end return false end

local packer_bootstrap = ensure_packer()

return require('packer').startup(function(use) use 'wbthomason/packer.nvim' -- My plugins here -- use 'foo1/bar1.nvim' -- use 'foo2/bar2.nvim' use {'nvim-treesitter/nvim-treesitter'} use {'nvim-orgmode/orgmode', config = function() require('orgmode').setup{} end }

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

-- Treesitter configuration
require('nvim-treesitter.configs').setup {
    -- If TS highlights are not enabled at all, or disabled via `disable` prop,
    -- highlighting will fallback to default Vim syntax highlighting
    highlight = {
        enable = true,
        -- Required for spellcheck, some LaTex highlights and
        -- code block highlights that do not have ts grammar
        additional_vim_regex_highlighting = {'org'},
    },
    ensure_installed = {'org'}, -- Or run :TSUpdate org
}

require('orgmode').setup({
    org_agenda_files = {'~/sync/orgzly/*'},
    org_default_notes_file = '~/sync/orgzly/inbox.org',
})

-- Automatically set up your configuration after cloning packer.nvim
-- Put this at the end after all plugins
if packer_bootstrap then
    require('packer').sync()
end

end)

Screenshots and recordings

No response

OS / Distro

Arch Linux

Neovim version/commit

0.8.1

Additional context

NVIM v0.8.1 Build type: Release LuaJIT 2.1.0-beta3 Compiled by builduser

Features: +acl +iconv +tui See ":help feature-compile"

system vimrc file: "$VIM/sysinit.vim" fall-back for $VIM: "/usr/share/nvim"

Run :checkhealth for more info

PackerStatus shows three green plugins: nvim-treesitter, orgmode, packer.nvim (there are many other plugins, but only these there are managed by packer, others come from vimrc).

The agenda prompt was visible but I have moved my org files to another location, edited the location in init.lua and eversince then this issue persists - or so I believe, this is the only thing that comes to my mind. I currently try to familiarize myself with org/agenda so I have not used it extensively before, just opened it once.

kristijanhusak commented 1 year ago

Undefined variable: g:org_heading_highlight_levels

There's no variable with that name in the whole plugin, so something outside of the plugin is causing it to break. Please try provided minimal_init.lua and see if it works.

szebenyib commented 1 year ago

Ohhh, old (jecb) org mode was causing the issue. Sorry and thank you for pointing me in the right direction.