]>
Commit | Line | Data |
---|---|---|
65bfde4c AG |
1 | To: vim-dev@vim.org |
2 | Subject: Patch 7.2.051 | |
3 | Fcc: outbox | |
4 | From: Bram Moolenaar <Bram@moolenaar.net> | |
5 | Mime-Version: 1.0 | |
6 | Content-Type: text/plain; charset=ISO-8859-1 | |
7 | Content-Transfer-Encoding: 8bit | |
8 | ------------ | |
9 | ||
10 | Patch 7.2.051 | |
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 | |
15 | ||
16 | ||
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 | |
19 | *************** | |
20 | *** 7564,7571 **** | |
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}, | |
26 | {"has", 1, 1, f_has}, | |
27 | {"has_key", 2, 2, f_has_key}, | |
28 | {"haslocaldir", 0, 0, f_haslocaldir}, | |
29 | --- 7564,7571 ---- | |
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}, | |
35 | {"has", 1, 1, f_has}, | |
36 | {"has_key", 2, 2, f_has_key}, | |
37 | {"haslocaldir", 0, 0, f_haslocaldir}, | |
38 | *************** | |
39 | *** 9557,9563 **** | |
40 | else | |
41 | { | |
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; | |
47 | --- 9557,9563 ---- | |
48 | else | |
49 | { | |
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; | |
55 | *************** | |
56 | *** 11323,11335 **** | |
57 | typval_T *argvars; | |
58 | typval_T *rettv; | |
59 | { | |
60 | expand_T xpc; | |
61 | ||
62 | ! ExpandInit(&xpc); | |
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); | |
67 | } | |
68 | ||
69 | /* | |
70 | --- 11323,11347 ---- | |
71 | typval_T *argvars; | |
72 | typval_T *rettv; | |
73 | { | |
74 | + int flags = WILD_SILENT|WILD_USE_NL; | |
75 | expand_T xpc; | |
76 | + int error = FALSE; | |
77 | ||
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; | |
84 | ! if (!error) | |
85 | ! { | |
86 | ! ExpandInit(&xpc); | |
87 | ! xpc.xp_context = EXPAND_FILES; | |
88 | ! rettv->vval.v_string = ExpandOne(&xpc, get_tv_string(&argvars[0]), | |
89 | ! NULL, flags, WILD_ALL); | |
90 | ! } | |
91 | ! else | |
92 | ! rettv->vval.v_string = NULL; | |
93 | } | |
94 | ||
95 | /* | |
96 | *************** | |
97 | *** 11340,11353 **** | |
98 | typval_T *argvars; | |
99 | typval_T *rettv; | |
100 | { | |
101 | char_u buf1[NUMBUFLEN]; | |
102 | char_u *file = get_tv_string_buf_chk(&argvars[1], buf1); | |
103 | ||
104 | rettv->v_type = VAR_STRING; | |
105 | ! if (file == NULL) | |
106 | rettv->vval.v_string = NULL; | |
107 | else | |
108 | ! rettv->vval.v_string = globpath(get_tv_string(&argvars[0]), file); | |
109 | } | |
110 | ||
111 | /* | |
112 | --- 11352,11373 ---- | |
113 | typval_T *argvars; | |
114 | typval_T *rettv; | |
115 | { | |
116 | + int flags = 0; | |
117 | char_u buf1[NUMBUFLEN]; | |
118 | char_u *file = get_tv_string_buf_chk(&argvars[1], buf1); | |
119 | + int error = FALSE; | |
120 | ||
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; | |
129 | else | |
130 | ! rettv->vval.v_string = globpath(get_tv_string(&argvars[0]), file, | |
131 | ! flags); | |
132 | } | |
133 | ||
134 | /* | |
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 | |
137 | *************** | |
138 | *** 2524,2530 **** | |
139 | && ccline.xpc->xp_context != EXPAND_NOTHING | |
140 | && ccline.xpc->xp_context != EXPAND_UNSUCCESSFUL) | |
141 | { | |
142 | ! int i = ccline.xpc->xp_pattern - p; | |
143 | ||
144 | /* If xp_pattern points inside the old cmdbuff it needs to be adjusted | |
145 | * to point into the newly allocated memory. */ | |
146 | --- 2524,2530 ---- | |
147 | && ccline.xpc->xp_context != EXPAND_NOTHING | |
148 | && ccline.xpc->xp_context != EXPAND_UNSUCCESSFUL) | |
149 | { | |
150 | ! int i = (int)(ccline.xpc->xp_pattern - p); | |
151 | ||
152 | /* If xp_pattern points inside the old cmdbuff it needs to be adjusted | |
153 | * to point into the newly allocated memory. */ | |
154 | *************** | |
155 | *** 4897,4903 **** | |
156 | if (s == NULL) | |
157 | return FAIL; | |
158 | sprintf((char *)s, "%s/%s*.vim", dirname, pat); | |
159 | ! all = globpath(p_rtp, s); | |
160 | vim_free(s); | |
161 | if (all == NULL) | |
162 | return FAIL; | |
163 | --- 4897,4903 ---- | |
164 | if (s == NULL) | |
165 | return FAIL; | |
166 | sprintf((char *)s, "%s/%s*.vim", dirname, pat); | |
167 | ! all = globpath(p_rtp, s, 0); | |
168 | vim_free(s); | |
169 | if (all == NULL) | |
170 | return FAIL; | |
171 | *************** | |
172 | *** 4938,4946 **** | |
173 | * newlines. Returns NULL for an error or no matches. | |
174 | */ | |
175 | char_u * | |
176 | ! globpath(path, file) | |
177 | char_u *path; | |
178 | char_u *file; | |
179 | { | |
180 | expand_T xpc; | |
181 | char_u *buf; | |
182 | --- 4938,4947 ---- | |
183 | * newlines. Returns NULL for an error or no matches. | |
184 | */ | |
185 | char_u * | |
186 | ! globpath(path, file, expand_options) | |
187 | char_u *path; | |
188 | char_u *file; | |
189 | + int expand_options; | |
190 | { | |
191 | expand_T xpc; | |
192 | char_u *buf; | |
193 | *************** | |
194 | *** 4969,4978 **** | |
195 | { | |
196 | add_pathsep(buf); | |
197 | STRCAT(buf, file); | |
198 | ! if (ExpandFromContext(&xpc, buf, &num_p, &p, WILD_SILENT) != FAIL | |
199 | ! && num_p > 0) | |
200 | { | |
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; | |
204 | ||
205 | --- 4970,4979 ---- | |
206 | { | |
207 | add_pathsep(buf); | |
208 | STRCAT(buf, file); | |
209 | ! if (ExpandFromContext(&xpc, buf, &num_p, &p, | |
210 | ! WILD_SILENT|expand_options) != FAIL && num_p > 0) | |
211 | { | |
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; | |
215 | ||
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 | |
218 | *************** | |
219 | *** 31,37 **** | |
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)); | |
227 | --- 31,37 ---- | |
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 | |
237 | *************** | |
238 | *** 1,4 **** | |
239 | ! *eval.txt* For Vim version 7.2. Last change: 2008 Nov 02 | |
240 | ||
241 | ||
242 | VIM REFERENCE MANUAL by Bram Moolenaar | |
243 | --- 1,4 ---- | |
244 | ! *eval.txt* For Vim version 7.2. Last change: 2008 Nov 27 | |
245 | ||
246 | ||
247 | VIM REFERENCE MANUAL by Bram Moolenaar | |
248 | *************** | |
249 | *** 1706,1712 **** | |
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 | |
257 | --- 1709,1715 ---- | |
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 | |
265 | *************** | |
266 | *** 1758,1765 **** | |
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| | |
275 | --- 1761,1769 ---- | |
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| | |
285 | *************** | |
286 | *** 3286,3299 **** | |
287 | :let list_is_on = getwinvar(2, '&list') | |
288 | :echo "myvar = " . getwinvar(1, 'myvar') | |
289 | < | |
290 | ! *glob()* | |
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> | |
295 | characters. | |
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. | |
300 | ||
301 | --- 3290,3305 ---- | |
302 | :let list_is_on = getwinvar(2, '&list') | |
303 | :echo "myvar = " . getwinvar(1, 'myvar') | |
304 | < | |
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> | |
310 | characters. | |
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. | |
317 | ||
318 | *************** | |
319 | *** 3307,3326 **** | |
320 | See |expand()| for expanding special Vim variables. See | |
321 | |system()| for getting the raw output of an external command. | |
322 | ||
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 | |
334 | error message. | |
335 | ! The 'wildignore' option applies: Names matching one of the | |
336 | ! patterns in 'wildignore' will be skipped. | |
337 | ||
338 | The "**" item can be used to search in a directory tree. | |
339 | For example, to find all "README.txt" files in the directories | |
340 | --- 3313,3334 ---- | |
341 | See |expand()| for expanding special Vim variables. See | |
342 | |system()| for getting the raw output of an external command. | |
343 | ||
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 | |
355 | error message. | |
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. | |
360 | ||
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 | |
365 | *************** | |
366 | *** 1,4 **** | |
367 | ! *options.txt* For Vim version 7.2. Last change: 2008 Aug 06 | |
368 | ||
369 | ||
370 | VIM REFERENCE MANUAL by Bram Moolenaar | |
371 | --- 1,4 ---- | |
372 | ! *options.txt* For Vim version 7.2. Last change: 2008 Nov 25 | |
373 | ||
374 | ||
375 | VIM REFERENCE MANUAL by Bram Moolenaar | |
376 | *************** | |
377 | *** 7472,7478 **** | |
378 | {not available when compiled without the |+wildignore| | |
379 | feature} | |
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|. | |
383 | Also see 'suffixes'. | |
384 | Example: > | |
385 | --- 7481,7489 ---- | |
386 | {not available when compiled without the |+wildignore| | |
387 | feature} | |
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|. | |
393 | Also see 'suffixes'. | |
394 | Example: > | |
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 | |
397 | *************** | |
398 | *** 678,679 **** | |
399 | --- 678,681 ---- | |
400 | { /* Add new patch number below this line */ | |
401 | + /**/ | |
402 | + 51, | |
403 | /**/ | |
404 | ||
405 | -- | |
406 | Not too long ago, unzipping in public was illegal... | |
407 | ||
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 /// |