Karsten Hopp 9bd85d
To: vim_dev@googlegroups.com
Karsten Hopp 9bd85d
Subject: Patch 7.4.654
Karsten Hopp 9bd85d
Fcc: outbox
Karsten Hopp 9bd85d
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 9bd85d
Mime-Version: 1.0
Karsten Hopp 9bd85d
Content-Type: text/plain; charset=UTF-8
Karsten Hopp 9bd85d
Content-Transfer-Encoding: 8bit
Karsten Hopp 9bd85d
------------
Karsten Hopp 9bd85d
Karsten Hopp 9bd85d
Patch 7.4.654
Karsten Hopp 9bd85d
Problem:    glob() and globpath() cannot include links to non-existing files.
Karsten Hopp 9bd85d
	    (Charles Campbell)
Karsten Hopp 9bd85d
Solution:   Add an argument to include all links with glob(). (James McCoy)
Karsten Hopp 9bd85d
	    Also for globpath().
Karsten Hopp 9bd85d
Files:	    src/vim.h, src/eval.c, src/ex_getln.c
Karsten Hopp 9bd85d
Karsten Hopp 9bd85d
Karsten Hopp 9bd85d
*** ../vim-7.4.653/src/vim.h	2015-02-27 17:19:07.100942390 +0100
Karsten Hopp 9bd85d
--- src/vim.h	2015-03-05 19:13:05.637355404 +0100
Karsten Hopp 9bd85d
***************
Karsten Hopp 9bd85d
*** 814,828 ****
Karsten Hopp 9bd85d
  #define WILD_LONGEST		7
Karsten Hopp 9bd85d
  #define WILD_ALL_KEEP		8
Karsten Hopp 9bd85d
  
Karsten Hopp 9bd85d
! #define WILD_LIST_NOTFOUND	1
Karsten Hopp 9bd85d
! #define WILD_HOME_REPLACE	2
Karsten Hopp 9bd85d
! #define WILD_USE_NL		4
Karsten Hopp 9bd85d
! #define WILD_NO_BEEP		8
Karsten Hopp 9bd85d
! #define WILD_ADD_SLASH		16
Karsten Hopp 9bd85d
! #define WILD_KEEP_ALL		32
Karsten Hopp 9bd85d
! #define WILD_SILENT		64
Karsten Hopp 9bd85d
! #define WILD_ESCAPE		128
Karsten Hopp 9bd85d
! #define WILD_ICASE		256
Karsten Hopp 9bd85d
  
Karsten Hopp 9bd85d
  /* Flags for expand_wildcards() */
Karsten Hopp 9bd85d
  #define EW_DIR		0x01	/* include directory names */
Karsten Hopp 9bd85d
--- 814,829 ----
Karsten Hopp 9bd85d
  #define WILD_LONGEST		7
Karsten Hopp 9bd85d
  #define WILD_ALL_KEEP		8
Karsten Hopp 9bd85d
  
Karsten Hopp 9bd85d
! #define WILD_LIST_NOTFOUND	0x01
Karsten Hopp 9bd85d
! #define WILD_HOME_REPLACE	0x02
Karsten Hopp 9bd85d
! #define WILD_USE_NL		0x04
Karsten Hopp 9bd85d
! #define WILD_NO_BEEP		0x08
Karsten Hopp 9bd85d
! #define WILD_ADD_SLASH		0x10
Karsten Hopp 9bd85d
! #define WILD_KEEP_ALL		0x20
Karsten Hopp 9bd85d
! #define WILD_SILENT		0x40
Karsten Hopp 9bd85d
! #define WILD_ESCAPE		0x80
Karsten Hopp 9bd85d
! #define WILD_ICASE		0x100
Karsten Hopp 9bd85d
! #define WILD_ALLLINKS		0x200
Karsten Hopp 9bd85d
  
Karsten Hopp 9bd85d
  /* Flags for expand_wildcards() */
Karsten Hopp 9bd85d
  #define EW_DIR		0x01	/* include directory names */
Karsten Hopp 9bd85d
***************
Karsten Hopp 9bd85d
*** 839,844 ****
Karsten Hopp 9bd85d
--- 840,846 ----
Karsten Hopp 9bd85d
  #define EW_KEEPDOLLAR	0x800	/* do not escape $, $var is expanded */
Karsten Hopp 9bd85d
  /* Note: mostly EW_NOTFOUND and EW_SILENT are mutually exclusive: EW_NOTFOUND
Karsten Hopp 9bd85d
   * is used when executing commands and EW_SILENT for interactive expanding. */
