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 / 7.2 / 7.2.433 < prev    next >
Encoding:
Internet Message Format  |  2010-05-13  |  5.3 KB

  1. To: vim-dev@vim.org
  2. Subject: Patch 7.2.433
  3. Fcc: outbox
  4. From: Bram Moolenaar <Bram@moolenaar.net>
  5. Mime-Version: 1.0
  6. Content-Type: text/plain; charset=UTF-8
  7. Content-Transfer-Encoding: 8bit
  8. ------------
  9.  
  10. Patch 7.2.433
  11. Problem:    Can't use cscope with QuickFixCmdPre and QuickFixCmdPost.
  12. Solution:   Add cscope support for these autocmd events. (Bryan Venteicher)
  13. Files:        runtime/doc/autocmd.txt, src/if_cscope.c
  14.  
  15.  
  16. *** ../vim-7.2.432/runtime/doc/autocmd.txt    2009-06-24 17:51:01.000000000 +0200
  17. --- runtime/doc/autocmd.txt    2010-05-14 22:48:43.000000000 +0200
  18. ***************
  19. *** 678,687 ****
  20.   QuickFixCmdPre            Before a quickfix command is run (|:make|,
  21.                   |:lmake|, |:grep|, |:lgrep|, |:grepadd|,
  22.                   |:lgrepadd|, |:vimgrep|, |:lvimgrep|,
  23. !                 |:vimgrepadd|, |:lvimgrepadd|). The pattern is
  24. !                 matched against the command being run.  When
  25. !                 |:grep| is used but 'grepprg' is set to
  26. !                 "internal" it still matches "grep".
  27.                   This command cannot be used to set the
  28.                   'makeprg' and 'grepprg' variables.
  29.                   If this command causes an error, the quickfix
  30. --- 678,687 ----
  31.   QuickFixCmdPre            Before a quickfix command is run (|:make|,
  32.                   |:lmake|, |:grep|, |:lgrep|, |:grepadd|,
  33.                   |:lgrepadd|, |:vimgrep|, |:lvimgrep|,
  34. !                 |:vimgrepadd|, |:lvimgrepadd|, |:cscope|).
  35. !                 The pattern is matched against the command
  36. !                 being run.  When |:grep| is used but 'grepprg'
  37. !                 is set to "internal" it still matches "grep".
  38.                   This command cannot be used to set the
  39.                   'makeprg' and 'grepprg' variables.
  40.                   If this command causes an error, the quickfix
  41. *** ../vim-7.2.432/src/if_cscope.c    2010-02-24 14:46:58.000000000 +0100
  42. --- src/if_cscope.c    2010-05-14 23:10:39.000000000 +0200
  43. ***************
  44. *** 1113,1118 ****
  45. --- 1113,1182 ----
  46.   #ifdef FEAT_QUICKFIX
  47.       char cmdletter;
  48.       char *qfpos;
  49. +     /* get cmd letter */
  50. +     switch (opt[0])
  51. +     {
  52. +     case '0' :
  53. +     cmdletter = 's';
  54. +     break;
  55. +     case '1' :
  56. +     cmdletter = 'g';
  57. +     break;
  58. +     case '2' :
  59. +     cmdletter = 'd';
  60. +     break;
  61. +     case '3' :
  62. +     cmdletter = 'c';
  63. +     break;
  64. +     case '4' :
  65. +     cmdletter = 't';
  66. +     break;
  67. +     case '6' :
  68. +     cmdletter = 'e';
  69. +     break;
  70. +     case '7' :
  71. +     cmdletter = 'f';
  72. +     break;
  73. +     case '8' :
  74. +     cmdletter = 'i';
  75. +     break;
  76. +     default :
  77. +     cmdletter = opt[0];
  78. +     }
  79. +     qfpos = (char *)vim_strchr(p_csqf, cmdletter);
  80. +     if (qfpos != NULL)
  81. +     {
  82. +     qfpos++;
  83. +     /* next symbol must be + or - */
  84. +     if (strchr(CSQF_FLAGS, *qfpos) == NULL)
  85. +     {
  86. +         char *nf = _("E469: invalid cscopequickfix flag %c for %c");
  87. +         char *buf = (char *)alloc((unsigned)strlen(nf));
  88. +         /* strlen will be enough because we use chars */
  89. +         if (buf != NULL)
  90. +         {
  91. +         sprintf(buf, nf, *qfpos, *(qfpos-1));
  92. +         (void)EMSG(buf);
  93. +         vim_free(buf);
  94. +         }
  95. +         return FALSE;
  96. +     }
  97. + # ifdef FEAT_AUTOCMD
  98. +     if (*qfpos != '0')
  99. +     {
  100. +         apply_autocmds(EVENT_QUICKFIXCMDPRE, (char_u *)"cscope",
  101. +                            curbuf->b_fname, TRUE, curbuf);
  102. + #  ifdef FEAT_EVAL
  103. +         if (did_throw || force_abort)
  104. +         return FALSE;
  105. + #  endif
  106. +     }
  107. + # endif
  108. +     }
  109.   #endif
  110.   
  111.       /* create the actual command to send to cscope */
  112. ***************
  113. *** 1174,1231 ****
  114.       }
  115.   
  116.   #ifdef FEAT_QUICKFIX
  117. -     /* get cmd letter */
  118. -     switch (opt[0])
  119. -     {
  120. -     case '0' :
  121. -     cmdletter = 's';
  122. -     break;
  123. -     case '1' :
  124. -     cmdletter = 'g';
  125. -     break;
  126. -     case '2' :
  127. -     cmdletter = 'd';
  128. -     break;
  129. -     case '3' :
  130. -     cmdletter = 'c';
  131. -     break;
  132. -     case '4' :
  133. -     cmdletter = 't';
  134. -     break;
  135. -     case '6' :
  136. -     cmdletter = 'e';
  137. -     break;
  138. -     case '7' :
  139. -     cmdletter = 'f';
  140. -     break;
  141. -     case '8' :
  142. -     cmdletter = 'i';
  143. -     break;
  144. -     default :
  145. -     cmdletter = opt[0];
  146. -     }
  147. -     qfpos = (char *)vim_strchr(p_csqf, cmdletter);
  148. -     if (qfpos != NULL)
  149. -     {
  150. -     qfpos++;
  151. -     /* next symbol must be + or - */
  152. -     if (strchr(CSQF_FLAGS, *qfpos) == NULL)
  153. -     {
  154. -         char *nf = _("E469: invalid cscopequickfix flag %c for %c");
  155. -         char *buf = (char *)alloc((unsigned)strlen(nf));
  156. -         /* strlen will be enough because we use chars */
  157. -         if (buf != NULL)
  158. -         {
  159. -         sprintf(buf, nf, *qfpos, *(qfpos-1));
  160. -         (void)EMSG(buf);
  161. -         vim_free(buf);
  162. -         }
  163. -         vim_free(nummatches);
  164. -         return FALSE;
  165. -     }
  166. -     }
  167.       if (qfpos != NULL && *qfpos != '0' && totmatches > 0)
  168.       {
  169.       /* fill error list */
  170. --- 1238,1243 ----
  171. ***************
  172. *** 1258,1263 ****
  173. --- 1270,1280 ----
  174.               postponed_split = 0;
  175.           }
  176.   # endif
  177. + # ifdef FEAT_AUTOCMD
  178. +         apply_autocmds(EVENT_QUICKFIXCMDPOST, (char_u *)"cscope",
  179. +                            curbuf->b_fname, TRUE, curbuf);
  180. + # endif
  181.           if (use_ll)
  182.               /*
  183.                * In the location list window, use the displayed location
  184. *** ../vim-7.2.432/src/version.c    2010-05-14 22:24:31.000000000 +0200
  185. --- src/version.c    2010-05-14 23:13:27.000000000 +0200
  186. ***************
  187. *** 683,684 ****
  188. --- 683,686 ----
  189.   {   /* Add new patch number below this line */
  190. + /**/
  191. +     433,
  192.   /**/
  193.  
  194. -- 
  195. The 50-50-90 rule: Anytime you have a 50-50 chance of getting
  196. something right, there's a 90% probability you'll get it wrong.
  197.  
  198.  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
  199. ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
  200. \\\        download, build and distribute -- http://www.A-A-P.org        ///
  201.  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
  202.