Re: [vim/vim] Vim9: functions assigned to commands are not visible (Issue #9907)

2022-03-08 Fir de Conversatie Yegappan Lakshmanan
Hi,

On Tue, Mar 8, 2022 at 2:51 PM lacygoill  wrote:

> I know that introducing new options is frowned upon, considering that we
> already have a lot, but a new 'cmdignore' option would fix the real
> issue, which was described here:
>
> There are plugins that define many similar commands, so using command
> completion becomes very difficult.
>
> So, for example, if a user has 2 plugins installing a bunch of commands
> starting with the prefixes Foo and Bar, they could tell Vim that they
> don't want any of them to be suggested after pressing Tab while on the
> command-line:
>
> set cmdignore=Foo*,Bar*
>
>
>
With the support for fuzzy completion of command names (set 'wildoptions'
to 'fuzzy'),
it should be easy to complete command names ignoring case and to complete
names
after typing a few characters anywhere in the name.

Regards,
Yegappan

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/CAAW7x7kRog1_oqoFR2gcPmbZK4YO1zSDV%3D7tyK0KQSMnDve%2B-Q%40mail.gmail.com.


Re: Patch 8.2.4528

2022-03-08 Fir de Conversatie Bram Moolenaar


John Marriott wrote:

> On 09-Mar-2022 03:53, Bram Moolenaar wrote:
> > Patch 8.2.4528
> > Problem:Crash when using null_function for a partial.
> > Solution:   Don't call fname_trans_sid() with NULL. (closes #9908)
> > Files:  src/userfunc.c, src/testdir/test_vim9_func.vim
> >
> >
> After this patch, mingw64 (gcc 11.2.0) throws this warning:
> 
> gcc -c -I. -Iproto -DWIN32 -DWINVER=0x0603 -D_WIN32_WINNT=0x0603 
> -DHAVE_PATHDEF -DFEAT_NORMAL -DHAVE_STDINT_H -D__USE_MINGW_ANSI_STDIO 
> -pipe -march=native -Wall -O3 -fomit-frame-pointer -freg-struct-return 
> -fpie -fPIE -DFEAT_GUI_MSWIN -DFEAT_CLIPBOARD userfunc.c -o 
> gobjnative/userfunc.o
> userfunc.c: In function 'make_partial':
> userfunc.c:5755:27: warning: 'fp' may be used uninitialized in this 
> function [-Wmaybe-uninitialized]
>   5755 | if ((fp != NULL && (fp->uf_flags & FC_DICT))
>    | ~~^~
> 
> 
> The attached patch tries to fix it.

It actually caused a crash, when I was adding a few more tests.
The fix has been included with 8.2.4529.

-- 
hundred-and-one symptoms of being an internet addict:
208. Your goals for the future are obtaining a second Gbit connection
and upgrade your NAS to all SSD

 /// Bram Moolenaar -- b...@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///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20220308213739.4B0F61C08CF%40moolenaar.net.


Re: Patch 8.2.4526

2022-03-08 Fir de Conversatie Ernie Rael

On 3/8/22 11:44 AM, Bram Moolenaar wrote:

On 3/8/22 5:20 AM, Bram Moolenaar wrote:

Patch 8.2.4526
Problem:Vim9: cannot set variables to a null value.
Solution:   Add null_list, null_job, etc.

How about an "is_null(t: any): bool" method, (or "isnull()")? I could
roll my own, but the "if else if else ..." seems expensive. (unless it
gets optimized internally into a switch-case :-) )

What is it you want to do?  We recently added support for comparing with
"null".  That will match all the null_* values.  Thus allo of these are
true:
null == null_string
null == null_blob
null == null_list
null == null_function
null == null_job


In the previous discussion I had thought that given  var t:string,
it was necessary to do "if t is null_string" to test if it is
really null. I'm looking for a way to test for really null uniformly
no matter the type, and without noting if I need to use "is".

I'll build a new vim today and run some experiments, which I should
have done before posting the message.

-ernie


Still need to add some more tests.  It worked with the functions before,
so it should work with the value as well.



--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups "vim_dev" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/7892cf16-45c8-1dab-845f-0df5189f35d2%40raelity.com.


Patch 8.2.4529

2022-03-08 Fir de Conversatie Bram Moolenaar


Patch 8.2.4529
Problem:Vim9: comparing partial with function fails.
Solution:   Support this comparison.  Avoid a crash. (closes #9909)
Add more test cases.
Files:  src/vim9instr.c, src/userfunc.c, src/vim9type.c,
src/testdir/test_vim9_builtin.vim, src/testdir/test_vim9_expr.vim,
src/testdir/test_vim9_func.vim, src/testdir/test_vimscript.vim


*** ../vim-8.2.4528/src/vim9instr.c 2022-03-08 13:18:10.809020782 +
--- src/vim9instr.c 2022-03-08 18:58:21.949496564 +
***
*** 370,376 
  }
  else if (type1 == VAR_ANY || type2 == VAR_ANY
|| ((type1 == VAR_NUMBER || type1 == VAR_FLOAT)
! && (type2 == VAR_NUMBER || type2 == VAR_FLOAT)))
isntype = ISN_COMPAREANY;
  else if (type1 == VAR_SPECIAL || type2 == VAR_SPECIAL)
  {
--- 370,378 
  }
  else if (type1 == VAR_ANY || type2 == VAR_ANY
|| ((type1 == VAR_NUMBER || type1 == VAR_FLOAT)
!  && (type2 == VAR_NUMBER || type2 == VAR_FLOAT))
!   || (type1 == VAR_FUNC && type2 == VAR_PARTIAL)
!   || (type1 == VAR_PARTIAL && type2 == VAR_FUNC))
isntype = ISN_COMPAREANY;
  else if (type1 == VAR_SPECIAL || type2 == VAR_SPECIAL)
  {
*** ../vim-8.2.4528/src/userfunc.c  2022-03-08 16:52:18.807756958 +
--- src/userfunc.c  2022-03-08 19:16:32.579191126 +
***
*** 5730,5747 
  make_partial(dict_T *selfdict_in, typval_T *rettv)
  {
  char_u*fname;
! ufunc_T   *fp;
  char_ufname_buf[FLEN_FIXED + 1];
  int   error;
  dict_T*selfdict = selfdict_in;
  
! if (rettv->v_type == VAR_PARTIAL && rettv->vval.v_partial->pt_func != 
NULL)
fp = rettv->vval.v_partial->pt_func;
  else
  {
fname = rettv->v_type == VAR_FUNC ? rettv->vval.v_string
  : rettv->vval.v_partial->pt_name;
!   if (fname != NULL)
{
char_u  *tofree = NULL;
  
--- 5730,5756 
  make_partial(dict_T *selfdict_in, typval_T *rettv)
  {
  char_u*fname;
! ufunc_T   *fp = NULL;
  char_ufname_buf[FLEN_FIXED + 1];
  int   error;
  dict_T*selfdict = selfdict_in;
  
! if (rettv->v_type == VAR_PARTIAL  && rettv->vval.v_partial != NULL
!&& rettv->vval.v_partial->pt_func != NULL)
fp = rettv->vval.v_partial->pt_func;
  else
  {
fname = rettv->v_type == VAR_FUNC ? rettv->vval.v_string
+: rettv->vval.v_partial == NULL ? NULL
  : rettv->vval.v_partial->pt_name;
!   if (fname == NULL)
!   {
!   // There is no point binding a dict to a NULL function, just create
!   // a function reference.
!   rettv->v_type = VAR_FUNC;
!   rettv->vval.v_string = NULL;
!   }
!   else
{
char_u  *tofree = NULL;
  
***
*** 5752,5759 
}
  }
  
! if ((fp != NULL && (fp->uf_flags & FC_DICT))
!   || (rettv->v_type == VAR_FUNC && rettv->vval.v_string == NULL))
  {
partial_T   *pt = ALLOC_CLEAR_ONE(partial_T);
  
--- 5761,5767 
}
  }
  
! if (fp != NULL && (fp->uf_flags & FC_DICT))
  {
partial_T   *pt = ALLOC_CLEAR_ONE(partial_T);
  
*** ../vim-8.2.4528/src/vim9type.c  2022-03-08 13:18:10.809020782 +
--- src/vim9type.c  2022-03-08 19:38:42.740545016 +
***
*** 420,425 
--- 420,427 
}
else
name = tv->vval.v_string;
+   if (name == NULL && ufunc == NULL)
+   return _func_unknown;
if (name != NULL)
{
int idx = find_internal_func(name);
*** ../vim-8.2.4528/src/testdir/test_vim9_builtin.vim   2022-02-23 
21:03:28.913442583 +
--- src/testdir/test_vim9_builtin.vim   2022-03-08 19:40:04.756387254 +
***
*** 1687,1692 
--- 1687,1693 
endif
$SOMEENVVAR = 'some'
assert_equal('some', getenv('SOMEENVVAR'))
+   assert_notequal(null, getenv('SOMEENVVAR'))
unlet $SOMEENVVAR
getenv('')->assert_equal(v:null)
  enddef
***
*** 4398,4404 
if has('float')
  assert_equal('func([unknown], [unknown]): float', 
typename(function('pow')))
endif
!   assert_equal('func', test_null_partial()->typename())
assert_equal('list', test_null_list()->typename())
assert_equal('dict', test_null_dict()->typename())
if has('job')
--- 4399,4405 
if has('float')
  assert_equal('func([unknown], [unknown]): float', 
typename(function('pow')))
endif
!   assert_equal('func(...): unknown', test_null_partial()->typename())
assert_equal('list', test_null_list()->typename())
assert_equal('dict', test_null_dict()->typename())
if has('job')
*** 

Re: Patch 8.2.4526

2022-03-08 Fir de Conversatie Bram Moolenaar


> On 3/8/22 5:20 AM, Bram Moolenaar wrote:
> > Patch 8.2.4526
> > Problem:Vim9: cannot set variables to a null value.
> > Solution:   Add null_list, null_job, etc.
> 
> How about an "is_null(t: any): bool" method, (or "isnull()")? I could 
> roll my own, but the "if else if else ..." seems expensive. (unless it 
> gets optimized internally into a switch-case :-) )

What is it you want to do?  We recently added support for comparing with
"null".  That will match all the null_* values.  Thus allo of these are
true:
null == null_string
null == null_blob
null == null_list
null == null_function
null == null_job

Still need to add some more tests.  It worked with the functions before,
so it should work with the value as well.

-- 
hundred-and-one symptoms of being an internet addict:
206. You religiously respond immediately to e-mail, while ignoring
 your growing pile of snail mail.

 /// Bram Moolenaar -- b...@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///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20220308194413.7925E1C0A2F%40moolenaar.net.


Re: Patch 8.2.4527

2022-03-08 Fir de Conversatie Bram Moolenaar


> > I wrote:
> >
> > > Patch 8.2.4527
> > > Problem:The Athena GUI is old and does not work well.
> > > Solution:   Remove the Athena GUI from configure to find out who still 
> > > wants
> > > support for this GUI.
> > > Files:  src/configure.ac, src/auto/configure, src/Makefile
> >
> > Perhaps the NeXtaw GUI should also be removed.  It's basically the same
> > as Athena with some nicer looking widgets.  Opinions?
> 
> I'm guessing if we remove athena GUI, it indeed makes sense
> to remove neXtaw as well.  Are there packages on Ubuntu to build
> with this GUI?  I did not find any at first sight with xubuntu-18.04.

There is libxaw, based on the description that's the renamed neXtaw
library, or perhaps a fork.  Might also be called libxaw3d, package
libxaw3dxft8-dev.

-- 
hundred-and-one symptoms of being an internet addict:
203. You're an active member of more than 20 newsgroups.

 /// Bram Moolenaar -- b...@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///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20220308194413.75C2B1C08CF%40moolenaar.net.


Re: Patch 8.2.4528

2022-03-08 Fir de Conversatie John Marriott


On 09-Mar-2022 03:53, Bram Moolenaar wrote:

Patch 8.2.4528
Problem:Crash when using null_function for a partial.
Solution:   Don't call fname_trans_sid() with NULL. (closes #9908)
Files:  src/userfunc.c, src/testdir/test_vim9_func.vim



After this patch, mingw64 (gcc 11.2.0) throws this warning:

gcc -c -I. -Iproto -DWIN32 -DWINVER=0x0603 -D_WIN32_WINNT=0x0603 
-DHAVE_PATHDEF -DFEAT_NORMAL -DHAVE_STDINT_H -D__USE_MINGW_ANSI_STDIO 
-pipe -march=native -Wall -O3 -fomit-frame-pointer -freg-struct-return 
-fpie -fPIE -DFEAT_GUI_MSWIN -DFEAT_CLIPBOARD userfunc.c -o 
gobjnative/userfunc.o

userfunc.c: In function 'make_partial':
userfunc.c:5755:27: warning: 'fp' may be used uninitialized in this 
function [-Wmaybe-uninitialized]

 5755 | if ((fp != NULL && (fp->uf_flags & FC_DICT))
  | ~~^~


The attached patch tries to fix it.

Cheers
John

--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups "vim_dev" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/1a0fde44-ae60-14a6-deec-7380b73467f8%40internode.on.net.
--- userfunc.c.orig 2022-03-09 05:24:14.896079100 +1100
+++ userfunc.c  2022-03-09 05:28:17.780679800 +1100
@@ -5730,7 +5730,7 @@
 make_partial(dict_T *selfdict_in, typval_T *rettv)
 {
 char_u  *fname;
-ufunc_T *fp;
+ufunc_T *fp = NULL;
 char_u  fname_buf[FLEN_FIXED + 1];
 int error;
 dict_T  *selfdict = selfdict_in;


Re: Patch 8.2.4526

2022-03-08 Fir de Conversatie Ernie Rael

On 3/8/22 5:20 AM, Bram Moolenaar wrote:

Patch 8.2.4526
Problem:Vim9: cannot set variables to a null value.
Solution:   Add null_list, null_job, etc.


How about an "is_null(t: any): bool" method, (or "isnull()")? I could 
roll my own, but the "if else if else ..." seems expensive. (unless it 
gets optimized internally into a switch-case :-) )


-ernie

--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups "vim_dev" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/b5ff48fa-c857-ecab-9aef-ed0b807aabd7%40raelity.com.


Re: Patch 8.2.4527

2022-03-08 Fir de Conversatie Dominique Pellé
Bram Moolenaar  wrote:

> I wrote:
>
> > Patch 8.2.4527
> > Problem:The Athena GUI is old and does not work well.
> > Solution:   Remove the Athena GUI from configure to find out who still wants
> > support for this GUI.
> > Files:  src/configure.ac, src/auto/configure, src/Makefile
>
> Perhaps the NeXtaw GUI should also be removed.  It's basically the same
> as Athena with some nicer looking widgets.  Opinions?

I'm guessing if we remove athena GUI, it indeed makes sense
to remove neXtaw as well.  Are there packages on Ubuntu to build
with this GUI?  I did not find any at first sight with xubuntu-18.04.

Dominique

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/CAON-T_jXSe5ZA1Gipus4SAJ0bnk%2BU-a7M62YLWvM0dsKuOArQQ%40mail.gmail.com.


Patch 8.2.4528

2022-03-08 Fir de Conversatie Bram Moolenaar


Patch 8.2.4528
Problem:Crash when using null_function for a partial.
Solution:   Don't call fname_trans_sid() with NULL. (closes #9908)
Files:  src/userfunc.c, src/testdir/test_vim9_func.vim


*** ../vim-8.2.4527/src/userfunc.c  2022-03-05 20:24:36.899308689 +
--- src/userfunc.c  2022-03-08 16:49:15.880077033 +
***
*** 5730,5736 
  make_partial(dict_T *selfdict_in, typval_T *rettv)
  {
  char_u*fname;
- char_u*tofree = NULL;
  ufunc_T   *fp;
  char_ufname_buf[FLEN_FIXED + 1];
  int   error;
--- 5730,5735 
***
*** 5742,5754 
  {
fname = rettv->v_type == VAR_FUNC ? rettv->vval.v_string
  : rettv->vval.v_partial->pt_name;
!   // Translate "s:func" to the stored function name.
!   fname = fname_trans_sid(fname, fname_buf, , );
!   fp = find_func(fname, FALSE);
!   vim_free(tofree);
  }
  
! if (fp != NULL && (fp->uf_flags & FC_DICT))
  {
partial_T   *pt = ALLOC_CLEAR_ONE(partial_T);
  
--- 5741,5759 
  {
fname = rettv->v_type == VAR_FUNC ? rettv->vval.v_string
  : rettv->vval.v_partial->pt_name;
!   if (fname != NULL)
!   {
!   char_u  *tofree = NULL;
! 
!   // Translate "s:func" to the stored function name.
!   fname = fname_trans_sid(fname, fname_buf, , );
!   fp = find_func(fname, FALSE);
!   vim_free(tofree);
!   }
  }
  
! if ((fp != NULL && (fp->uf_flags & FC_DICT))
!   || (rettv->v_type == VAR_FUNC && rettv->vval.v_string == NULL))
  {
partial_T   *pt = ALLOC_CLEAR_ONE(partial_T);
  
*** ../vim-8.2.4527/src/testdir/test_vim9_func.vim  2022-03-08 
13:18:10.813020777 +
--- src/testdir/test_vim9_func.vim  2022-03-08 16:51:18.819893096 +
***
*** 3337,3342 
--- 3337,3351 
assert_equal(123, RefRef())
  enddef
  
+ def Test_partial_null_function()
+   var lines =<< trim END
+   var d: dict = {f: null_function}
+   var Ref = d.f
+   assert_equal('func', typename(Ref))
+   END
+   v9.CheckDefAndScriptSuccess(lines)
+ enddef
+ 
  " Using "idx" from a legacy global function does not work.
  " This caused a crash when called from legacy context.
  func Test_partial_call_fails()
*** ../vim-8.2.4527/src/version.c   2022-03-08 13:32:34.238804971 +
--- src/version.c   2022-03-08 16:49:01.424096580 +
***
*** 752,753 
--- 752,755 
  {   /* Add new patch number below this line */
+ /**/
+ 4528,
  /**/

-- 
panic("Fod fight!");
-- In the kernel source aha1542.c, after detecting a bad segment list

 /// Bram Moolenaar -- b...@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///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20220308165343.DC03E1C02B3%40moolenaar.net.


Re: Patch 8.2.4527

2022-03-08 Fir de Conversatie Bram Moolenaar


I wrote:

> Patch 8.2.4527
> Problem:The Athena GUI is old and does not work well.
> Solution:   Remove the Athena GUI from configure to find out who still wants
> support for this GUI.
> Files:  src/configure.ac, src/auto/configure, src/Makefile

Perhaps the NeXtaw GUI should also be removed.  It's basically the same
as Athena with some nicer looking widgets.  Opinions?

-- 
hundred-and-one symptoms of being an internet addict:
202. You're amazed to find out Spam is a food.

 /// Bram Moolenaar -- b...@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///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20220308150702.C085F1C0463%40moolenaar.net.


Patch 8.2.4527

2022-03-08 Fir de Conversatie Bram Moolenaar


Patch 8.2.4527
Problem:The Athena GUI is old and does not work well.
Solution:   Remove the Athena GUI from configure to find out who still wants
support for this GUI.
Files:  src/configure.ac, src/auto/configure, src/Makefile


*** ../vim-8.2.4526/src/configure.ac2022-02-23 18:07:34.361914993 +
--- src/configure.ac2022-03-08 13:24:28.208429708 +
***
*** 291,298 
  CPPFLAGS="$CPPFLAGS -DMACOS_X_DARWIN"
  
   dnl Assume we don't want X11 unless it was specifically asked for
!  dnl (--with-x) or Motif, Athena or GTK GUI is used.
!  if test -z "$with_x" -a "X$enable_gui" != Xmotif -a "X$enable_gui" != 
Xathena -a "X$enable_gui" != Xgtk2 -a "X$enable_gui" != Xgtk3; then
with_x=no
   fi
fi
--- 291,298 
  CPPFLAGS="$CPPFLAGS -DMACOS_X_DARWIN"
  
   dnl Assume we don't want X11 unless it was specifically asked for
!  dnl (--with-x) or Motif or GTK GUI is used.
!  if test -z "$with_x" -a "X$enable_gui" != Xmotif -a "X$enable_gui" != 
Xgtk2 -a "X$enable_gui" != Xgtk3; then
with_x=no
   fi
fi
***
*** 2443,2449 
  
  AC_MSG_CHECKING(--enable-gui argument)
  AC_ARG_ENABLE(gui,
!  [  --enable-gui[=OPTS]   X11 GUI. [default=auto] 
[OPTS=auto/no/gtk2/gnome2/gtk3/motif/athena/neXtaw/haiku/photon/carbon]], , 
enable_gui="auto")
  
  dnl Canonicalize the --enable-gui= argument so that it can be easily compared.
  dnl Do not use character classes for portability with old tools.
--- 2443,2449 
  
  AC_MSG_CHECKING(--enable-gui argument)
  AC_ARG_ENABLE(gui,
!  [  --enable-gui[=OPTS]   X11 GUI. [default=auto] 
[OPTS=auto/no/gtk2/gnome2/gtk3/motif/neXtaw/haiku/photon/carbon]], , 
enable_gui="auto")
  
  dnl Canonicalize the --enable-gui= argument so that it can be easily compared.
  dnl Do not use character classes for portability with old tools.
***
*** 2455,2461 
  SKIP_GTK3=YES
  SKIP_GNOME=YES
  SKIP_MOTIF=YES
- SKIP_ATHENA=YES
  SKIP_NEXTAW=YES
  SKIP_PHOTON=YES
  SKIP_HAIKU=YES
--- 2455,2460 
***
*** 2502,2508 
SKIP_GTK3=
SKIP_GNOME=
SKIP_MOTIF=
-   SKIP_ATHENA=
SKIP_NEXTAW=;;
  gtk2) AC_MSG_RESULT(GTK+ 2.x GUI support)
SKIP_GTK2=;;
--- 2501,2506 
***
*** 2513,2520 
SKIP_GTK3=;;
  motif)AC_MSG_RESULT(Motif GUI support)
SKIP_MOTIF=;;
- athena)   AC_MSG_RESULT(Athena GUI support)
-   SKIP_ATHENA=;;
  nextaw)   AC_MSG_RESULT(neXtaw GUI support)
SKIP_NEXTAW=;;
  *)AC_MSG_RESULT([Sorry, $enable_gui GUI is not 
supported]) ;;
--- 2511,2516 
***
*** 2568,2584 
fi
  fi
  
- if test "x$SKIP_ATHENA" != "xYES" -a "$enable_gui_canon" != "athena"; then
-   AC_MSG_CHECKING(whether or not to look for Athena)
-   AC_ARG_ENABLE(athena-check,
-   [  --enable-athena-check   If auto-select GUI, check for Athena 
[default=yes]],
-   , enable_athena_check="yes")
-   AC_MSG_RESULT($enable_athena_check)
-   if test "x$enable_athena_check" = "xno"; then
- SKIP_ATHENA=YES
-   fi
- fi
- 
  if test "x$SKIP_NEXTAW" != "xYES" -a "$enable_gui_canon" != "nextaw"; then
AC_MSG_CHECKING(whether or not to look for neXtaw)
AC_ARG_ENABLE(nextaw-check,
--- 2564,2569 
***
*** 2821,2827 
GUI_INC_LOC="$GTK_CFLAGS"], )
  if test "x$GTK_CFLAGS" != "x"; then
SKIP_GTK3=YES
-   SKIP_ATHENA=YES
SKIP_NEXTAW=YES
SKIP_MOTIF=YES
GUITYPE=GTK
--- 2806,2811 
***
*** 2872,2878 
  if test "x$GTK_CFLAGS" != "x"; then
SKIP_GTK2=YES
SKIP_GNOME=YES
-   SKIP_ATHENA=YES
SKIP_NEXTAW=YES
SKIP_MOTIF=YES
GUITYPE=GTK
--- 2856,2861 
***
*** 3034,3065 
  fi
  
  if test -z "$SKIP_MOTIF"; then
-   SKIP_ATHENA=YES
SKIP_NEXTAW=YES
GUITYPE=MOTIF
AC_SUBST(MOTIF_LIBNAME)
  fi
  
- dnl Check if the Athena files can be found
- 
- GUI_X_LIBS=
- 
- if test -z "$SKIP_ATHENA"; then
-   AC_MSG_CHECKING(if Athena header files can be found)
-   cflags_save=$CFLAGS
-   CFLAGS="$CFLAGS $X_CFLAGS"
-   AC_TRY_COMPILE([
- #include 
- #include ], ,
-   AC_MSG_RESULT(yes),
-   AC_MSG_RESULT(no); SKIP_ATHENA=YES )
-   CFLAGS=$cflags_save
- fi
- 
- if test -z "$SKIP_ATHENA"; then
-   GUITYPE=ATHENA
- fi
- 
  if test -z "$SKIP_NEXTAW"; then
AC_MSG_CHECKING(if neXtaw header files can be found)
cflags_save=$CFLAGS
--- 3017,3027 
***
*** 3076,3082 
GUITYPE=NEXTAW
  fi
  
! if test -z "$SKIP_ATHENA" -o -z "$SKIP_NEXTAW" -o -z "$SKIP_MOTIF"; then
dnl Prepend -I and -L to $GUI_INC_LOC and $GUI_LIB_LOC if not empty
dnl Avoid adding it when it twice
if test -n "$GUI_INC_LOC"; then
--- 3038,3044 
GUITYPE=NEXTAW
  fi
  
! if test -z "$SKIP_NEXTAW" -o -z 

Patch 8.2.4526

2022-03-08 Fir de Conversatie Bram Moolenaar


Patch 8.2.4526
Problem:Vim9: cannot set variables to a null value.
Solution:   Add null_list, null_job, etc.
Files:  runtime/doc/vim9.txt, src/eval.c, src/proto/eval.pro,
src/vim9expr.c, src/vim9script.c, src/vim9instr.c,
src/vim9compile.c, src/vim9execute.c, src/vim9.h, src/vim9type.c,
src/evalvars.c, src/testdir/test_vim9_assign.vim,
src/testdir/test_vim9_disassemble.vim,
src/testdir/test_vim9_func.vim, src/testdir/test_expr.vim


*** ../vim-8.2.4525/runtime/doc/vim9.txt2022-02-22 20:42:50.382992530 
+
--- runtime/doc/vim9.txt2022-03-07 21:26:34.420871466 +
***
*** 94,101 
def CallMe(count: number, message: string): bool
  - Call functions without `:call`: >
writefile(['done'], 'file.txt')
! - You cannot use old Ex commands `:xit`, `:t`, `:k`, `:append`, `:change`,
!   `:insert`, `:open`, and `:s` or `:d` with only flags.
  - You cannot use curly-braces names.
  - A range before a command must be prefixed with a colon: >
:%s/this/that
--- 94,113 
def CallMe(count: number, message: string): bool
  - Call functions without `:call`: >
writefile(['done'], 'file.txt')
! - You cannot use old Ex commands:
!   `:Print`
!   `:append`
!   `:change`
!   `:d`  directly followed by 'd' or 'p'.
!   `:insert`
!   `:k`
!   `:mode`
!   `:open`
!   `:s`  with only flags
!   `:t`
!   `:xit`
! - Some commands, especially those used for flow control, cannot be shortened.
!   E.g., `:throw` cannot be written as `:th`. *E839*
  - You cannot use curly-braces names.
  - A range before a command must be prefixed with a colon: >
:%s/this/that
***
*** 923,933 
  
  Simple types are Number, Float, Special and Bool.  For other types |string()|
  should be used.
!   *false* *true* *null*
! In Vim9 script one can use "true" for v:true, "false" for v:false and "null"
! for v:null.  When converting a boolean to a string "false" and "true" are
! used, not "v:false" and "v:true" like in legacy script.  "v:none" is not
! changed, it is only used in JSON and has no equivalent in other languages.
  
  Indexing a string with [idx] or taking a slice with [idx : idx] uses character
  indexes instead of byte indexes.  Composing characters are included.
--- 966,1003 
  
  Simple types are Number, Float, Special and Bool.  For other types |string()|
  should be used.
!   *false* *true* *null* *E1034*
! In Vim9 script one can use the following predefined values: >
!   true
!   false
!   null
!   null_blob
!   null_channel
!   null_dict
!   null_function
!   null_job
!   null_list
!   null_partial
!   null_string
! `true` is the same as `v:true`, `false` the same as `v:false`, `null` the same
! as `v:null`.
! 
! While `null` has the type "special", the other "null_" types have the type
! indicated by their name.  Quite often a null value is handled the same as an
! empty value, but not always.  The values can be useful to clear a script-local
! variable, since they cannot be deleted with `:unlet`.  E.g.: >
!   var theJob = job_start(...)
!   # let the job do its work
!   theJob = null_job
! 
! The values can also be useful as the default value for an argument: >
!   def MyFunc(b: blob = null_blob)
!  if b == null_blob
! # b argument was not given
! 
! When converting a boolean to a string `false` and `true` are used, not
! `v:false` and `v:true` like in legacy script.  `v:none` has no `none`
! replacement, it has no equivalent in other languages.
  
  Indexing a string with [idx] or taking a slice with [idx : idx] uses character
  indexes instead of byte indexes.  Composing characters are included.
*** ../vim-8.2.4525/src/eval.c  2022-02-13 21:51:02.392484124 +
--- src/eval.c  2022-03-07 21:40:00.798772322 +
***
*** 943,948 
--- 943,949 
type_list = _ITEM(current_sctx.sc_sid)->sn_type_list;
else
{
+   // TODO: should we give an error here?
type_list = _type_list;
ga_init2(type_list, sizeof(type_T), 10);
}
***
*** 3483,3488 
--- 3484,3583 
  }
  
  /*
+  * Check for a predefined value "true", "false" and "null.*".
+  * Return OK when recognized.
+  */
+ int
+ handle_predefined(char_u *s, int len, typval_T *rettv)
+ {
+ switch (len)
+ {
+   case 4: if (STRNCMP(s, "true", 4) == 0)
+   {
+   rettv->v_type = VAR_BOOL;
+   rettv->vval.v_number = VVAL_TRUE;
+   return OK;
+   }
+   if (STRNCMP(s, "null", 4) == 0)
+   {
+   rettv->v_type = VAR_SPECIAL;
+