Karsten Hopp 9bd85d
+ #define EW_ALLLINKS	0x1000	/* also links not pointing to existing file */
Karsten Hopp 9bd85d
  
Karsten Hopp 9bd85d
  /* Flags for find_file_*() functions. */
Karsten Hopp 9bd85d
  #define FINDFILE_FILE	0	/* only files */
Karsten Hopp 9bd85d
*** ../vim-7.4.653/src/eval.c	2015-02-17 12:44:04.376749160 +0100
Karsten Hopp 9bd85d
--- src/eval.c	2015-03-05 19:23:23.238330783 +0100
Karsten Hopp 9bd85d
***************
Karsten Hopp 9bd85d
*** 8141,8148 ****
Karsten Hopp 9bd85d
      {"getwinposx",	0, 0, f_getwinposx},
Karsten Hopp 9bd85d
      {"getwinposy",	0, 0, f_getwinposy},
Karsten Hopp 9bd85d
      {"getwinvar",	2, 3, f_getwinvar},
Karsten Hopp 9bd85d
!     {"glob",		1, 3, f_glob},
Karsten Hopp 9bd85d
!     {"globpath",	2, 4, f_globpath},
Karsten Hopp 9bd85d
      {"has",		1, 1, f_has},
Karsten Hopp 9bd85d
      {"has_key",		2, 2, f_has_key},
Karsten Hopp 9bd85d
      {"haslocaldir",	0, 0, f_haslocaldir},
Karsten Hopp 9bd85d
--- 8141,8148 ----
Karsten Hopp 9bd85d
      {"getwinposx",	0, 0, f_getwinposx},
Karsten Hopp 9bd85d
      {"getwinposy",	0, 0, f_getwinposy},
Karsten Hopp 9bd85d
      {"getwinvar",	2, 3, f_getwinvar},
Karsten Hopp 9bd85d
!     {"glob",		1, 4, f_glob},
Karsten Hopp 9bd85d
!     {"globpath",	2, 5, f_globpath},
Karsten Hopp 9bd85d
      {"has",		1, 1, f_has},
Karsten Hopp 9bd85d
      {"has_key",		2, 2, f_has_key},
Karsten Hopp 9bd85d
      {"haslocaldir",	0, 0, f_haslocaldir},
Karsten Hopp 9bd85d
***************
Karsten Hopp 9bd85d
*** 12412,12422 ****
Karsten Hopp 9bd85d
      {
Karsten Hopp 9bd85d
  	if (get_tv_number_chk(&argvars[1], &error))
Karsten Hopp 9bd85d
  	    options |= WILD_KEEP_ALL;
Karsten Hopp 9bd85d
! 	if (argvars[2].v_type != VAR_UNKNOWN
Karsten Hopp 9bd85d
! 				    && get_tv_number_chk(&argvars[2], &error))
Karsten Hopp 9bd85d
  	{
Karsten Hopp 9bd85d
! 	    rettv->v_type = VAR_LIST;
Karsten Hopp 9bd85d
! 	    rettv->vval.v_list = NULL;
Karsten Hopp 9bd85d
  	}
Karsten Hopp 9bd85d
      }
Karsten Hopp 9bd85d
      if (!error)
Karsten Hopp 9bd85d
--- 12412,12427 ----
Karsten Hopp 9bd85d
      {
Karsten Hopp 9bd85d
  	if (get_tv_number_chk(&argvars[1], &error))
Karsten Hopp 9bd85d
  	    options |= WILD_KEEP_ALL;
Karsten Hopp 9bd85d
! 	if (argvars[2].v_type != VAR_UNKNOWN)
Karsten Hopp 9bd85d
  	{
Karsten Hopp 9bd85d
! 	    if (get_tv_number_chk(&argvars[2], &error))
Karsten Hopp 9bd85d
! 	    {
Karsten Hopp 9bd85d
! 		rettv->v_type = VAR_LIST;
Karsten Hopp 9bd85d
! 		rettv->vval.v_list = NULL;
Karsten Hopp 9bd85d
! 	    }
Karsten Hopp 9bd85d
! 	    if (argvars[3].v_type != VAR_UNKNOWN
Karsten Hopp 9bd85d
! 				    && get_tv_number_chk(&argvars[3], &error))
Karsten Hopp 9bd85d
! 		options |= WILD_ALLLINKS;
Karsten Hopp 9bd85d
  	}
Karsten Hopp 9bd85d
      }
