home *** CD-ROM | disk | FTP | other *** search
/ vim.ftp.fu-berlin.de / 2015-02-03.vim.ftp.fu-berlin.de.tar / vim.ftp.fu-berlin.de / patches / 6.1.423 < prev    next >
Encoding:
Internet Message Format  |  2003-03-27  |  19.8 KB

  1. To: vim-dev@vim.org
  2. Subject: Patch 6.1.423
  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 6.1.423
  11. Problem:    Can't find arbitrary text in help files.
  12. Solution:   Added the ":helpgrep" command.
  13. Files:        runtime/doc/various.txt, src/ex_cmds.h, src/ex_docmd.c,
  14.         src/proto/quickfix.pro, src/quickfix.c
  15.  
  16.  
  17. *** ../vim61.422/runtime/doc/various.txt    Sat Mar  8 20:33:31 2003
  18. --- runtime/doc/various.txt    Fri Mar 28 21:59:30 2003
  19. ***************
  20. *** 1,4 ****
  21. ! *various.txt*   For Vim version 6.1.  Last change: 2003 Feb 15
  22.   
  23.   
  24.             VIM REFERENCE MANUAL    by Bram Moolenaar
  25. --- 1,4 ----
  26. ! *various.txt*   For Vim version 6.1.  Last change: 2003 Mar 28
  27.   
  28.   
  29.             VIM REFERENCE MANUAL    by Bram Moolenaar
  30. ***************
  31. *** 534,542 ****
  32.                   :help so<C-V><CR>only
  33.   <            {not in Vi}
  34.   
  35. ! When no argument is given the file given with the 'helpfile' option will be
  36. ! opened.  Otherwise the specified tag is searched for in all "doc/tags" files
  37. ! in the directories specified in the 'runtimepath' option.
  38.   
  39.   The initial height of the help window can be set with the 'helpheight' option
  40.   (default 20).
  41. --- 542,569 ----
  42.                   :help so<C-V><CR>only
  43.   <            {not in Vi}
  44.   
  45. !                             *:helpg* *:helpgrep*
  46. ! :helpg[rep] {pattern}    
  47. !             Search all help text files and make a list of lines
  48. !             in which {pattern} matches.  Jumps to the first match.
  49. !             You can navigate through the matches with the
  50. !             |quickfix| commands, e.g., |:cnext| to jump to the
  51. !             next one.  Or use |:cwindow| to get the list of
  52. !             matches in the quickfix window.
  53. !             {pattern} is used as a Vim regexp |pattern|.
  54. !             'ignorecase' is not used, add "\c" to ignore case.
  55. !             Example for case sensitive search: >
  56. !                 :helpgrep Uganda
  57. ! <            Example for case ignoring search: >
  58. !                 :helpgrep uganda\c
  59. ! <            Cannot be followed by another command, everything is
  60. !             used as part of the pattern.  But you can use
  61. !             |:execute| when needed.
  62. ! When no argument is given to |:help| the file given with the 'helpfile' option
  63. ! will be opened.  Otherwise the specified tag is searched for in all "doc/tags"
  64. ! files in the directories specified in the 'runtimepath' option.
  65.   
  66.   The initial height of the help window can be set with the 'helpheight' option
  67.   (default 20).
  68. *** ../vim61.422/src/ex_cmds.h    Sat Mar 15 16:33:38 2003
  69. --- src/ex_cmds.h    Fri Mar 28 21:26:14 2003
  70. ***************
  71. *** 380,385 ****
  72. --- 380,387 ----
  73.               EXTRA|NOTRLCOM),
  74.   EX(CMD_helpfind,    "helpfind",    ex_helpfind,
  75.               EXTRA|NOTRLCOM),
  76. + EX(CMD_helpgrep,    "helpgrep",    ex_helpgrep,
  77. +             EXTRA|NOTRLCOM|NEEDARG),
  78.   EX(CMD_helptags,    "helptags",    ex_helptags,
  79.               NEEDARG|FILE1|TRLBAR|CMDWIN),
  80.   EX(CMD_hardcopy,    "hardcopy",    ex_hardcopy,
  81. *** ../vim61.422/src/ex_docmd.c    Sat Mar 15 17:55:18 2003
  82. --- src/ex_docmd.c    Fri Mar 28 19:33:38 2003
  83. ***************
  84. *** 115,120 ****
  85. --- 115,121 ----
  86.   # define ex_cfile        ex_ni
  87.   # define qf_list        ex_ni
  88.   # define qf_age            ex_ni
  89. + # define ex_helpgrep        ex_ni
  90.   #endif
  91.   #if !defined(FEAT_QUICKFIX) || !defined(FEAT_WINDOWS)
  92.   # define ex_cclose        ex_ni
  93. *** ../vim61.422/src/proto/quickfix.pro    Fri Mar 22 21:41:19 2002
  94. --- src/proto/quickfix.pro    Thu Mar 27 23:19:13 2003
  95. ***************
  96. *** 17,20 ****
  97. --- 17,21 ----
  98.   void ex_cc __ARGS((exarg_T *eap));
  99.   void ex_cnext __ARGS((exarg_T *eap));
  100.   void ex_cfile __ARGS((exarg_T *eap));
  101. + void ex_helpgrep __ARGS((exarg_T *eap));
  102.   /* vim: set ft=c : */
  103. *** ../vim61.422/src/quickfix.c    Sun Mar  9 14:08:43 2003
  104. --- src/quickfix.c    Thu Mar 27 23:40:41 2003
  105. ***************
  106. *** 21,43 ****
  107.       char_u        *dirname;
  108.   };
  109.   
  110. - static void    qf_msg __ARGS((void));
  111. - static void    qf_free __ARGS((int idx));
  112. - static char_u    *qf_types __ARGS((int, int));
  113. - static int    qf_get_fnum __ARGS((char_u *, char_u *));
  114. - static char_u    *qf_push_dir __ARGS((char_u *, struct dir_stack_T **));
  115. - static char_u    *qf_pop_dir __ARGS((struct dir_stack_T **));
  116. - static char_u    *qf_guess_filepath __ARGS((char_u *));
  117. - static void    qf_fmt_text __ARGS((char_u *text, char_u *buf, int bufsize));
  118. - static void    qf_clean_dir_stack __ARGS((struct dir_stack_T **));
  119. - #ifdef FEAT_WINDOWS
  120. - static int    qf_win_pos_update __ARGS((int old_qf_index));
  121. - static buf_T    *qf_find_buf __ARGS((void));
  122. - static void    qf_update_buffer __ARGS((void));
  123. - static void    qf_fill_buffer __ARGS((void));
  124. - #endif
  125. - static char_u    *get_mef_name __ARGS((void));
  126.   static struct dir_stack_T   *dir_stack = NULL;
  127.   
  128.   /*
  129. --- 21,26 ----
  130. ***************
  131. *** 54,60 ****
  132.       char_u        *qf_text;    /* description of the error */
  133.       char_u         qf_virt_col; /* set to TRUE if qf_col is screen column */
  134.       char_u         qf_cleared;/* set to TRUE if line has been deleted */
  135. !     char_u         qf_type;    /* type of the error (mostly 'E') */
  136.       char_u         qf_valid;    /* valid error message detected */
  137.   };
  138.   
  139. --- 37,44 ----
  140.       char_u        *qf_text;    /* description of the error */
  141.       char_u         qf_virt_col; /* set to TRUE if qf_col is screen column */
  142.       char_u         qf_cleared;/* set to TRUE if line has been deleted */
  143. !     char_u         qf_type;    /* type of the error (mostly 'E'); 1 for
  144. !                    :helpgrep */
  145.       char_u         qf_valid;    /* valid error message detected */
  146.   };
  147.   
  148. ***************
  149. *** 102,107 ****
  150. --- 86,110 ----
  151.                   /*   '-' do not include this line */
  152.   };
  153.   
  154. + static void    qf_new_list __ARGS((void));
  155. + static int    qf_add_entry __ARGS((struct qf_line **prevp, char_u *dir, char_u *fname, char_u *msg, long lnum, int col, int virt_col, int nr, int type, int valid));
  156. + static void    qf_msg __ARGS((void));
  157. + static void    qf_free __ARGS((int idx));
  158. + static char_u    *qf_types __ARGS((int, int));
  159. + static int    qf_get_fnum __ARGS((char_u *, char_u *));
  160. + static char_u    *qf_push_dir __ARGS((char_u *, struct dir_stack_T **));
  161. + static char_u    *qf_pop_dir __ARGS((struct dir_stack_T **));
  162. + static char_u    *qf_guess_filepath __ARGS((char_u *));
  163. + static void    qf_fmt_text __ARGS((char_u *text, char_u *buf, int bufsize));
  164. + static void    qf_clean_dir_stack __ARGS((struct dir_stack_T **));
  165. + #ifdef FEAT_WINDOWS
  166. + static int    qf_win_pos_update __ARGS((int old_qf_index));
  167. + static buf_T    *qf_find_buf __ARGS((void));
  168. + static void    qf_update_buffer __ARGS((void));
  169. + static void    qf_fill_buffer __ARGS((void));
  170. + #endif
  171. + static char_u    *get_mef_name __ARGS((void));
  172.   /*
  173.    * Read the errorfile into memory, line by line, building the error list.
  174.    * Return -1 for error, number of errors for success.
  175. ***************
  176. *** 122,128 ****
  177.       long        lnum = 0L;
  178.       int            enr = 0;
  179.       FILE        *fd;
  180. -     struct qf_line  *qfp = NULL;
  181.       struct qf_line  *qfprev = NULL;    /* init to make SASC shut up */
  182.       char_u        *efmp;
  183.       struct eformat  *fmt_first = NULL;
  184. --- 125,130 ----
  185. ***************
  186. *** 176,213 ****
  187.       }
  188.   
  189.       if (newlist || qf_curlist == qf_listcount)
  190. !     {
  191. !     /*
  192. !      * If the current entry is not the last entry, delete entries below
  193. !      * the current entry.  This makes it possible to browse in a tree-like
  194. !      * way with ":grep'.
  195. !      */
  196. !     while (qf_listcount > qf_curlist + 1)
  197. !         qf_free(--qf_listcount);
  198. !     /*
  199. !      * When the stack is full, remove to oldest entry
  200. !      * Otherwise, add a new entry.
  201. !      */
  202. !     if (qf_listcount == LISTCOUNT)
  203. !     {
  204. !         qf_free(0);
  205. !         for (i = 1; i < LISTCOUNT; ++i)
  206. !         qf_lists[i - 1] = qf_lists[i];
  207. !         qf_curlist = LISTCOUNT - 1;
  208. !     }
  209. !     else
  210. !         qf_curlist = qf_listcount++;
  211. !     qf_lists[qf_curlist].qf_index = 0;
  212. !     qf_lists[qf_curlist].qf_count = 0;
  213. !     }
  214.       else if (qf_lists[qf_curlist].qf_count > 0)
  215. -     {
  216.       /* Adding to existing list, find last entry. */
  217.       for (qfprev = qf_lists[qf_curlist].qf_start;
  218.                   qfprev->qf_next != qfprev; qfprev = qfprev->qf_next)
  219.           ;
  220. -     }
  221.   
  222.   /*
  223.    * Each part of the format string is copied and modified from errorformat to
  224. --- 178,190 ----
  225.       }
  226.   
  227.       if (newlist || qf_curlist == qf_listcount)
  228. !     /* make place for a new list */
  229. !     qf_new_list();
  230.       else if (qf_lists[qf_curlist].qf_count > 0)
  231.       /* Adding to existing list, find last entry. */
  232.       for (qfprev = qf_lists[qf_curlist].qf_start;
  233.                   qfprev->qf_next != qfprev; qfprev = qfprev->qf_next)
  234.           ;
  235.   
  236.   /*
  237.    * Each part of the format string is copied and modified from errorformat to
  238. ***************
  239. *** 518,527 ****
  240.               if (*namebuf == NUL)
  241.               {
  242.               EMSG(_("E379: Missing or empty directory name"));
  243. !             goto error1;
  244.               }
  245.               if ((directory = qf_push_dir(namebuf, &dir_stack)) == NULL)
  246. !             goto error1;
  247.           }
  248.           else if (idx == 'X')            /* leave directory */
  249.               directory = qf_pop_dir(&dir_stack);
  250. --- 495,504 ----
  251.               if (*namebuf == NUL)
  252.               {
  253.               EMSG(_("E379: Missing or empty directory name"));
  254. !             goto error2;
  255.               }
  256.               if ((directory = qf_push_dir(namebuf, &dir_stack)) == NULL)
  257. !             goto error2;
  258.           }
  259.           else if (idx == 'X')            /* leave directory */
  260.               directory = qf_pop_dir(&dir_stack);
  261. ***************
  262. *** 540,569 ****
  263.           else if (vim_strchr((char_u *)"CZ", idx) != NULL)
  264.           {                /* continuation of multi-line msg */
  265.           if (qfprev == NULL)
  266. !             goto error1;
  267.           if (*errmsg && !multiignore)
  268.           {
  269.               len = (int)STRLEN(qfprev->qf_text);
  270.               if ((ptr = alloc((unsigned)(len + STRLEN(errmsg) + 2)))
  271.                                       == NULL)
  272. !             goto error1;
  273.               STRCPY(ptr, qfprev->qf_text);
  274.               vim_free(qfprev->qf_text);
  275.               qfprev->qf_text = ptr;
  276.               *(ptr += len) = '\n';
  277.               STRCPY(++ptr, errmsg);
  278.           }
  279. !         if (qfp->qf_nr == -1)
  280. !             qfp->qf_nr = enr;
  281. !         if (vim_isprintc(type) && !qfp->qf_type)
  282. !             qfp->qf_type = type;    /* only printable chars allowed */
  283. !         if (!qfp->qf_lnum)
  284. !             qfp->qf_lnum = lnum;
  285. !         if (!qfp->qf_col)
  286. !             qfp->qf_col = col;
  287. !         qfp->qf_virt_col = use_virt_col;
  288. !         if (!qfp->qf_fnum)
  289. !             qfp->qf_fnum = qf_get_fnum(directory,
  290.                       *namebuf || directory ? namebuf
  291.                         : currfile && valid ? currfile : 0);
  292.           if (idx == 'Z')
  293. --- 517,546 ----
  294.           else if (vim_strchr((char_u *)"CZ", idx) != NULL)
  295.           {                /* continuation of multi-line msg */
  296.           if (qfprev == NULL)
  297. !             goto error2;
  298.           if (*errmsg && !multiignore)
  299.           {
  300.               len = (int)STRLEN(qfprev->qf_text);
  301.               if ((ptr = alloc((unsigned)(len + STRLEN(errmsg) + 2)))
  302.                                       == NULL)
  303. !             goto error2;
  304.               STRCPY(ptr, qfprev->qf_text);
  305.               vim_free(qfprev->qf_text);
  306.               qfprev->qf_text = ptr;
  307.               *(ptr += len) = '\n';
  308.               STRCPY(++ptr, errmsg);
  309.           }
  310. !         if (qfprev->qf_nr == -1)
  311. !             qfprev->qf_nr = enr;
  312. !         if (vim_isprintc(type) && !qfprev->qf_type)
  313. !             qfprev->qf_type = type;  /* only printable chars allowed */
  314. !         if (!qfprev->qf_lnum)
  315. !             qfprev->qf_lnum = lnum;
  316. !         if (!qfprev->qf_col)
  317. !             qfprev->qf_col = col;
  318. !         qfprev->qf_virt_col = use_virt_col;
  319. !         if (!qfprev->qf_fnum)
  320. !             qfprev->qf_fnum = qf_get_fnum(directory,
  321.                       *namebuf || directory ? namebuf
  322.                         : currfile && valid ? currfile : 0);
  323.           if (idx == 'Z')
  324. ***************
  325. *** 598,640 ****
  326.           }
  327.       }
  328.   
  329. !     if ((qfp = (struct qf_line *)alloc((unsigned)sizeof(struct qf_line)))
  330. !                                       == NULL)
  331.           goto error2;
  332. -     qfp->qf_fnum = qf_get_fnum(directory, *namebuf || directory ?
  333. -                   namebuf : currfile && valid ? currfile : 0);
  334. -     if ((qfp->qf_text = vim_strsave(errmsg)) == NULL)
  335. -         goto error1;
  336. -     if (!vim_isprintc(type))    /* only printable chars allowed */
  337. -         type = 0;
  338. -     qfp->qf_lnum = lnum;
  339. -     qfp->qf_col = col;
  340. -     qfp->qf_virt_col = use_virt_col;
  341. -     qfp->qf_nr = enr;
  342. -     qfp->qf_type = type;
  343. -     qfp->qf_valid = valid;
  344. -     if (qf_lists[qf_curlist].qf_count == 0)    /* first element in the list */
  345. -     {
  346. -         qf_lists[qf_curlist].qf_start = qfp;
  347. -         qfp->qf_prev = qfp;    /* first element points to itself */
  348. -     }
  349. -     else
  350. -     {
  351. -         qfp->qf_prev = qfprev;
  352. -         qfprev->qf_next = qfp;
  353. -     }
  354. -     qfp->qf_next = qfp;    /* last element points to itself */
  355. -     qfp->qf_cleared = FALSE;
  356. -     qfprev = qfp;
  357. -     ++qf_lists[qf_curlist].qf_count;
  358. -     if (qf_lists[qf_curlist].qf_index == 0 && qfp->qf_valid)
  359. -                         /* first valid entry */
  360. -     {
  361. -         qf_lists[qf_curlist].qf_index = qf_lists[qf_curlist].qf_count;
  362. -         qf_lists[qf_curlist].qf_ptr = qfp;
  363. -     }
  364.       line_breakcheck();
  365.       }
  366.       if (!ferror(fd))
  367. --- 575,593 ----
  368.           }
  369.       }
  370.   
  371. !     if (qf_add_entry(&qfprev,
  372. !             directory,
  373. !             *namebuf || directory
  374. !                 ? namebuf
  375. !                 : currfile && valid ? currfile : NULL,
  376. !             errmsg,
  377. !             lnum,
  378. !             col,
  379. !             use_virt_col,
  380. !             enr,
  381. !             type,
  382. !             valid) == FAIL)
  383.           goto error2;
  384.       line_breakcheck();
  385.       }
  386.       if (!ferror(fd))
  387. ***************
  388. *** 655,662 ****
  389.       goto qf_init_ok;
  390.       }
  391.       EMSG(_(e_readerrf));
  392. - error1:
  393. -     vim_free(qfp);
  394.   error2:
  395.       qf_free(qf_curlist);
  396.       qf_listcount--;
  397. --- 608,613 ----
  398. ***************
  399. *** 685,690 ****
  400. --- 636,735 ----
  401.   }
  402.   
  403.   /*
  404. +  * Prepare for adding a new quickfix list.
  405. +  */
  406. +     static void
  407. + qf_new_list()
  408. + {
  409. +     int        i;
  410. +     /*
  411. +      * If the current entry is not the last entry, delete entries below
  412. +      * the current entry.  This makes it possible to browse in a tree-like
  413. +      * way with ":grep'.
  414. +      */
  415. +     while (qf_listcount > qf_curlist + 1)
  416. +     qf_free(--qf_listcount);
  417. +     /*
  418. +      * When the stack is full, remove to oldest entry
  419. +      * Otherwise, add a new entry.
  420. +      */
  421. +     if (qf_listcount == LISTCOUNT)
  422. +     {
  423. +     qf_free(0);
  424. +     for (i = 1; i < LISTCOUNT; ++i)
  425. +         qf_lists[i - 1] = qf_lists[i];
  426. +     qf_curlist = LISTCOUNT - 1;
  427. +     }
  428. +     else
  429. +     qf_curlist = qf_listcount++;
  430. +     qf_lists[qf_curlist].qf_index = 0;
  431. +     qf_lists[qf_curlist].qf_count = 0;
  432. + }
  433. + /*
  434. +  * Add an entry to the end of the list of errors.
  435. +  * Returns OK or FAIL.
  436. +  */
  437. +     static int
  438. + qf_add_entry(prevp, dir, fname, msg, lnum, col, virt_col, nr, type, valid)
  439. +     struct qf_line **prevp;    /* pointer to previously added entry or NULL */
  440. +     char_u    *dir;        /* optional directory name */
  441. +     char_u    *fname;        /* file name or NULL */
  442. +     char_u    *msg;        /* message */
  443. +     long    lnum;        /* line number */
  444. +     int        col;        /* column */
  445. +     int        virt_col;    /* using virtual column */
  446. +     int        nr;        /* error number */
  447. +     int        type;        /* type character */
  448. +     int        valid;        /* valid entry */
  449. + {
  450. +     struct qf_line *qfp;
  451. +     if ((qfp = (struct qf_line *)alloc((unsigned)sizeof(struct qf_line)))
  452. +                                       == NULL)
  453. +     return FAIL;
  454. +     qfp->qf_fnum = qf_get_fnum(dir, fname);
  455. +     if ((qfp->qf_text = vim_strsave(msg)) == NULL)
  456. +     {
  457. +     vim_free(qfp);
  458. +     return FAIL;
  459. +     }
  460. +     qfp->qf_lnum = lnum;
  461. +     qfp->qf_col = col;
  462. +     qfp->qf_virt_col = virt_col;
  463. +     qfp->qf_nr = nr;
  464. +     if (type != 1 && !vim_isprintc(type)) /* only printable chars allowed */
  465. +     type = 0;
  466. +     qfp->qf_type = type;
  467. +     qfp->qf_valid = valid;
  468. +     if (qf_lists[qf_curlist].qf_count == 0)    /* first element in the list */
  469. +     {
  470. +     qf_lists[qf_curlist].qf_start = qfp;
  471. +     qfp->qf_prev = qfp;    /* first element points to itself */
  472. +     }
  473. +     else
  474. +     {
  475. +     qfp->qf_prev = *prevp;
  476. +     (*prevp)->qf_next = qfp;
  477. +     }
  478. +     qfp->qf_next = qfp;    /* last element points to itself */
  479. +     qfp->qf_cleared = FALSE;
  480. +     *prevp = qfp;
  481. +     ++qf_lists[qf_curlist].qf_count;
  482. +     if (qf_lists[qf_curlist].qf_index == 0 && qfp->qf_valid)
  483. +                         /* first valid entry */
  484. +     {
  485. +     qf_lists[qf_curlist].qf_index = qf_lists[qf_curlist].qf_count;
  486. +     qf_lists[qf_curlist].qf_ptr = qfp;
  487. +     }
  488. +     return OK;
  489. + }
  490. + /*
  491.    * get buffer number for file "dir.name"
  492.    */
  493.       static int
  494. ***************
  495. *** 1261,1267 ****
  496. --- 1306,1316 ----
  497.           fname = NULL;
  498.           if (qfp->qf_fnum != 0
  499.                     && (buf = buflist_findnr(qfp->qf_fnum)) != NULL)
  500. +         {
  501.               fname = buf->b_fname;
  502. +             if (qfp->qf_type == 1)    /* :helpgrep */
  503. +             fname = gettail(fname);
  504. +         }
  505.           if (fname == NULL)
  506.               sprintf((char *)IObuff, "%2d", i);
  507.           else
  508. ***************
  509. *** 1452,1457 ****
  510. --- 1501,1507 ----
  511.    *  i or I    n        " info n"
  512.    *  0          n        " error n"
  513.    *  other     n        " c n"
  514. +  *  1         x        ""    :helpgrep
  515.    */
  516.       static char_u *
  517.   qf_types(c, nr)
  518. ***************
  519. *** 1467,1473 ****
  520.       p = (char_u *)" info";
  521.       else if (c == 'E' || c == 'e' || (c == 0 && nr > 0))
  522.       p = (char_u *)" error";
  523. !     else if (c == 0)
  524.       p = (char_u *)"";
  525.       else
  526.       {
  527. --- 1517,1523 ----
  528.       p = (char_u *)" info";
  529.       else if (c == 'E' || c == 'e' || (c == 0 && nr > 0))
  530.       p = (char_u *)" error";
  531. !     else if (c == 0 || c == 1)
  532.       p = (char_u *)"";
  533.       else
  534.       {
  535. ***************
  536. *** 1751,1757 ****
  537.               && (errbuf = buflist_findnr(qfp->qf_fnum)) != NULL
  538.               && errbuf->b_fname != NULL)
  539.           {
  540. !         STRCPY(IObuff, errbuf->b_fname);
  541.           len = (int)STRLEN(IObuff);
  542.           }
  543.           else
  544. --- 1801,1810 ----
  545.               && (errbuf = buflist_findnr(qfp->qf_fnum)) != NULL
  546.               && errbuf->b_fname != NULL)
  547.           {
  548. !         if (qfp->qf_type == 1)    /* :helpgrep */
  549. !             STRCPY(IObuff, gettail(errbuf->b_fname));
  550. !         else
  551. !             STRCPY(IObuff, errbuf->b_fname);
  552.           len = (int)STRLEN(IObuff);
  553.           }
  554.           else
  555. ***************
  556. *** 2032,2037 ****
  557. --- 2085,2182 ----
  558.       set_string_option_direct((char_u *)"ef", -1, eap->arg, OPT_FREE);
  559.       if (qf_init(p_ef, p_efm, TRUE) > 0 && eap->cmdidx == CMD_cfile)
  560.       qf_jump(0, 0, eap->forceit);        /* display first error */
  561. + }
  562. + /*
  563. +  * ":helpgrep {pattern}"
  564. +  */
  565. +     void
  566. + ex_helpgrep(eap)
  567. +     exarg_T    *eap;
  568. + {
  569. +     regmatch_T    regmatch;
  570. +     char_u    *save_cpo;
  571. +     char_u    *p;
  572. +     int        fcount;
  573. +     char_u    **fnames;
  574. +     FILE    *fd;
  575. +     int        fi;
  576. +     struct qf_line *prevp = NULL;
  577. +     long    lnum;
  578. +     /* Make 'cpoptions' empty, the 'l' flag should not be used here. */
  579. +     save_cpo = p_cpo;
  580. +     p_cpo = (char_u *)"";
  581. +     regmatch.regprog = vim_regcomp(eap->arg, RE_MAGIC + RE_STRING);
  582. +     regmatch.rm_ic = FALSE;
  583. +     if (regmatch.regprog != NULL)
  584. +     {
  585. +     /* create a new quickfix list */
  586. +     qf_new_list();
  587. +     /* Go through all directories in 'runtimepath' */
  588. +     p = p_rtp;
  589. +     while (*p != NUL && !got_int)
  590. +     {
  591. +         copy_option_part(&p, NameBuff, MAXPATHL, ",");
  592. +         /* Find all "doc / *.txt" files in this directory. */
  593. +         add_pathsep(NameBuff);
  594. +         STRCAT(NameBuff, "doc/*.txt");
  595. +         if (gen_expand_wildcards(1, &NameBuff, &fcount,
  596. +                          &fnames, EW_FILE|EW_SILENT) == OK
  597. +             && fcount > 0)
  598. +         {
  599. +         for (fi = 0; fi < fcount && !got_int; ++fi)
  600. +         {
  601. +             fd = fopen((char *)fnames[fi], "r");
  602. +             if (fd != NULL)
  603. +             {
  604. +             lnum = 1;
  605. +             while (!vim_fgets(IObuff, IOSIZE, fd) && !got_int)
  606. +             {
  607. +                 if (vim_regexec(®match, IObuff, (colnr_T)0))
  608. +                 if (qf_add_entry(&prevp,
  609. +                         NULL,    /* dir */
  610. +                         fnames[fi],
  611. +                         IObuff,
  612. +                         lnum,
  613. +                         0,        /* col */
  614. +                         FALSE,    /* virt_col */
  615. +                         0,        /* nr */
  616. +                         1,        /* type */
  617. +                         TRUE    /* valid */
  618. +                         ) == FAIL)
  619. +                 {
  620. +                     got_int = TRUE;
  621. +                     break;
  622. +                 }
  623. +                 ++lnum;
  624. +                 line_breakcheck();
  625. +             }
  626. +             fclose(fd);
  627. +             }
  628. +         }
  629. +         FreeWild(fcount, fnames);
  630. +         }
  631. +     }
  632. +     vim_free(regmatch.regprog);
  633. +     qf_lists[qf_curlist].qf_nonevalid = FALSE;
  634. +     qf_lists[qf_curlist].qf_ptr = qf_lists[qf_curlist].qf_start;
  635. +     qf_lists[qf_curlist].qf_index = 1;
  636. +     }
  637. +     p_cpo = save_cpo;
  638. + #ifdef FEAT_WINDOWS
  639. +     qf_update_buffer();
  640. + #endif
  641. +     /* Jump to first match. */
  642. +     if (qf_lists[qf_curlist].qf_count > 0)
  643. +     qf_jump(0, 0, FALSE);
  644.   }
  645.   
  646.   #endif /* FEAT_QUICKFIX */
  647. *** ../vim61.422/src/version.c    Wed Mar 26 22:26:31 2003
  648. --- src/version.c    Fri Mar 28 21:42:45 2003
  649. ***************
  650. *** 613,614 ****
  651. --- 613,616 ----
  652.   {   /* Add new patch number below this line */
  653. + /**/
  654. +     423,
  655.   /**/
  656.  
  657. -- 
  658. hundred-and-one symptoms of being an internet addict:
  659. 254. You wake up daily with your keyboard printed on your forehead.
  660.  
  661.  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
  662. ///          Creator of Vim - Vi IMproved -- http://www.Vim.org          \\\
  663. \\\              Project leader for A-A-P -- http://www.A-A-P.org        ///
  664.  \\\     Help AIDS victims, buy at Amazon -- http://ICCF.nl/click1.html ///
  665.