To: vim_dev@googlegroups.com Subject: Patch 9.0.0270 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 9.0.0270 Problem: Some values of 'path' and 'tags' do not work in the tiny version. Solution: Graduate the +path_extra feature. Files: runtime/doc/editing.txt, runtime/doc/options.txt, runtime/doc/various.txt, src/evalfunc.c, src/findfile.c, src/tag.c, src/version.c, src/errors.h, src/feature.h *** ../vim-9.0.0269/runtime/doc/editing.txt 2022-08-25 16:02:09.669816438 +0100 --- runtime/doc/editing.txt 2022-08-25 18:00:38.258783212 +0100 *************** *** 1703,1710 **** ============================================================================== 11. File Searching *file-searching* - {not available when compiled without the |+path_extra| feature} - The file searching is currently used for the 'path', 'cdpath' and 'tags' options, for |finddir()| and |findfile()|. Other commands use |wildcards| which is slightly different. --- 1703,1708 ---- *** ../vim-9.0.0269/runtime/doc/options.txt 2022-08-25 16:02:09.673816447 +0100 --- runtime/doc/options.txt 2022-08-25 18:01:25.310727197 +0100 *************** *** 5921,5927 **** "http://www.vim.org" will make ":find index.html" work. - Search upwards and downwards in a directory tree using "*", "**" and ";". See |file-searching| for info and syntax. - {not available when compiled without the |+path_extra| feature} - Careful with '\' characters, type two to get one in the option: > :set path=.,c:\\include < Or just use '/' instead: > --- 5949,5954 ---- *************** *** 7972,7979 **** a directory tree. See |file-searching|. E.g., "/lib/**/tags" will find all files named "tags" below "/lib". The filename itself cannot contain wildcards, it is used as-is. E.g., "/lib/**/tags?" will find ! files called "tags?". {not available when compiled without the ! |+path_extra| feature} The |tagfiles()| function can be used to get a list of the file names actually used. If Vim was compiled with the |+emacs_tags| feature, Emacs-style tag --- 8000,8006 ---- a directory tree. See |file-searching|. E.g., "/lib/**/tags" will find all files named "tags" below "/lib". The filename itself cannot contain wildcards, it is used as-is. E.g., "/lib/**/tags?" will find ! files called "tags?". The |tagfiles()| function can be used to get a list of the file names actually used. If Vim was compiled with the |+emacs_tags| feature, Emacs-style tag *** ../vim-9.0.0269/runtime/doc/various.txt 2022-08-25 16:02:09.673816447 +0100 --- runtime/doc/various.txt 2022-08-25 18:01:59.862684191 +0100 *************** *** 433,439 **** check the actual size of a Number. m *+ole* Win32 GUI only: |ole-interface| N *+packages* Loading |packages| ! N *+path_extra* Up/downwards search in 'path' and 'tags' m *+perl* Perl interface |perl| m *+perl/dyn* Perl interface |perl-dynamic| |/dyn| N *+persistent_undo* Persistent undo |undo-persistence| --- 433,440 ---- check the actual size of a Number. m *+ole* Win32 GUI only: |ole-interface| N *+packages* Loading |packages| ! T *+path_extra* Up/downwards search in 'path' and 'tags' Always ! enabled since 9.0.0270 m *+perl* Perl interface |perl| m *+perl/dyn* Perl interface |perl-dynamic| |/dyn| N *+persistent_undo* Persistent undo |undo-persistence| *** ../vim-9.0.0269/src/evalfunc.c 2022-08-25 17:39:26.805017714 +0100 --- src/evalfunc.c 2022-08-25 18:03:21.926576288 +0100 *************** *** 5954,5966 **** 0 #endif }, ! {"path_extra", ! #ifdef FEAT_PATH_EXTRA ! 1 ! #else ! 0 ! #endif ! }, {"perl", #if defined(FEAT_PERL) && !defined(DYNAMIC_PERL) 1 --- 5954,5960 ---- 0 #endif }, ! {"path_extra", 1}, {"perl", #if defined(FEAT_PERL) && !defined(DYNAMIC_PERL) 1 *** ../vim-9.0.0269/src/findfile.c 2022-08-25 16:02:09.677816456 +0100 --- src/findfile.c 2022-08-25 18:07:22.870222209 +0100 *************** *** 67,75 **** // the fix part (no wildcards) and the part containing the wildcards // of the search path char_u *ffs_fix_path; - #ifdef FEAT_PATH_EXTRA char_u *ffs_wc_path; - #endif // files/dirs found in the above directory, matched by the first wildcard // of wc_part --- 67,73 ---- *************** *** 97,107 **** { struct ff_visited *ffv_next; - #ifdef FEAT_PATH_EXTRA // Visited directories are different if the wildcard string are // different. So we have to save it. char_u *ffv_wc_path; ! #endif // for unix use inode etc for comparison (needed because of links), else // use filename. #ifdef UNIX --- 95,104 ---- { struct ff_visited *ffv_next; // Visited directories are different if the wildcard string are // different. So we have to save it. char_u *ffv_wc_path; ! // for unix use inode etc for comparison (needed because of links), else // use filename. #ifdef UNIX *************** *** 173,193 **** char_u *ffsc_file_to_search; char_u *ffsc_start_dir; char_u *ffsc_fix_path; - #ifdef FEAT_PATH_EXTRA char_u *ffsc_wc_path; int ffsc_level; char_u **ffsc_stopdirs_v; - #endif int ffsc_find_what; int ffsc_tagfile; } ff_search_ctx_T; // locally needed functions - #ifdef FEAT_PATH_EXTRA static int ff_check_visited(ff_visited_T **, char_u *, char_u *); - #else - static int ff_check_visited(ff_visited_T **, char_u *); - #endif static void vim_findfile_free_visited(void *search_ctx_arg); static void vim_findfile_free_visited_list(ff_visited_list_hdr_T **list_headp); static void ff_free_visited_list(ff_visited_T *vl); --- 170,184 ---- *************** *** 197,210 **** static ff_stack_T *ff_pop(ff_search_ctx_T *search_ctx); static void ff_clear(ff_search_ctx_T *search_ctx); static void ff_free_stack_element(ff_stack_T *stack_ptr); - #ifdef FEAT_PATH_EXTRA static ff_stack_T *ff_create_stack_element(char_u *, char_u *, int, int); - #else - static ff_stack_T *ff_create_stack_element(char_u *, int, int); - #endif - #ifdef FEAT_PATH_EXTRA static int ff_path_in_stoplist(char_u *, int, char_u **); - #endif static char_u *ff_expand_buffer = NULL; // used for expanding filenames --- 188,195 ---- *************** *** 306,314 **** int tagfile, // expanding names of tags files char_u *rel_fname) // file name to use for "." { - #ifdef FEAT_PATH_EXTRA char_u *wc_part; - #endif ff_stack_T *sptr; ff_search_ctx_T *search_ctx; --- 291,297 ---- *************** *** 409,415 **** #endif } - #ifdef FEAT_PATH_EXTRA /* * If stopdirs are given, split them into an array of pointers. * If this fails (mem allocation), there is no upward search at all or a --- 392,397 ---- *************** *** 464,472 **** search_ctx->ffsc_stopdirs_v[dircount-1] = NULL; } } - #endif - #ifdef FEAT_PATH_EXTRA search_ctx->ffsc_level = level; /* --- 446,452 ---- *************** *** 531,537 **** goto error_return; } else - #endif search_ctx->ffsc_fix_path = vim_strsave(path); if (search_ctx->ffsc_start_dir == NULL) --- 511,516 ---- *************** *** 565,571 **** STRCAT(ff_expand_buffer, search_ctx->ffsc_fix_path); add_pathsep(ff_expand_buffer); } - #ifdef FEAT_PATH_EXTRA else { char_u *p = gettail(search_ctx->ffsc_fix_path); --- 544,549 ---- *************** *** 612,626 **** search_ctx->ffsc_wc_path = temp; } } - #endif vim_free(buf); } sptr = ff_create_stack_element(ff_expand_buffer, ! #ifdef FEAT_PATH_EXTRA ! search_ctx->ffsc_wc_path, ! #endif ! level, 0); if (sptr == NULL) goto error_return; --- 590,600 ---- search_ctx->ffsc_wc_path = temp; } } vim_free(buf); } sptr = ff_create_stack_element(ff_expand_buffer, ! search_ctx->ffsc_wc_path, level, 0); if (sptr == NULL) goto error_return; *************** *** 643,649 **** return NULL; } - #if defined(FEAT_PATH_EXTRA) || defined(PROTO) /* * Get the stopdir string. Check that ';' is not escaped. */ --- 617,622 ---- *************** *** 672,678 **** r_ptr = NULL; return r_ptr; } - #endif /* * Clean up the given search context. Can handle a NULL pointer. --- 645,650 ---- *************** *** 704,713 **** vim_findfile(void *search_ctx_arg) { char_u *file_path; - #ifdef FEAT_PATH_EXTRA char_u *rest_of_wildcards; char_u *path_end = NULL; - #endif ff_stack_T *stackp; int len; int i; --- 676,683 ---- *************** *** 727,744 **** if ((file_path = alloc(MAXPATHL)) == NULL) return NULL; - #ifdef FEAT_PATH_EXTRA // store the end of the start dir -- needed for upward search if (search_ctx->ffsc_start_dir != NULL) path_end = &search_ctx->ffsc_start_dir[ STRLEN(search_ctx->ffsc_start_dir)]; - #endif - #ifdef FEAT_PATH_EXTRA // upward search loop for (;;) { - #endif // downward search loop for (;;) { --- 697,710 ---- *************** *** 774,784 **** if (stackp->ffs_filearray == NULL && ff_check_visited(&search_ctx->ffsc_dir_visited_list ->ffvl_visited_list, ! stackp->ffs_fix_path ! #ifdef FEAT_PATH_EXTRA ! , stackp->ffs_wc_path ! #endif ! ) == FAIL) { #ifdef FF_VERBOSE if (p_verbose >= 5) --- 740,746 ---- if (stackp->ffs_filearray == NULL && ff_check_visited(&search_ctx->ffsc_dir_visited_list ->ffvl_visited_list, ! stackp->ffs_fix_path, stackp->ffs_wc_path) == FAIL) { #ifdef FF_VERBOSE if (p_verbose >= 5) *************** *** 859,865 **** goto fail; } - #ifdef FEAT_PATH_EXTRA rest_of_wildcards = stackp->ffs_wc_path; if (*rest_of_wildcards != NUL) { --- 821,826 ---- *************** *** 919,925 **** if (vim_ispathsep(*rest_of_wildcards)) rest_of_wildcards++; } - #endif /* * Expand wildcards like "*" and "$VAR". --- 880,885 ---- *************** *** 947,964 **** stackp->ffs_filearray_cur = 0; stackp->ffs_stage = 0; } - #ifdef FEAT_PATH_EXTRA else rest_of_wildcards = &stackp->ffs_wc_path[ STRLEN(stackp->ffs_wc_path)]; - #endif if (stackp->ffs_stage == 0) { // this is the first time we work on this directory - #ifdef FEAT_PATH_EXTRA if (*rest_of_wildcards == NUL) - #endif { /* * We don't have further wildcards to expand, so we have to --- 907,920 ---- *************** *** 1008,1030 **** == mch_isdir(file_path))))) #ifndef FF_VERBOSE && (ff_check_visited( ! &search_ctx->ffsc_visited_list->ffvl_visited_list, ! file_path ! #ifdef FEAT_PATH_EXTRA ! , (char_u *)"" ! #endif ! ) == OK) #endif ) { #ifdef FF_VERBOSE if (ff_check_visited( ! &search_ctx->ffsc_visited_list->ffvl_visited_list, ! file_path ! #ifdef FEAT_PATH_EXTRA ! , (char_u *)"" ! #endif ! ) == FAIL) { if (p_verbose >= 5) { --- 964,980 ---- == mch_isdir(file_path))))) #ifndef FF_VERBOSE && (ff_check_visited( ! &search_ctx->ffsc_visited_list ! ->ffvl_visited_list, ! file_path, (char_u *)"") == OK) #endif ) { #ifdef FF_VERBOSE if (ff_check_visited( ! &search_ctx->ffsc_visited_list ! ->ffvl_visited_list, ! file_path, (char_u *)"") == FAIL) { if (p_verbose >= 5) { *************** *** 1074,1080 **** } } } - #ifdef FEAT_PATH_EXTRA else { /* --- 1024,1029 ---- *************** *** 1094,1105 **** stackp->ffs_level - 1, 0)); } } - #endif stackp->ffs_filearray_cur = 0; stackp->ffs_stage = 1; } - #ifdef FEAT_PATH_EXTRA /* * if wildcards contains '**' we have to descent till we reach the * leaves of the directory tree. --- 1043,1052 ---- *************** *** 1119,1132 **** stackp->ffs_wc_path, stackp->ffs_level - 1, 1)); } } - #endif // we are done with the current directory ff_free_stack_element(stackp); } - #ifdef FEAT_PATH_EXTRA // If we reached this, we didn't find anything downwards. // Let's check if we should do an upward search. if (search_ctx->ffsc_start_dir --- 1066,1077 ---- *************** *** 1173,1179 **** else break; } - #endif fail: vim_free(file_path); --- 1118,1123 ---- *************** *** 1222,1230 **** while (vl != NULL) { vp = vl->ffv_next; - #ifdef FEAT_PATH_EXTRA vim_free(vl->ffv_wc_path); - #endif vim_free(vl); vl = vp; } --- 1166,1172 ---- *************** *** 1298,1304 **** return retptr; } - #ifdef FEAT_PATH_EXTRA /* * check if two wildcard paths are equal. Returns TRUE or FALSE. * They are equal if: --- 1240,1245 ---- *************** *** 1339,1345 **** } return s1[i] == s2[j]; } - #endif /* * maintains the list of already visited files and dirs --- 1280,1285 ---- *************** *** 1353,1363 **** static int ff_check_visited( ff_visited_T **visited_list, ! char_u *fname ! #ifdef FEAT_PATH_EXTRA ! , char_u *wc_path ! #endif ! ) { ff_visited_T *vp; #ifdef UNIX --- 1293,1300 ---- static int ff_check_visited( ff_visited_T **visited_list, ! char_u *fname, ! char_u *wc_path) { ff_visited_T *vp; #ifdef UNIX *************** *** 1397,1406 **** fnamecmp(vp->ffv_fname, ff_expand_buffer) == 0 ) { - #ifdef FEAT_PATH_EXTRA // are the wildcard parts equal if (ff_wc_equal(vp->ffv_wc_path, wc_path) == TRUE) - #endif // already visited return FAIL; } --- 1334,1341 ---- *************** *** 1429,1440 **** #ifdef UNIX } #endif - #ifdef FEAT_PATH_EXTRA if (wc_path != NULL) vp->ffv_wc_path = vim_strsave(wc_path); else vp->ffv_wc_path = NULL; - #endif vp->ffv_next = *visited_list; *visited_list = vp; --- 1364,1373 ---- *************** *** 1449,1457 **** static ff_stack_T * ff_create_stack_element( char_u *fix_part, - #ifdef FEAT_PATH_EXTRA char_u *wc_part, - #endif int level, int star_star_empty) { --- 1382,1388 ---- *************** *** 1474,1490 **** fix_part = (char_u *)""; new->ffs_fix_path = vim_strsave(fix_part); - #ifdef FEAT_PATH_EXTRA if (wc_part == NULL) wc_part = (char_u *)""; new->ffs_wc_path = vim_strsave(wc_part); - #endif ! if (new->ffs_fix_path == NULL ! #ifdef FEAT_PATH_EXTRA ! || new->ffs_wc_path == NULL ! #endif ! ) { ff_free_stack_element(new); new = NULL; --- 1405,1415 ---- fix_part = (char_u *)""; new->ffs_fix_path = vim_strsave(fix_part); if (wc_part == NULL) wc_part = (char_u *)""; new->ffs_wc_path = vim_strsave(wc_part); ! if (new->ffs_fix_path == NULL || new->ffs_wc_path == NULL) { ff_free_stack_element(new); new = NULL; *************** *** 1532,1540 **** { // vim_free handles possible NULL pointers vim_free(stack_ptr->ffs_fix_path); - #ifdef FEAT_PATH_EXTRA vim_free(stack_ptr->ffs_wc_path); - #endif if (stack_ptr->ffs_filearray != NULL) FreeWild(stack_ptr->ffs_filearray_size, stack_ptr->ffs_filearray); --- 1457,1463 ---- *************** *** 1557,1567 **** vim_free(search_ctx->ffsc_file_to_search); vim_free(search_ctx->ffsc_start_dir); vim_free(search_ctx->ffsc_fix_path); - #ifdef FEAT_PATH_EXTRA vim_free(search_ctx->ffsc_wc_path); - #endif - #ifdef FEAT_PATH_EXTRA if (search_ctx->ffsc_stopdirs_v != NULL) { int i = 0; --- 1480,1487 ---- *************** *** 1574,1592 **** vim_free(search_ctx->ffsc_stopdirs_v); } search_ctx->ffsc_stopdirs_v = NULL; - #endif // reset everything search_ctx->ffsc_file_to_search = NULL; search_ctx->ffsc_start_dir = NULL; search_ctx->ffsc_fix_path = NULL; - #ifdef FEAT_PATH_EXTRA search_ctx->ffsc_wc_path = NULL; search_ctx->ffsc_level = 0; - #endif } - #ifdef FEAT_PATH_EXTRA /* * check if the given path is in the stopdirs * returns TRUE if yes else FALSE --- 1494,1508 ---- *************** *** 1623,1629 **** } return FALSE; } - #endif /* * Find the file name "ptr[len]" in the path. Also finds directory names. --- 1539,1544 ---- *************** *** 1873,1884 **** buf[0] = 0; copy_option_part(&dir, buf, MAXPATHL, " ,"); - # ifdef FEAT_PATH_EXTRA // get the stopdir string r_ptr = vim_findfile_stopdir(buf); - # else - r_ptr = NULL; - # endif fdip_search_ctx = vim_findfile_init(buf, ff_file_to_find, r_ptr, 100, FALSE, find_what, fdip_search_ctx, FALSE, rel_fname); --- 1788,1795 ---- *** ../vim-9.0.0269/src/tag.c 2022-08-22 16:35:41.698700428 +0100 --- src/tag.c 2022-08-25 18:07:57.154168275 +0100 *************** *** 3398,3408 **** buf[0] = NUL; (void)copy_option_part(&tnp->tn_np, buf, MAXPATHL - 1, " ,"); - #ifdef FEAT_PATH_EXTRA r_ptr = vim_findfile_stopdir(buf); - #else - r_ptr = NULL; - #endif // move the filename one char forward and truncate the // filepath with a NUL filename = gettail(buf); --- 3398,3404 ---- *** ../vim-9.0.0269/src/version.c 2022-08-25 17:39:26.805017714 +0100 --- src/version.c 2022-08-25 18:09:53.646164617 +0100 *************** *** 448,458 **** #else "-packages", #endif - #ifdef FEAT_PATH_EXTRA "+path_extra", - #else - "-path_extra", - #endif #ifdef FEAT_PERL # ifdef DYNAMIC_PERL "+perl/dyn", --- 448,454 ---- *** ../vim-9.0.0269/src/errors.h 2022-08-25 16:02:09.677816456 +0100 --- src/errors.h 2022-08-25 18:08:15.526139046 +0100 *************** *** 849,858 **** INIT(= N_("E341: Internal error: lalloc(0, )")); EXTERN char e_out_of_memory_allocating_nr_bytes[] INIT(= N_("E342: Out of memory! (allocating %lu bytes)")); - #ifdef FEAT_PATH_EXTRA EXTERN char e_invalid_path_number_must_be_at_end_of_path_or_be_followed_by_str[] INIT(= N_("E343: Invalid path: '**[number]' must be at the end of the path or be followed by '%s'.")); - #endif EXTERN char e_cant_find_directory_str_in_cdpath[] INIT(= N_("E344: Can't find directory \"%s\" in cdpath")); EXTERN char e_cant_find_file_str_in_path[] --- 849,856 ---- *** ../vim-9.0.0269/src/feature.h 2022-08-25 16:02:09.677816456 +0100 --- src/feature.h 2022-08-25 18:08:22.106128536 +0100 *************** *** 117,122 **** --- 117,123 ---- * +smartindent smart C code indenting when the 'si' option is set. * +textobjects Text objects: "vaw", "das", etc. * +file_in_path "gf" and "" commands. + * +path_extra up/downwards searching in 'path' and 'tags'. * * Obsolete: * +tag_old_static Old style static tags: "file:tag file ..". *************** *** 211,223 **** #endif /* - * +path_extra up/downwards searching in 'path' and 'tags'. - */ - #ifdef FEAT_NORMAL - # define FEAT_PATH_EXTRA - #endif - - /* * +rightleft Right-to-left editing/typing support. */ #if defined(FEAT_BIG) && !defined(DISABLE_RIGHTLEFT) --- 212,217 ---- *** ../vim-9.0.0269/src/version.c 2022-08-25 17:39:26.805017714 +0100 --- src/version.c 2022-08-25 18:09:53.646164617 +0100 *************** *** 729,730 **** --- 725,728 ---- { /* Add new patch number below this line */ + /**/ + 270, /**/ -- Men may not be seen publicly in any kind of strapless gown. [real standing law in Florida, United States of America] /// Bram Moolenaar -- Bram@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 ///