Karsten Hopp 9bd85d
      if (!error)
Karsten Hopp 9bd85d
***************
Karsten Hopp 9bd85d
*** 12466,12476 ****
Karsten Hopp 9bd85d
      {
Karsten Hopp 9bd85d
  	if (get_tv_number_chk(&argvars[2], &error))
Karsten Hopp 9bd85d
  	    flags |= WILD_KEEP_ALL;
Karsten Hopp 9bd85d
! 	if (argvars[3].v_type != VAR_UNKNOWN
Karsten Hopp 9bd85d
! 				    && get_tv_number_chk(&argvars[3], &error))
Karsten Hopp 9bd85d
  	{
Karsten Hopp 9bd85d
! 	    rettv->v_type = VAR_LIST;
Karsten Hopp 9bd85d
! 	    rettv->vval.v_list = NULL;
Karsten Hopp 9bd85d
  	}
Karsten Hopp 9bd85d
      }
Karsten Hopp 9bd85d
      if (file != NULL && !error)
Karsten Hopp 9bd85d
--- 12471,12486 ----
Karsten Hopp 9bd85d
      {
Karsten Hopp 9bd85d
  	if (get_tv_number_chk(&argvars[2], &error))
Karsten Hopp 9bd85d
  	    flags |= WILD_KEEP_ALL;
Karsten Hopp 9bd85d
! 	if (argvars[3].v_type != VAR_UNKNOWN)
Karsten Hopp 9bd85d
  	{
Karsten Hopp 9bd85d
! 	    if (get_tv_number_chk(&argvars[3], &error))
Karsten Hopp 9bd85d
! 	    {
Karsten Hopp 9bd85d
! 		rettv->v_type = VAR_LIST;
Karsten Hopp 9bd85d
! 		rettv->vval.v_list = NULL;
Karsten Hopp 9bd85d
! 	    }
Karsten Hopp 9bd85d
! 	    if (argvars[4].v_type != VAR_UNKNOWN
Karsten Hopp 9bd85d
! 				    && get_tv_number_chk(&argvars[4], &error))
Karsten Hopp 9bd85d
! 		flags |= WILD_ALLLINKS;
Karsten Hopp 9bd85d
  	}
Karsten Hopp 9bd85d
      }
Karsten Hopp 9bd85d
      if (file != NULL && !error)
Karsten Hopp 9bd85d
*** ../vim-7.4.653/src/ex_getln.c	2014-12-08 04:16:26.269702835 +0100
Karsten Hopp 9bd85d
--- src/ex_getln.c	2015-03-05 19:13:28.221098296 +0100
Karsten Hopp 9bd85d
***************
Karsten Hopp 9bd85d
*** 4563,4568 ****
Karsten Hopp 9bd85d
--- 4563,4570 ----
Karsten Hopp 9bd85d
  	flags |= EW_KEEPALL;
Karsten Hopp 9bd85d
      if (options & WILD_SILENT)
Karsten Hopp 9bd85d
  	flags |= EW_SILENT;
Karsten Hopp 9bd85d
+     if (options & WILD_ALLLINKS)
Karsten Hopp 9bd85d
+ 	flags |= EW_ALLLINKS;
Karsten Hopp 9bd85d
  
Karsten Hopp 9bd85d
      if (xp->xp_context == EXPAND_FILES
Karsten Hopp 9bd85d
  	    || xp->xp_context == EXPAND_DIRECTORIES
Karsten Hopp 9bd85d
*** ../vim-7.4.653/src/version.c	2015-03-05 18:08:38.893104412 +0100
Karsten Hopp 9bd85d
--- src/version.c	2015-03-05 19:33:05.491664753 +0100
Karsten Hopp 9bd85d
***************
Karsten Hopp 9bd85d
*** 743,744 ****
Karsten Hopp 9bd85d
--- 743,746 ----
Karsten Hopp 9bd85d
  {   /* Add new patch number below this line */
Karsten Hopp 9bd85d
+ /**/
Karsten Hopp 9bd85d
+     654,
Karsten Hopp 9bd85d
  /**/
Karsten Hopp 9bd85d
Karsten Hopp 9bd85d
-- 
Karsten Hopp 9bd85d
Just think of all the things we haven't thought of yet.
Karsten Hopp 9bd85d
Karsten Hopp 9bd85d
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 9bd85d
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 9bd85d
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp 9bd85d
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///