4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=ISO-8859-1
7 Content-Transfer-Encoding: 8bit
11 Problem: Can't avoid 'wildignore' and 'suffixes' for glob() and globpath().
12 Solution: Add an extra argument to these functions. (Ingo Karkat)
13 Files: src/eval.c, src/ex_getln.c, src/proto/ex_getln.pro,
14 runtime/doc/eval.txt, runtime/doc/options.txt
17 *** ../vim-7.2.050/src/eval.c Thu Nov 20 16:11:03 2008
18 --- src/eval.c Thu Nov 27 22:15:40 2008
21 {"getwinposx", 0, 0, f_getwinposx},
22 {"getwinposy", 0, 0, f_getwinposy},
23 {"getwinvar", 2, 2, f_getwinvar},
24 ! {"glob", 1, 1, f_glob},
25 ! {"globpath", 2, 2, f_globpath},
27 {"has_key", 2, 2, f_has_key},
28 {"haslocaldir", 0, 0, f_haslocaldir},
30 {"getwinposx", 0, 0, f_getwinposx},
31 {"getwinposy", 0, 0, f_getwinposy},
32 {"getwinvar", 2, 2, f_getwinvar},
33 ! {"glob", 1, 2, f_glob},
34 ! {"globpath", 2, 3, f_globpath},
36 {"has_key", 2, 2, f_has_key},
37 {"haslocaldir", 0, 0, f_haslocaldir},
42 /* When the optional second argument is non-zero, don't remove matches
43 ! * for 'suffixes' and 'wildignore' */
44 if (argvars[1].v_type != VAR_UNKNOWN
45 && get_tv_number_chk(&argvars[1], &error))
46 flags |= WILD_KEEP_ALL;
50 /* When the optional second argument is non-zero, don't remove matches
51 ! * for 'wildignore' and don't put matches for 'suffixes' at the end. */
52 if (argvars[1].v_type != VAR_UNKNOWN
53 && get_tv_number_chk(&argvars[1], &error))
54 flags |= WILD_KEEP_ALL;
63 ! xpc.xp_context = EXPAND_FILES;
64 ! rettv->v_type = VAR_STRING;
65 ! rettv->vval.v_string = ExpandOne(&xpc, get_tv_string(&argvars[0]),
66 ! NULL, WILD_USE_NL|WILD_SILENT, WILD_ALL);
74 + int flags = WILD_SILENT|WILD_USE_NL;
78 ! /* When the optional second argument is non-zero, don't remove matches
79 ! * for 'wildignore' and don't put matches for 'suffixes' at the end. */
80 ! if (argvars[1].v_type != VAR_UNKNOWN
81 ! && get_tv_number_chk(&argvars[1], &error))
82 ! flags |= WILD_KEEP_ALL;
83 ! rettv->v_type = VAR_STRING;
87 ! xpc.xp_context = EXPAND_FILES;
88 ! rettv->vval.v_string = ExpandOne(&xpc, get_tv_string(&argvars[0]),
89 ! NULL, flags, WILD_ALL);
92 ! rettv->vval.v_string = NULL;
101 char_u buf1[NUMBUFLEN];
102 char_u *file = get_tv_string_buf_chk(&argvars[1], buf1);
104 rettv->v_type = VAR_STRING;
106 rettv->vval.v_string = NULL;
108 ! rettv->vval.v_string = globpath(get_tv_string(&argvars[0]), file);
117 char_u buf1[NUMBUFLEN];
118 char_u *file = get_tv_string_buf_chk(&argvars[1], buf1);
121 + /* When the optional second argument is non-zero, don't remove matches
122 + * for 'wildignore' and don't put matches for 'suffixes' at the end. */
123 + if (argvars[2].v_type != VAR_UNKNOWN
124 + && get_tv_number_chk(&argvars[2], &error))
125 + flags |= WILD_KEEP_ALL;
126 rettv->v_type = VAR_STRING;
127 ! if (file == NULL || error)
128 rettv->vval.v_string = NULL;
130 ! rettv->vval.v_string = globpath(get_tv_string(&argvars[0]), file,
135 *** ../vim-7.2.050/src/ex_getln.c Sat Nov 15 14:10:23 2008
136 --- src/ex_getln.c Thu Nov 20 18:37:20 2008
139 && ccline.xpc->xp_context != EXPAND_NOTHING
140 && ccline.xpc->xp_context != EXPAND_UNSUCCESSFUL)
142 ! int i = ccline.xpc->xp_pattern - p;
144 /* If xp_pattern points inside the old cmdbuff it needs to be adjusted
145 * to point into the newly allocated memory. */
147 && ccline.xpc->xp_context != EXPAND_NOTHING
148 && ccline.xpc->xp_context != EXPAND_UNSUCCESSFUL)
150 ! int i = (int)(ccline.xpc->xp_pattern - p);
152 /* If xp_pattern points inside the old cmdbuff it needs to be adjusted
153 * to point into the newly allocated memory. */
158 sprintf((char *)s, "%s/%s*.vim", dirname, pat);
159 ! all = globpath(p_rtp, s);
166 sprintf((char *)s, "%s/%s*.vim", dirname, pat);
167 ! all = globpath(p_rtp, s, 0);
173 * newlines. Returns NULL for an error or no matches.
176 ! globpath(path, file)
183 * newlines. Returns NULL for an error or no matches.
186 ! globpath(path, file, expand_options)
189 + int expand_options;
198 ! if (ExpandFromContext(&xpc, buf, &num_p, &p, WILD_SILENT) != FAIL
201 ! ExpandEscape(&xpc, buf, num_p, p, WILD_SILENT);
202 for (len = 0, i = 0; i < num_p; ++i)
203 len += (int)STRLEN(p[i]) + 1;
209 ! if (ExpandFromContext(&xpc, buf, &num_p, &p,
210 ! WILD_SILENT|expand_options) != FAIL && num_p > 0)
212 ! ExpandEscape(&xpc, buf, num_p, p, WILD_SILENT|expand_options);
213 for (len = 0, i = 0; i < num_p; ++i)
214 len += (int)STRLEN(p[i]) + 1;
216 *** ../vim-7.2.050/src/proto/ex_getln.pro Wed May 28 16:49:01 2008
217 --- src/proto/ex_getln.pro Thu Nov 20 18:27:57 2008
220 void set_cmd_context __ARGS((expand_T *xp, char_u *str, int len, int col));
221 int expand_cmdline __ARGS((expand_T *xp, char_u *str, int col, int *matchcount, char_u ***matches));
222 int ExpandGeneric __ARGS((expand_T *xp, regmatch_T *regmatch, int *num_file, char_u ***file, char_u *((*func)(expand_T *, int))));
223 ! char_u *globpath __ARGS((char_u *path, char_u *file));
224 void init_history __ARGS((void));
225 int get_histtype __ARGS((char_u *name));
226 void add_to_history __ARGS((int histype, char_u *new_entry, int in_map, int sep));
228 void set_cmd_context __ARGS((expand_T *xp, char_u *str, int len, int col));
229 int expand_cmdline __ARGS((expand_T *xp, char_u *str, int col, int *matchcount, char_u ***matches));
230 int ExpandGeneric __ARGS((expand_T *xp, regmatch_T *regmatch, int *num_file, char_u ***file, char_u *((*func)(expand_T *, int))));
231 ! char_u *globpath __ARGS((char_u *path, char_u *file, int expand_options));
232 void init_history __ARGS((void));
233 int get_histtype __ARGS((char_u *name));
234 void add_to_history __ARGS((int histype, char_u *new_entry, int in_map, int sep));
235 *** ../vim-7.2.050/runtime/doc/eval.txt Sun Nov 9 13:43:25 2008
236 --- runtime/doc/eval.txt Thu Nov 27 22:17:13 2008
239 ! *eval.txt* For Vim version 7.2. Last change: 2008 Nov 02
242 VIM REFERENCE MANUAL by Bram Moolenaar
244 ! *eval.txt* For Vim version 7.2. Last change: 2008 Nov 27
247 VIM REFERENCE MANUAL by Bram Moolenaar
250 exists( {expr}) Number TRUE if {expr} exists
251 extend({expr1}, {expr2} [, {expr3}])
252 List/Dict insert items of {expr2} into {expr1}
253 ! expand( {expr}) String expand special keywords in {expr}
254 feedkeys( {string} [, {mode}]) Number add key sequence to typeahead buffer
255 filereadable( {file}) Number TRUE if {file} is a readable file
256 filewritable( {file}) Number TRUE if {file} is a writable file
258 exists( {expr}) Number TRUE if {expr} exists
259 extend({expr1}, {expr2} [, {expr3}])
260 List/Dict insert items of {expr2} into {expr1}
261 ! expand( {expr} [, {flag}]) String expand special keywords in {expr}
262 feedkeys( {string} [, {mode}]) Number add key sequence to typeahead buffer
263 filereadable( {file}) Number TRUE if {file} is a readable file
264 filewritable( {file}) Number TRUE if {file} is a writable file
267 getwinposx() Number X coord in pixels of GUI Vim window
268 getwinposy() Number Y coord in pixels of GUI Vim window
269 getwinvar( {nr}, {varname}) any variable {varname} in window {nr}
270 ! glob( {expr}) String expand file wildcards in {expr}
271 ! globpath( {path}, {expr}) String do glob({expr}) for all dirs in {path}
272 has( {feature}) Number TRUE if feature {feature} supported
273 has_key( {dict}, {key}) Number TRUE if {dict} has entry {key}
274 haslocaldir() Number TRUE if current window executed |:lcd|
276 getwinposx() Number X coord in pixels of GUI Vim window
277 getwinposy() Number Y coord in pixels of GUI Vim window
278 getwinvar( {nr}, {varname}) any variable {varname} in window {nr}
279 ! glob( {expr} [, {flag}]) String expand file wildcards in {expr}
280 ! globpath( {path}, {expr} [, {flag}])
281 ! String do glob({expr}) for all dirs in {path}
282 has( {feature}) Number TRUE if feature {feature} supported
283 has_key( {dict}, {key}) Number TRUE if {dict} has entry {key}
284 haslocaldir() Number TRUE if current window executed |:lcd|
287 :let list_is_on = getwinvar(2, '&list')
288 :echo "myvar = " . getwinvar(1, 'myvar')
291 ! glob({expr}) Expand the file wildcards in {expr}. See |wildcards| for the
292 use of special characters.
293 The result is a String.
294 When there are several matches, they are separated by <NL>
296 ! The 'wildignore' option applies: Names matching one of the
297 ! patterns in 'wildignore' will be skipped.
298 If the expansion fails, the result is an empty string.
299 A name for a non-existing file is not included.
302 :let list_is_on = getwinvar(2, '&list')
303 :echo "myvar = " . getwinvar(1, 'myvar')
305 ! glob({expr} [, {flag}]) *glob()*
306 ! Expand the file wildcards in {expr}. See |wildcards| for the
307 use of special characters.
308 The result is a String.
309 When there are several matches, they are separated by <NL>
311 ! Unless the optional {flag} argument is given and is non-zero,
312 ! the 'suffixes' and 'wildignore' options apply: Names matching
313 ! one of the patterns in 'wildignore' will be skipped and
314 ! 'suffixes' affect the ordering of matches.
315 If the expansion fails, the result is an empty string.
316 A name for a non-existing file is not included.
320 See |expand()| for expanding special Vim variables. See
321 |system()| for getting the raw output of an external command.
323 ! globpath({path}, {expr}) *globpath()*
324 Perform glob() on all directories in {path} and concatenate
325 the results. Example: >
326 :echo globpath(&rtp, "syntax/c.vim")
327 < {path} is a comma-separated list of directory names. Each
328 directory name is prepended to {expr} and expanded like with
329 ! glob(). A path separator is inserted when needed.
330 To add a comma inside a directory name escape it with a
331 backslash. Note that on MS-Windows a directory may have a
332 trailing backslash, remove it if you put a comma after it.
333 If the expansion fails for one of the directories, there is no
335 ! The 'wildignore' option applies: Names matching one of the
336 ! patterns in 'wildignore' will be skipped.
338 The "**" item can be used to search in a directory tree.
339 For example, to find all "README.txt" files in the directories
341 See |expand()| for expanding special Vim variables. See
342 |system()| for getting the raw output of an external command.
344 ! globpath({path}, {expr} [, {flag}]) *globpath()*
345 Perform glob() on all directories in {path} and concatenate
346 the results. Example: >
347 :echo globpath(&rtp, "syntax/c.vim")
348 < {path} is a comma-separated list of directory names. Each
349 directory name is prepended to {expr} and expanded like with
350 ! |glob()|. A path separator is inserted when needed.
351 To add a comma inside a directory name escape it with a
352 backslash. Note that on MS-Windows a directory may have a
353 trailing backslash, remove it if you put a comma after it.
354 If the expansion fails for one of the directories, there is no
356 ! Unless the optional {flag} argument is given and is non-zero,
357 ! the 'suffixes' and 'wildignore' options apply: Names matching
358 ! one of the patterns in 'wildignore' will be skipped and
359 ! 'suffixes' affect the ordering of matches.
361 The "**" item can be used to search in a directory tree.
362 For example, to find all "README.txt" files in the directories
363 *** ../vim-7.2.050/runtime/doc/options.txt Sat Aug 9 19:36:49 2008
364 --- runtime/doc/options.txt Tue Nov 25 23:43:55 2008
367 ! *options.txt* For Vim version 7.2. Last change: 2008 Aug 06
370 VIM REFERENCE MANUAL by Bram Moolenaar
372 ! *options.txt* For Vim version 7.2. Last change: 2008 Nov 25
375 VIM REFERENCE MANUAL by Bram Moolenaar
378 {not available when compiled without the |+wildignore|
380 A list of file patterns. A file that matches with one of these
381 ! patterns is ignored when completing file or directory names.
382 The pattern is used like with |:autocmd|, see |autocmd-patterns|.
386 {not available when compiled without the |+wildignore|
388 A list of file patterns. A file that matches with one of these
389 ! patterns is ignored when completing file or directory names, and
390 ! influences the result of |expand()|, |glob()| and |globpath()| unless
391 ! a flag is passed to disable this.
392 The pattern is used like with |:autocmd|, see |autocmd-patterns|.
395 *** ../vim-7.2.050/src/version.c Fri Nov 28 10:08:05 2008
396 --- src/version.c Fri Nov 28 10:55:44 2008
400 { /* Add new patch number below this line */
406 Not too long ago, unzipping in public was illegal...
408 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
409 /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
410 \\\ download, build and distribute -- http://www.A-A-P.org ///
411 \\\ help me help AIDS victims -- http://ICCF-Holland.org ///