Older scripts have a problem with recent changes to indentexpr for vim9, they will see it as undefined variable E121. Patch avoids the error in vim8 script as mentioned by @monkoose in #14111 (comment)
Fixes #14111
https://github.com/vim/vim/pull/14936
(1 file)
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
Hm, I suppose if we make this change, we also don't need the import statement anymore. @yegappan @dkearns what is your opinion on this?
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
@smemsh pushed 1 commit.
—
View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
ok, removed the import line.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()
Hm, I suppose if we make this change, we also don't need the
importstatement anymore. @yegappan @dkearns what is your opinion on this?
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.![]()
so you want those changes because? Is this just because you need to manually call the &indentexpr?
—
Reply to this email directly, view it on GitHub.
You are receiving this because you commented.![]()
There should probably be a builtin function to evaluate the 'indentexpr' for a given line, like cindent() and lispindent().
—
Reply to this email directly, view it on GitHub.
You are receiving this because you commented.![]()
so you want those changes because? Is this just because you need to manually call the &indentexpr
the changes are so the plugin doesn't break with E121, it's the vim-stabs mentioned in the issue, which had been working ok until I upgraded a vim8 to 9.1. I could carry a patch to vim-stabs, or I could carry a patch in vim but if it benefits anyone else and seems like better not to break vim8 scripts, then why should the patch not go in?
these reference exist:
$ grep -sr indentexpr plugin
plugin/stabs.vim: if &expandtab || !(&autoindent || &indentexpr || &cindent)
plugin/stabs.vim: if &indentexpr != ''
plugin/stabs.vim: sandbox exe 'let inda='.&indentexpr
plugin/stabs.vim: let checkalign = ( &expandtab || !(&autoindent || &indentexpr || &cindent))
don't know how to do anything more complicated with the patch, just cherry-picked the fix mentioned in the linked issue, because it fixed my problem. hope that it can be fixed one way or another, so older scripts don't get undefined error.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you commented.![]()
so you want those changes because? Is this just because you need to manually call the
&indentexpr?
To chime in with my use case:
I've been running with a patch in my tree that exposes all vim9script indentexprs at the global scope, because I have a mapping that toggles between the standard indentexpr and a custom, minimal indentation mode, and it needs to stash away the buffer's current indentexpr so it can restore it later.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you commented.![]()
Hm, it seems like those autoloaded functions are automatically translated into autoloadable form, in this case like dist#vimindent#Expr(). One also cannot use function() to refer to those autoloaded vim9 functions, may be we should make this work instead, so that you can save and restore it using function()?
—
Reply to this email directly, view it on GitHub.
You are receiving this because you commented.![]()
@chrisbra is this patch useful in the meantime to fix vim8 users, before a more complete change can be made, or should the PR be closed?
—
Reply to this email directly, view it on GitHub.
You are receiving this because you commented.![]()
I have another idea how to fix this, probably doesn't matter, but I wanted to keep the import and didn't want to have to use the autoloaded name. Let's see how this works for you.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you commented.![]()
—
Reply to this email directly, view it on GitHub.
You are receiving this because you commented.![]()
Let's see how this works for you
solves my issue afaict; thanks.
—
Reply to this email directly, view it on GitHub.
You are receiving this because you commented.![]()