Vim9 autoload case regression

66 views
Skip to first unread message

Christian J. Robinson

unread,
Jan 13, 2022, 1:38:00 PM1/13/22
to vim_dev
If I run the attached caseregression.sh file I get the following errors:

% bash caseregression.sh
Error detected while processing /home/infynity/.vim/plugin/CaseRegression.vim[3]../home/infynity/.vim/autoload/CaseRegression.vim:
line    2:
E746: Function name does not match script file name: caseregression#CaseRegression
Error detected while processing /home/infynity/.vim/plugin/CaseRegression.vim:
line    3:
E1048: Item not found in script: CaseRegression
Press ENTER or type command to continue

--
Christian J. Robinson <hep...@gmail.com>
caseregression.sh

Bram Moolenaar

unread,
Jan 13, 2022, 2:26:24 PM1/13/22
to vim...@googlegroups.com, Christian J. Robinson
I was wondering if the fix in 8.2.4069 was too simple.
Looks like we should only ignore case if file names are not case
sensitive.

--
Even got a Datapoint 3600(?) with a DD50 connector instead of the
usual DB25... what a nightmare trying to figure out the pinout
for *that* with no spex...

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

Christian J. Robinson

unread,
Jan 13, 2022, 5:46:23 PM1/13/22
to Bram Moolenaar, vim_dev
Thanks, that problem is fixed now. However, I can't access CaseRegression#CaseRegression() outside of the plugin/CaseRegression.vim file. Is this intentional? If so, is there a way around it?

Christian J. Robinson

unread,
Jan 13, 2022, 6:31:59 PM1/13/22
to Bram Moolenaar, vim_dev
Oops, it looks like it's only inaccessible under Windows. It seems to be fine under Linux.

Bram Moolenaar

unread,
Jan 14, 2022, 6:21:27 AM1/14/22
to vim...@googlegroups.com, Christian J. Robinson

Christian J. Robinson wrote:

> Thanks, that problem is fixed now. However, I can't access
> CaseRegression#CaseRegression() outside of the plugin/CaseRegression.vim
> file. Is this intentional? If so, is there a way around it?

If I remove the "import autoload 'CaseRegression.vim'" and instead use:

echo CaseRegression#CaseRegression()

That works for me. At least on Linux.

Can you show what does not work for you?

--
Not too long ago, unzipping in public was illegal...

Christian J. Robinson

unread,
Jan 14, 2022, 7:45:07 AM1/14/22
to Bram Moolenaar, vim_dev
With the "import autoload 'CaseRegression.vim'" you can use "echo CaseRegression#CaseRegression()" on Linux, but on Windows it has to be "echo caseregression#CaseRegression()". This inconsistency is the problem I'm facing.

Bram Moolenaar

unread,
Jan 14, 2022, 8:20:31 AM1/14/22
to vim...@googlegroups.com, Christian J. Robinson

Christian J. Robinson wrote:

> With the "import autoload 'CaseRegression.vim'" you can use "echo
> CaseRegression#CaseRegression()" on Linux, but on Windows it has to be
> "echo caseregression#CaseRegression()". This inconsistency is the problem
> I'm facing.

Is that at the script level or in a :def function? Or both?

You can try changing get_autoload_prefix() to always use vim_strsave()
instead of strlow_save() on windows. But I wonder what else will fail
then.

--
What the word 'politics' means: 'Poli' in Latin meaning 'many' and 'tics'
meaning 'bloodsucking creatures'.

Christian Robinson

unread,
Jan 14, 2022, 8:33:13 AM1/14/22
to Bram Moolenaar, vim...@googlegroups.com


> On Jan 14, 2022, at 6:20 AM, Bram Moolenaar <Br...@moolenaar.net> wrote:
>
> 
> Christian J. Robinson wrote:
>
>> With the "import autoload 'CaseRegression.vim'" you can use "echo
>> CaseRegression#CaseRegression()" on Linux, but on Windows it has to be
>> "echo caseregression#CaseRegression()". This inconsistency is the problem
>> I'm facing.
>
> Is that at the script level or in a :def function? Or both?

I'm using the # form in mappings because the .
form is unavailable at that point.

> You can try changing get_autoload_prefix() to always use vim_strsave()
> instead of strlow_save() on windows. But I wonder what else will fail
> then.

Right now I'm just working around it on Windows by creating a reference to the proper case.

if !has('fname_case')
g:CaseRegression#CaseRegression = CaseRegression CaseRegression
endif

Christian J. Robinson

unread,
Jan 15, 2022, 5:00:26 PM1/15/22
to Bram Moolenaar, vim_dev
I've changed my get_autoload_prefix() to always use vim_strsave() and I haven't noticed any issues yet.

Bram Moolenaar

unread,
Jan 16, 2022, 6:14:35 AM1/16/22
to vim...@googlegroups.com, Christian J. Robinson

Christian J. Robinson wrote:

> I've changed my get_autoload_prefix() to always use vim_strsave() and I
> haven't noticed any issues yet.

OK, let's go that way. The big advantage is that scripts work both on
MS-Windows and Linux that same way, one should always use the case of
the file name. On MS-Windows two files that only differ in case are the
same file, let me add a test for that.

--
Nothing is impossible for the man who doesn't have to do it.
Reply all
Reply to author
Forward
0 new messages