summaryrefslogtreecommitdiffstats
path: root/source/ap/vim/patches/7.3.442
blob: 58b58b4ea99194ebe60bbdedd7580f319a182b4b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
To: vim_dev@googlegroups.com
Subject: Patch 7.3.442
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------

Patch 7.3.442 (after 7.3.438) 
Problem:    Still read modelines for ":doautocmd". 
Solution:   Move check for <nomodeline> to separate function. 
Files:      src/fileio.c, src/ex_docmd.c, src/proto/fileio.pro, 
            runtime/doc/autocmd.txt 


*** ../vim-7.3.441/src/fileio.c	2012-02-12 00:18:54.000000000 +0100
--- src/fileio.c	2012-02-12 20:05:35.000000000 +0100
***************
*** 8740,8752 ****
      aco_save_T	aco;
      buf_T	*buf;
      char_u	*arg = eap->arg;
!     int		call_do_modelines = TRUE;
! 
!     if (STRNCMP(arg, "<nomodeline>", 12) == 0)
!     {
! 	call_do_modelines = FALSE;
! 	arg = skipwhite(arg + 12);
!     }
  
      /*
       * This is a bit tricky: For some commands curwin->w_buffer needs to be
--- 8740,8746 ----
      aco_save_T	aco;
      buf_T	*buf;
      char_u	*arg = eap->arg;
!     int		call_do_modelines = check_nomodeline(&arg);
  
      /*
       * This is a bit tricky: For some commands curwin->w_buffer needs to be
***************
*** 8786,8791 ****
--- 8780,8802 ----
  }
  
  /*
+  * Check *argp for <nomodeline>.  When it is present return FALSE, otherwise
+  * return TRUE and advance *argp to after it.
+  * Thus return TRUE when do_modelines() should be called.
+  */
+     int
+ check_nomodeline(argp)
+     char_u **argp;
+ {
+     if (STRNCMP(*argp, "<nomodeline>", 12) == 0)
+     {
+ 	*argp = skipwhite(*argp + 12);
+ 	return FALSE;
+     }
+     return TRUE;
+ }
+ 
+ /*
   * Prepare for executing autocommands for (hidden) buffer "buf".
   * Search for a visible window containing the current buffer.  If there isn't
   * one then use "aucmd_win".
*** ../vim-7.3.441/src/ex_docmd.c	2012-01-26 20:41:22.000000000 +0100
--- src/ex_docmd.c	2012-02-12 20:05:18.000000000 +0100
***************
*** 4955,4961 ****
      map_clear(eap->cmd, eap->arg, TRUE, TRUE);
  }
  
! #ifdef FEAT_AUTOCMD
      static void
  ex_autocmd(eap)
      exarg_T	*eap;
--- 4955,4961 ----
      map_clear(eap->cmd, eap->arg, TRUE, TRUE);
  }
  
! #if defined(FEAT_AUTOCMD) || defined(PROTO)
      static void
  ex_autocmd(eap)
      exarg_T	*eap;
***************
*** 4982,4989 ****
  ex_doautocmd(eap)
      exarg_T	*eap;
  {
!     (void)do_doautocmd(eap->arg, TRUE);
!     do_modelines(0);
  }
  #endif
  
--- 4982,4993 ----
  ex_doautocmd(eap)
      exarg_T	*eap;
  {
!     char_u	*arg = eap->arg;
!     int		call_do_modelines = check_nomodeline(&arg);
! 
!     (void)do_doautocmd(arg, TRUE);
!     if (call_do_modelines)  /* Only when there is no <nomodeline>. */
! 	do_modelines(0);
  }
  #endif
  
*** ../vim-7.3.441/src/proto/fileio.pro	2010-12-17 16:27:10.000000000 +0100
--- src/proto/fileio.pro	2012-02-12 20:05:26.000000000 +0100
***************
*** 35,40 ****
--- 35,41 ----
  void do_autocmd __ARGS((char_u *arg, int forceit));
  int do_doautocmd __ARGS((char_u *arg, int do_msg));
  void ex_doautoall __ARGS((exarg_T *eap));
+ int check_nomodeline __ARGS((char_u **argp));
  void aucmd_prepbuf __ARGS((aco_save_T *aco, buf_T *buf));
  void aucmd_restbuf __ARGS((aco_save_T *aco));
  int apply_autocmds __ARGS((event_T event, char_u *fname, char_u *fname_io, int force, buf_T *buf));
*** ../vim-7.3.441/runtime/doc/autocmd.txt	2012-02-12 00:18:54.000000000 +0100
--- runtime/doc/autocmd.txt	2012-02-12 20:11:05.000000000 +0100
***************
*** 1064,1069 ****
--- 1072,1085 ----
  			argument is included, Vim executes only the matching
  			autocommands for that group.  Note: if you use an
  			undefined group name, Vim gives you an error message.
+ 							*<nomodeline>*
+ 			After applying the autocommands the modelines are
+ 			processed, so that their settings overrule the
+ 			settings from autocommands, like what happens when
+ 			editing a file. This is skipped when the <nomodeline>
+ 			argument is present. You probably want to use
+ 			<nomodeline> for events that are not used when loading
+ 			a buffer, such as |User|.
  
  						*:doautoa* *:doautoall*
  :doautoa[ll] [<nomodeline>] [group] {event} [fname]
***************
*** 1077,1088 ****
  			This command is intended for autocommands that set
  			options, change highlighting, and things like that.
  
- 			After applying the autocommands the modelines are
- 			processed, so that their settings overrule the
- 			settings from autocommands, like what happens when
- 			editing a file. This is skipped when the <nomodeline>
- 			argument is present.
- 
  ==============================================================================
  10. Using autocommands					*autocmd-use*
  
--- 1093,1098 ----
*** ../vim-7.3.441/src/version.c	2012-02-12 01:55:50.000000000 +0100
--- src/version.c	2012-02-12 20:11:34.000000000 +0100
***************
*** 716,717 ****
--- 716,719 ----
  {   /* Add new patch number below this line */
+ /**/
+     442,
  /**/

-- 
The real
trick is
this: to
keep the
lines as
short as
possible
and keep
the size
the same
yet free
from the
need for
hyphena-
Dammit!!  (Matthew Winn)

 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///