1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
|
To: vim-dev@vim.org
Subject: Patch 7.2.051
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
------------
Patch 7.2.051
Problem: Can't avoid 'wildignore' and 'suffixes' for glob() and globpath().
Solution: Add an extra argument to these functions. (Ingo Karkat)
Files: src/eval.c, src/ex_getln.c, src/proto/ex_getln.pro,
runtime/doc/eval.txt, runtime/doc/options.txt
*** ../vim-7.2.050/src/eval.c Thu Nov 20 16:11:03 2008
--- src/eval.c Thu Nov 27 22:15:40 2008
***************
*** 7564,7571 ****
{"getwinposx", 0, 0, f_getwinposx},
{"getwinposy", 0, 0, f_getwinposy},
{"getwinvar", 2, 2, f_getwinvar},
! {"glob", 1, 1, f_glob},
! {"globpath", 2, 2, f_globpath},
{"has", 1, 1, f_has},
{"has_key", 2, 2, f_has_key},
{"haslocaldir", 0, 0, f_haslocaldir},
--- 7564,7571 ----
{"getwinposx", 0, 0, f_getwinposx},
{"getwinposy", 0, 0, f_getwinposy},
{"getwinvar", 2, 2, f_getwinvar},
! {"glob", 1, 2, f_glob},
! {"globpath", 2, 3, f_globpath},
{"has", 1, 1, f_has},
{"has_key", 2, 2, f_has_key},
{"haslocaldir", 0, 0, f_haslocaldir},
***************
*** 9557,9563 ****
else
{
/* When the optional second argument is non-zero, don't remove matches
! * for 'suffixes' and 'wildignore' */
if (argvars[1].v_type != VAR_UNKNOWN
&& get_tv_number_chk(&argvars[1], &error))
flags |= WILD_KEEP_ALL;
--- 9557,9563 ----
else
{
/* When the optional second argument is non-zero, don't remove matches
! * for 'wildignore' and don't put matches for 'suffixes' at the end. */
if (argvars[1].v_type != VAR_UNKNOWN
&& get_tv_number_chk(&argvars[1], &error))
flags |= WILD_KEEP_ALL;
***************
*** 11323,11335 ****
typval_T *argvars;
typval_T *rettv;
{
expand_T xpc;
! ExpandInit(&xpc);
! xpc.xp_context = EXPAND_FILES;
! rettv->v_type = VAR_STRING;
! rettv->vval.v_string = ExpandOne(&xpc, get_tv_string(&argvars[0]),
! NULL, WILD_USE_NL|WILD_SILENT, WILD_ALL);
}
/*
--- 11323,11347 ----
typval_T *argvars;
typval_T *rettv;
{
+ int flags = WILD_SILENT|WILD_USE_NL;
expand_T xpc;
+ int error = FALSE;
! /* When the optional second argument is non-zero, don't remove matches
! * for 'wildignore' and don't put matches for 'suffixes' at the end. */
! if (argvars[1].v_type != VAR_UNKNOWN
! && get_tv_number_chk(&argvars[1], &error))
! flags |= WILD_KEEP_ALL;
! rettv->v_type = VAR_STRING;
! if (!error)
! {
! ExpandInit(&xpc);
! xpc.xp_context = EXPAND_FILES;
! rettv->vval.v_string = ExpandOne(&xpc, get_tv_string(&argvars[0]),
! NULL, flags, WILD_ALL);
! }
! else
! rettv->vval.v_string = NULL;
}
/*
***************
*** 11340,11353 ****
typval_T *argvars;
typval_T *rettv;
{
char_u buf1[NUMBUFLEN];
char_u *file = get_tv_string_buf_chk(&argvars[1], buf1);
rettv->v_type = VAR_STRING;
! if (file == NULL)
rettv->vval.v_string = NULL;
else
! rettv->vval.v_string = globpath(get_tv_string(&argvars[0]), file);
}
/*
--- 11352,11373 ----
typval_T *argvars;
typval_T *rettv;
{
+ int flags = 0;
char_u buf1[NUMBUFLEN];
char_u *file = get_tv_string_buf_chk(&argvars[1], buf1);
+ int error = FALSE;
+ /* When the optional second argument is non-zero, don't remove matches
+ * for 'wildignore' and don't put matches for 'suffixes' at the end. */
+ if (argvars[2].v_type != VAR_UNKNOWN
+ && get_tv_number_chk(&argvars[2], &error))
+ flags |= WILD_KEEP_ALL;
rettv->v_type = VAR_STRING;
! if (file == NULL || error)
rettv->vval.v_string = NULL;
else
! rettv->vval.v_string = globpath(get_tv_string(&argvars[0]), file,
! flags);
}
/*
*** ../vim-7.2.050/src/ex_getln.c Sat Nov 15 14:10:23 2008
--- src/ex_getln.c Thu Nov 20 18:37:20 2008
***************
*** 2524,2530 ****
&& ccline.xpc->xp_context != EXPAND_NOTHING
&& ccline.xpc->xp_context != EXPAND_UNSUCCESSFUL)
{
! int i = ccline.xpc->xp_pattern - p;
/* If xp_pattern points inside the old cmdbuff it needs to be adjusted
* to point into the newly allocated memory. */
--- 2524,2530 ----
&& ccline.xpc->xp_context != EXPAND_NOTHING
&& ccline.xpc->xp_context != EXPAND_UNSUCCESSFUL)
{
! int i = (int)(ccline.xpc->xp_pattern - p);
/* If xp_pattern points inside the old cmdbuff it needs to be adjusted
* to point into the newly allocated memory. */
***************
*** 4897,4903 ****
if (s == NULL)
return FAIL;
sprintf((char *)s, "%s/%s*.vim", dirname, pat);
! all = globpath(p_rtp, s);
vim_free(s);
if (all == NULL)
return FAIL;
--- 4897,4903 ----
if (s == NULL)
return FAIL;
sprintf((char *)s, "%s/%s*.vim", dirname, pat);
! all = globpath(p_rtp, s, 0);
vim_free(s);
if (all == NULL)
return FAIL;
***************
*** 4938,4946 ****
* newlines. Returns NULL for an error or no matches.
*/
char_u *
! globpath(path, file)
char_u *path;
char_u *file;
{
expand_T xpc;
char_u *buf;
--- 4938,4947 ----
* newlines. Returns NULL for an error or no matches.
*/
char_u *
! globpath(path, file, expand_options)
char_u *path;
char_u *file;
+ int expand_options;
{
expand_T xpc;
char_u *buf;
***************
*** 4969,4978 ****
{
add_pathsep(buf);
STRCAT(buf, file);
! if (ExpandFromContext(&xpc, buf, &num_p, &p, WILD_SILENT) != FAIL
! && num_p > 0)
{
! ExpandEscape(&xpc, buf, num_p, p, WILD_SILENT);
for (len = 0, i = 0; i < num_p; ++i)
len += (int)STRLEN(p[i]) + 1;
--- 4970,4979 ----
{
add_pathsep(buf);
STRCAT(buf, file);
! if (ExpandFromContext(&xpc, buf, &num_p, &p,
! WILD_SILENT|expand_options) != FAIL && num_p > 0)
{
! ExpandEscape(&xpc, buf, num_p, p, WILD_SILENT|expand_options);
for (len = 0, i = 0; i < num_p; ++i)
len += (int)STRLEN(p[i]) + 1;
*** ../vim-7.2.050/src/proto/ex_getln.pro Wed May 28 16:49:01 2008
--- src/proto/ex_getln.pro Thu Nov 20 18:27:57 2008
***************
*** 31,37 ****
void set_cmd_context __ARGS((expand_T *xp, char_u *str, int len, int col));
int expand_cmdline __ARGS((expand_T *xp, char_u *str, int col, int *matchcount, char_u ***matches));
int ExpandGeneric __ARGS((expand_T *xp, regmatch_T *regmatch, int *num_file, char_u ***file, char_u *((*func)(expand_T *, int))));
! char_u *globpath __ARGS((char_u *path, char_u *file));
void init_history __ARGS((void));
int get_histtype __ARGS((char_u *name));
void add_to_history __ARGS((int histype, char_u *new_entry, int in_map, int sep));
--- 31,37 ----
void set_cmd_context __ARGS((expand_T *xp, char_u *str, int len, int col));
int expand_cmdline __ARGS((expand_T *xp, char_u *str, int col, int *matchcount, char_u ***matches));
int ExpandGeneric __ARGS((expand_T *xp, regmatch_T *regmatch, int *num_file, char_u ***file, char_u *((*func)(expand_T *, int))));
! char_u *globpath __ARGS((char_u *path, char_u *file, int expand_options));
void init_history __ARGS((void));
int get_histtype __ARGS((char_u *name));
void add_to_history __ARGS((int histype, char_u *new_entry, int in_map, int sep));
*** ../vim-7.2.050/runtime/doc/eval.txt Sun Nov 9 13:43:25 2008
--- runtime/doc/eval.txt Thu Nov 27 22:17:13 2008
***************
*** 1,4 ****
! *eval.txt* For Vim version 7.2. Last change: 2008 Nov 02
VIM REFERENCE MANUAL by Bram Moolenaar
--- 1,4 ----
! *eval.txt* For Vim version 7.2. Last change: 2008 Nov 27
VIM REFERENCE MANUAL by Bram Moolenaar
***************
*** 1706,1712 ****
exists( {expr}) Number TRUE if {expr} exists
extend({expr1}, {expr2} [, {expr3}])
List/Dict insert items of {expr2} into {expr1}
! expand( {expr}) String expand special keywords in {expr}
feedkeys( {string} [, {mode}]) Number add key sequence to typeahead buffer
filereadable( {file}) Number TRUE if {file} is a readable file
filewritable( {file}) Number TRUE if {file} is a writable file
--- 1709,1715 ----
exists( {expr}) Number TRUE if {expr} exists
extend({expr1}, {expr2} [, {expr3}])
List/Dict insert items of {expr2} into {expr1}
! expand( {expr} [, {flag}]) String expand special keywords in {expr}
feedkeys( {string} [, {mode}]) Number add key sequence to typeahead buffer
filereadable( {file}) Number TRUE if {file} is a readable file
filewritable( {file}) Number TRUE if {file} is a writable file
***************
*** 1758,1765 ****
getwinposx() Number X coord in pixels of GUI Vim window
getwinposy() Number Y coord in pixels of GUI Vim window
getwinvar( {nr}, {varname}) any variable {varname} in window {nr}
! glob( {expr}) String expand file wildcards in {expr}
! globpath( {path}, {expr}) String do glob({expr}) for all dirs in {path}
has( {feature}) Number TRUE if feature {feature} supported
has_key( {dict}, {key}) Number TRUE if {dict} has entry {key}
haslocaldir() Number TRUE if current window executed |:lcd|
--- 1761,1769 ----
getwinposx() Number X coord in pixels of GUI Vim window
getwinposy() Number Y coord in pixels of GUI Vim window
getwinvar( {nr}, {varname}) any variable {varname} in window {nr}
! glob( {expr} [, {flag}]) String expand file wildcards in {expr}
! globpath( {path}, {expr} [, {flag}])
! String do glob({expr}) for all dirs in {path}
has( {feature}) Number TRUE if feature {feature} supported
has_key( {dict}, {key}) Number TRUE if {dict} has entry {key}
haslocaldir() Number TRUE if current window executed |:lcd|
***************
*** 3286,3299 ****
:let list_is_on = getwinvar(2, '&list')
:echo "myvar = " . getwinvar(1, 'myvar')
<
! *glob()*
! glob({expr}) Expand the file wildcards in {expr}. See |wildcards| for the
use of special characters.
The result is a String.
When there are several matches, they are separated by <NL>
characters.
! The 'wildignore' option applies: Names matching one of the
! patterns in 'wildignore' will be skipped.
If the expansion fails, the result is an empty string.
A name for a non-existing file is not included.
--- 3290,3305 ----
:let list_is_on = getwinvar(2, '&list')
:echo "myvar = " . getwinvar(1, 'myvar')
<
! glob({expr} [, {flag}]) *glob()*
! Expand the file wildcards in {expr}. See |wildcards| for the
use of special characters.
The result is a String.
When there are several matches, they are separated by <NL>
characters.
! Unless the optional {flag} argument is given and is non-zero,
! the 'suffixes' and 'wildignore' options apply: Names matching
! one of the patterns in 'wildignore' will be skipped and
! 'suffixes' affect the ordering of matches.
If the expansion fails, the result is an empty string.
A name for a non-existing file is not included.
***************
*** 3307,3326 ****
See |expand()| for expanding special Vim variables. See
|system()| for getting the raw output of an external command.
! globpath({path}, {expr}) *globpath()*
Perform glob() on all directories in {path} and concatenate
the results. Example: >
:echo globpath(&rtp, "syntax/c.vim")
< {path} is a comma-separated list of directory names. Each
directory name is prepended to {expr} and expanded like with
! glob(). A path separator is inserted when needed.
To add a comma inside a directory name escape it with a
backslash. Note that on MS-Windows a directory may have a
trailing backslash, remove it if you put a comma after it.
If the expansion fails for one of the directories, there is no
error message.
! The 'wildignore' option applies: Names matching one of the
! patterns in 'wildignore' will be skipped.
The "**" item can be used to search in a directory tree.
For example, to find all "README.txt" files in the directories
--- 3313,3334 ----
See |expand()| for expanding special Vim variables. See
|system()| for getting the raw output of an external command.
! globpath({path}, {expr} [, {flag}]) *globpath()*
Perform glob() on all directories in {path} and concatenate
the results. Example: >
:echo globpath(&rtp, "syntax/c.vim")
< {path} is a comma-separated list of directory names. Each
directory name is prepended to {expr} and expanded like with
! |glob()|. A path separator is inserted when needed.
To add a comma inside a directory name escape it with a
backslash. Note that on MS-Windows a directory may have a
trailing backslash, remove it if you put a comma after it.
If the expansion fails for one of the directories, there is no
error message.
! Unless the optional {flag} argument is given and is non-zero,
! the 'suffixes' and 'wildignore' options apply: Names matching
! one of the patterns in 'wildignore' will be skipped and
! 'suffixes' affect the ordering of matches.
The "**" item can be used to search in a directory tree.
For example, to find all "README.txt" files in the directories
*** ../vim-7.2.050/runtime/doc/options.txt Sat Aug 9 19:36:49 2008
--- runtime/doc/options.txt Tue Nov 25 23:43:55 2008
***************
*** 1,4 ****
! *options.txt* For Vim version 7.2. Last change: 2008 Aug 06
VIM REFERENCE MANUAL by Bram Moolenaar
--- 1,4 ----
! *options.txt* For Vim version 7.2. Last change: 2008 Nov 25
VIM REFERENCE MANUAL by Bram Moolenaar
***************
*** 7472,7478 ****
{not available when compiled without the |+wildignore|
feature}
A list of file patterns. A file that matches with one of these
! patterns is ignored when completing file or directory names.
The pattern is used like with |:autocmd|, see |autocmd-patterns|.
Also see 'suffixes'.
Example: >
--- 7481,7489 ----
{not available when compiled without the |+wildignore|
feature}
A list of file patterns. A file that matches with one of these
! patterns is ignored when completing file or directory names, and
! influences the result of |expand()|, |glob()| and |globpath()| unless
! a flag is passed to disable this.
The pattern is used like with |:autocmd|, see |autocmd-patterns|.
Also see 'suffixes'.
Example: >
*** ../vim-7.2.050/src/version.c Fri Nov 28 10:08:05 2008
--- src/version.c Fri Nov 28 10:55:44 2008
***************
*** 678,679 ****
--- 678,681 ----
{ /* Add new patch number below this line */
+ /**/
+ 51,
/**/
--
Not too long ago, unzipping in public was illegal...
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ download, build and distribute -- http://www.A-A-P.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|