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.3 / 7.3.442 < prev    next >
Encoding:
Internet Message Format  |  2012-11-20  |  5.3 KB

  1. To: vim_dev@googlegroups.com
  2. Subject: Patch 7.3.442
  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.3.442 (after 7.3.438) 
  11. Problem:    Still read modelines for ":doautocmd". 
  12. Solution:   Move check for <nomodeline> to separate function. 
  13. Files:      src/fileio.c, src/ex_docmd.c, src/proto/fileio.pro, 
  14.             runtime/doc/autocmd.txt 
  15.  
  16.  
  17. *** ../vim-7.3.441/src/fileio.c    2012-02-12 00:18:54.000000000 +0100
  18. --- src/fileio.c    2012-02-12 20:05:35.000000000 +0100
  19. ***************
  20. *** 8740,8752 ****
  21.       aco_save_T    aco;
  22.       buf_T    *buf;
  23.       char_u    *arg = eap->arg;
  24. !     int        call_do_modelines = TRUE;
  25. !     if (STRNCMP(arg, "<nomodeline>", 12) == 0)
  26. !     {
  27. !     call_do_modelines = FALSE;
  28. !     arg = skipwhite(arg + 12);
  29. !     }
  30.   
  31.       /*
  32.        * This is a bit tricky: For some commands curwin->w_buffer needs to be
  33. --- 8740,8746 ----
  34.       aco_save_T    aco;
  35.       buf_T    *buf;
  36.       char_u    *arg = eap->arg;
  37. !     int        call_do_modelines = check_nomodeline(&arg);
  38.   
  39.       /*
  40.        * This is a bit tricky: For some commands curwin->w_buffer needs to be
  41. ***************
  42. *** 8786,8791 ****
  43. --- 8780,8802 ----
  44.   }
  45.   
  46.   /*
  47. +  * Check *argp for <nomodeline>.  When it is present return FALSE, otherwise
  48. +  * return TRUE and advance *argp to after it.
  49. +  * Thus return TRUE when do_modelines() should be called.
  50. +  */
  51. +     int
  52. + check_nomodeline(argp)
  53. +     char_u **argp;
  54. + {
  55. +     if (STRNCMP(*argp, "<nomodeline>", 12) == 0)
  56. +     {
  57. +     *argp = skipwhite(*argp + 12);
  58. +     return FALSE;
  59. +     }
  60. +     return TRUE;
  61. + }
  62. + /*
  63.    * Prepare for executing autocommands for (hidden) buffer "buf".
  64.    * Search for a visible window containing the current buffer.  If there isn't
  65.    * one then use "aucmd_win".
  66. *** ../vim-7.3.441/src/ex_docmd.c    2012-01-26 20:41:22.000000000 +0100
  67. --- src/ex_docmd.c    2012-02-12 20:05:18.000000000 +0100
  68. ***************
  69. *** 4955,4961 ****
  70.       map_clear(eap->cmd, eap->arg, TRUE, TRUE);
  71.   }
  72.   
  73. ! #ifdef FEAT_AUTOCMD
  74.       static void
  75.   ex_autocmd(eap)
  76.       exarg_T    *eap;
  77. --- 4955,4961 ----
  78.       map_clear(eap->cmd, eap->arg, TRUE, TRUE);
  79.   }
  80.   
  81. ! #if defined(FEAT_AUTOCMD) || defined(PROTO)
  82.       static void
  83.   ex_autocmd(eap)
  84.       exarg_T    *eap;
  85. ***************
  86. *** 4982,4989 ****
  87.   ex_doautocmd(eap)
  88.       exarg_T    *eap;
  89.   {
  90. !     (void)do_doautocmd(eap->arg, TRUE);
  91. !     do_modelines(0);
  92.   }
  93.   #endif
  94.   
  95. --- 4982,4993 ----
  96.   ex_doautocmd(eap)
  97.       exarg_T    *eap;
  98.   {
  99. !     char_u    *arg = eap->arg;
  100. !     int        call_do_modelines = check_nomodeline(&arg);
  101. !     (void)do_doautocmd(arg, TRUE);
  102. !     if (call_do_modelines)  /* Only when there is no <nomodeline>. */
  103. !     do_modelines(0);
  104.   }
  105.   #endif
  106.   
  107. *** ../vim-7.3.441/src/proto/fileio.pro    2010-12-17 16:27:10.000000000 +0100
  108. --- src/proto/fileio.pro    2012-02-12 20:05:26.000000000 +0100
  109. ***************
  110. *** 35,40 ****
  111. --- 35,41 ----
  112.   void do_autocmd __ARGS((char_u *arg, int forceit));
  113.   int do_doautocmd __ARGS((char_u *arg, int do_msg));
  114.   void ex_doautoall __ARGS((exarg_T *eap));
  115. + int check_nomodeline __ARGS((char_u **argp));
  116.   void aucmd_prepbuf __ARGS((aco_save_T *aco, buf_T *buf));
  117.   void aucmd_restbuf __ARGS((aco_save_T *aco));
  118.   int apply_autocmds __ARGS((event_T event, char_u *fname, char_u *fname_io, int force, buf_T *buf));
  119. *** ../vim-7.3.441/runtime/doc/autocmd.txt    2012-02-12 00:18:54.000000000 +0100
  120. --- runtime/doc/autocmd.txt    2012-02-12 20:11:05.000000000 +0100
  121. ***************
  122. *** 1064,1069 ****
  123. --- 1072,1085 ----
  124.               argument is included, Vim executes only the matching
  125.               autocommands for that group.  Note: if you use an
  126.               undefined group name, Vim gives you an error message.
  127. +                             *<nomodeline>*
  128. +             After applying the autocommands the modelines are
  129. +             processed, so that their settings overrule the
  130. +             settings from autocommands, like what happens when
  131. +             editing a file. This is skipped when the <nomodeline>
  132. +             argument is present. You probably want to use
  133. +             <nomodeline> for events that are not used when loading
  134. +             a buffer, such as |User|.
  135.   
  136.                           *:doautoa* *:doautoall*
  137.   :doautoa[ll] [<nomodeline>] [group] {event} [fname]
  138. ***************
  139. *** 1077,1088 ****
  140.               This command is intended for autocommands that set
  141.               options, change highlighting, and things like that.
  142.   
  143. -             After applying the autocommands the modelines are
  144. -             processed, so that their settings overrule the
  145. -             settings from autocommands, like what happens when
  146. -             editing a file. This is skipped when the <nomodeline>
  147. -             argument is present.
  148.   ==============================================================================
  149.   10. Using autocommands                    *autocmd-use*
  150.   
  151. --- 1093,1098 ----
  152. *** ../vim-7.3.441/src/version.c    2012-02-12 01:55:50.000000000 +0100
  153. --- src/version.c    2012-02-12 20:11:34.000000000 +0100
  154. ***************
  155. *** 716,717 ****
  156. --- 716,719 ----
  157.   {   /* Add new patch number below this line */
  158. + /**/
  159. +     442,
  160.   /**/
  161.  
  162. -- 
  163. The real
  164. trick is
  165. this: to
  166. keep the
  167. lines as
  168. short as
  169. possible
  170. and keep
  171. the size
  172. the same
  173. yet free
  174. from the
  175. need for
  176. hyphena-
  177. Dammit!!  (Matthew Winn)
  178.  
  179.  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
  180. ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
  181. \\\  an exciting new programming language -- http://www.Zimbu.org        ///
  182.  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
  183.