Closed schultzter closed 8 months ago
Did this start to happen recently? If yes, could you try changing back to commit https://github.com/nvim-orgmode/orgmode/commit/e1f3054987ce054525258d9a3cc5837bf6e75212 and test to see if it happens there (you will have to o ":TSUpdate org" because that commit uses older tree-sitter parser)
I only noticed it this morning, my first morning back in the office. But I've only been using orgmode since a few days last week (at home).
I googled some git commands but I can't figure out how to change back to a specific commit. Would you mind explaining to me how to do that using the Paq package manager? Or specific git commands. Sorry, but I feel as though git was specifically engineered to befuddled me.
I'm not sure where WIndows puts the plugins, but I'm assuming this section will help you. Once you find nvim-orgmode
folder, go into it and do git reset --hard e1f3054987ce054525258d9a3cc5837bf6e75212
. That should put you on the older commit. Then open up Neovim, execute :TSUpdate org
, and restart Neovim. Then give it a try.
Thanks. I tried that but it doesn't work!
Can I just download that commit, in a zip, and overwrite my Paq installation? Or remove it from Paq and manage it manually for now?
schultzter@host MINGW64 /c/Users/schultzter/AppData/Local/nvim-data/site/pack/paqs/start/orgmode (master)
$ git reset --hard e1f3054987ce054525258d9a3cc5837bf6e75212
fatal: Could not parse object 'e1f3054987ce054525258d9a3cc5837bf6e75212'.
Can you try doing git fetch --depth 999
first and then try the same command? I think Paq is not fetching history when installed, that's why it didn't work.
Ok, that last suggestion got it working.
And then I ran :TSUpdate org but I still get the error message.
Ok, i think you misunderstood the order of commands. Do it in this order:
git fetch --depth 999
git reset --hard e1f3054987ce054525258d9a3cc5837bf6e75212
:TSUpdate org
, restart NeovimOk, I did all those steps and I still get the same error (originally I didn't restart Neovim after updating the treesitter).
schultzter@host MINGW64 ~/AppData/Local/nvim-data/site/pack/paqs/start/orgmode (master)
$ git fetch --depth 999
remote: Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
schultzter@host MINGW64 ~/AppData/Local/nvim-data/site/pack/paqs/start/orgmode (master)
$ git reset --hard e1f3054987ce054525258d9a3cc5837bf6e75212
HEAD is now at e1f3054 Merge pull request #231 from jgollenz/fix/open-template-by-shortcut
schultzter@host MINGW64 ~/AppData/Local/nvim-data/site/pack/paqs/start/orgmode (master)
$
Thanks for testing it out. Does other things work when you do this, like changing todo state or adding tags?
No, other things don't work either after I refresh the Agenda!
<leader>cit
gave me this error: Failed to parse current file...
<leader>ot
, ois
, and oid
all gave me the same error!
If I reload the file, with :e!
then all those commands work again until I go to my Agenda window and hit r
to rebuild it.
Here's a copy of that org:
#+TITLE: Personal
* Agenda :@agenda:
Things to discuss
* Call :@call:
Calls to make
** DONE Call about Easter Brunch
CLOSED: [2022-04-06 Wed 17:17] SCHEDULED: <2022-04-06 Wed>
Bring the berry/fruit salad
They will bring their own bread
** DONE Call aunt about Easter Brunch
CLOSED: [2022-04-06 Wed 14:23] SCHEDULED: <2022-04-06 Wed>
Make sure she has a ride
** INPROGRESS Call clinic to make follow appointment
SCHEDULED: <2022-04-07 Thu>
Follow-up with doctor for excessive nostril hair
* Computer :@computer:
Things to do on the computer/internet
** TODO Shop for headphone 6' cable with r-angle plug
To connect from back of docking station to headphones
* Errand :@errand:
Things to go and do somewhere, including printing stuff out
** DONE Print calendars
CLOSED: [2022-04-06 Wed 15:28] SCHEDULED: <2022-04-06 Wed>
Start with April
I'm also experiencing this exact problem, this is my machine:
MacOS 12.3.1
0.6.1 & 0.7.0
I hope that I'll be able to look into this a bit more myself as well, but can't promise anything 😉
Are you guys using latest master and latest tree-sitter version? TS grammar got some update last night, so it might fix some of these issues. I can't reproduce them. Just try with latest master, and do :TSUpdate org
to get latest grammar version.
I just tested with latest master
/NVIM 0.7.0 and updated grammar, and the symptoms are still there, but it seems like the crash has moved.
I'm getting an error in lua/orgmode/parser/mappings.lua:100
, saying that file
is nil
.
/lua/orgmode/org/mappings.lua:100: attempt to index local 'file' (a nil value)
I'm using a symlink for my orgfiles (and have them on iCloud drive), and I think this might be the culprit. As far as I understood @schultzter had a similar setup.
I tried adding some print
logging around in files.lua
, and it seems like it's using different paths when trying to update Files.orgfiles
vs. when retriving them.
An example is that it's setting:
Files.orgfiles[/Users/cheif/org/my.org] = 0x00a9a09a
and then trying to read:
Files.orgfiles[/Users/cheif/Library/Mobile Documents/com~apple~CloudDocs/org/my.org
which is the resolved symlink.
@cheif could you just give it a try and see if it works properly when you are using it directly (without symlink)? Symlinks seems to work fine on Linux for me, but I'm not sure about Windows/Mac Os.
Ok, so I tried some more, and setting org_agenda_files
and org_default_notes_file
to the non-symlinked version seems to do the trick, so something is fishy with symlinks on Windows/MacOS it seems at least.
Thanks for testing it out. When you open up file that is symlinked, what does this return for you?
:lua print(vim.api.nvim_buf_get_name(0))
Is it returning full path to symlinked file or full path to the original file (in the iCloud folder)?
Also, if you do this, does it return list of paths to symlinked files or to original files?
:lua print(vim.inspect(vim.fn.glob('/path/to/symlinked/folder/*', 0, 1)))
@cheif Ok I managed to reproduce it locally. Current buffer name was returning original name, while everything loaded was from symlink. Try pulling latest master and see if it works.
@kristijanhusak I tried master
just now, but the problem seems to persist unfortunately 😢
Thanks for testing it out. When you open up file that is symlinked, what does this return for you?
:lua print(vim.api.nvim_buf_get_name(0))
/Users/cheif/Library/Mobile Documents/com~apple~CloudDocs/org/my.org
So this returns the full path.
Also, if you do this, does it return list of paths to symlinked files or to original files?
:lua print(vim.inspect(vim.fn.glob('/path/to/symlinked/folder/*', 0, 1)))
{ /Users/cheif/org/my.org }
(and some more org-files others)
So this returns paths to the symlink.
Also tried :lua print(vim.fn.bufname())
which returned:
org/my.org
I completely forgot to get full path of the bufname. Can you pull latest master and see if it's fixed now? If not, please let me know what this returns:
:lua print(vim.fn.fnamemodify(vim.fn.bufname(), ':p'))
Unfortunately still seems to be an issue on latest master
.
:lua print(vim.fn.fnamemodify(vim.fn.bufname(), ':p'))
/Users/cheif/Library/Mobile Documents/com~apple~CloudDocs/org/my.org
Damn, it's so inconsistent.
glob()
for you returns paths to the symlinked folder, while other things (bufname, nvim_buf_get_name) return real paths. According to docs this should give you list of files with real paths, but I'm not sure if that's really the case. Can you please check?
:lua print(vim.inspect(vim.fn.glob('/path/to/symlinked/folder/*', 0, 1, true)))
:lua print(vim.inspect(vim.fn.glob('/path/to/symlinked/folder/*', 0, 1, true)))
{ "/Users/cheif/org/my.org" }
(and other org-files)
so this just gives me the symlinks.
Ok I just pushed another fix. Hopefully this one should work. Now even glob
will return the full paths instead of symlinked ones. Could you do a pull and test?
Tested master
now, and it seems to be working for me!
Great work @kristijanhusak! 🍾
Awesome, thanks for your help! I wouldn't be able to figure it out on my own.
@cheif I think the issue can be closed then? edit: my bad, the issue was opened by @schultzter
Good morning
No, other things don't work either after I refresh the Agenda!
@schultzter are you sure this file is problematic? Do you have any other files?
For what its worth, I'm also having the same error "Failed to parse current file." etc
My agenda opens in a vsplit, and I'm also loading a symlinked file.
:lua print(vim.api.nvim_buf_get_name(0))
returns the path to the symlink, not the true file, which is in my Dropbox
Closing as outdated. If the problem persists, please open up a separate issue. Thanks.
Describe the bug
I get the error message
attempt to index local 'file' (a nil value)
when trying to collapse a TODO heading I have opened prior to refreshing (r) the agenda view.I noticed this in :checkhealth but the missing file, highlights.scm, is there when I check in the directory (as well as injections.scm).
Steps to reproduce
Expected behavior
Headlines will collapse without error.
Emacs functionality
It works!
Minimal init.lua
-- Load custom tree-sitter grammar for org filetyp\ require('orgmode').setup_ts_grammar()
-- Tree-sitter 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, disable = {'org'}, -- Remove this to use TS highlighter for some of the highlights (Experimental) additional_vim_regex_highlighting = {'org'}, -- Required since TS highlighter doesn't support all syntax features (conceal) }, ensure_installed = {'org'}, -- Or run :TSUpdate org }require('orgmode').setup({ org_agenda_files = 'C:/Users/redact/Documents/Notebooks/*', org_default_notes_file = 'C:/Users/redact/Documents/Notebooks/refile.org', org_todo_keywords = {'TODO', 'INPROGRESS', 'WAITING','DONE'} })
Screenshots and recordings
OS / Distro
Windows 10
Neovim version/commit
0.6.1
Additional context
My home directory, ~, is different when working from home (local c:\users\redacted) vs at the office (network mounted m:)