]>
Commit | Line | Data |
---|---|---|
a328bbc4 AG |
1 | To: vim-dev@vim.org |
2 | Subject: Patch 7.0.060 | |
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 7.0.060 (after 7.0.51) | |
11 | Problem: Code for temporarily switching to another buffer is duplicated in | |
12 | quite a few places. | |
13 | Solution: Use aucmd_prepbuf() and aucmd_restbuf() also when FEAT_AUTOCMD is | |
14 | not defined. | |
15 | Files: src/buffer.c, src/eval.c, src/fileio.c, src/if_ruby.c, | |
16 | src/if_perl.xs, src/quickfix.c, src/structs.h | |
17 | ||
18 | ||
19 | *** ../vim-7.0.059/src/buffer.c Thu Apr 27 01:49:30 2006 | |
20 | --- src/buffer.c Wed Aug 16 14:36:17 2006 | |
21 | *************** | |
22 | *** 5420,5430 **** | |
23 | buf_T *newbuf; | |
24 | int differ = TRUE; | |
25 | linenr_T lnum; | |
26 | - #ifdef FEAT_AUTOCMD | |
27 | aco_save_T aco; | |
28 | - #else | |
29 | - buf_T *old_curbuf = curbuf; | |
30 | - #endif | |
31 | exarg_T ea; | |
32 | ||
33 | /* Allocate a buffer without putting it in the buffer list. */ | |
34 | --- 5420,5426 ---- | |
35 | *************** | |
36 | *** 5439,5451 **** | |
37 | return TRUE; | |
38 | } | |
39 | ||
40 | - #ifdef FEAT_AUTOCMD | |
41 | /* set curwin/curbuf to buf and save a few things */ | |
42 | aucmd_prepbuf(&aco, newbuf); | |
43 | - #else | |
44 | - curbuf = newbuf; | |
45 | - curwin->w_buffer = newbuf; | |
46 | - #endif | |
47 | ||
48 | if (ml_open(curbuf) == OK | |
49 | && readfile(buf->b_ffname, buf->b_fname, | |
50 | --- 5435,5442 ---- | |
51 | *************** | |
52 | *** 5466,5478 **** | |
53 | } | |
54 | vim_free(ea.cmd); | |
55 | ||
56 | - #ifdef FEAT_AUTOCMD | |
57 | /* restore curwin/curbuf and a few other things */ | |
58 | aucmd_restbuf(&aco); | |
59 | - #else | |
60 | - curbuf = old_curbuf; | |
61 | - curwin->w_buffer = old_curbuf; | |
62 | - #endif | |
63 | ||
64 | if (curbuf != newbuf) /* safety check */ | |
65 | wipe_buffer(newbuf, FALSE); | |
66 | --- 5457,5464 ---- | |
67 | *** ../vim-7.0.059/src/eval.c Sun Jul 23 22:07:55 2006 | |
68 | --- src/eval.c Wed Aug 16 14:38:32 2006 | |
69 | *************** | |
70 | *** 14184,14194 **** | |
71 | typval_T *rettv; | |
72 | { | |
73 | buf_T *buf; | |
74 | - #ifdef FEAT_AUTOCMD | |
75 | aco_save_T aco; | |
76 | - #else | |
77 | - buf_T *save_curbuf; | |
78 | - #endif | |
79 | char_u *varname, *bufvarname; | |
80 | typval_T *varp; | |
81 | char_u nbuf[NUMBUFLEN]; | |
82 | --- 14184,14190 ---- | |
83 | *************** | |
84 | *** 14205,14216 **** | |
85 | if (buf != NULL && varname != NULL && varp != NULL) | |
86 | { | |
87 | /* set curbuf to be our buf, temporarily */ | |
88 | - #ifdef FEAT_AUTOCMD | |
89 | aucmd_prepbuf(&aco, buf); | |
90 | - #else | |
91 | - save_curbuf = curbuf; | |
92 | - curbuf = buf; | |
93 | - #endif | |
94 | ||
95 | if (*varname == '&') | |
96 | { | |
97 | --- 14201,14207 ---- | |
98 | *************** | |
99 | *** 14237,14247 **** | |
100 | } | |
101 | ||
102 | /* reset notion of buffer */ | |
103 | - #ifdef FEAT_AUTOCMD | |
104 | aucmd_restbuf(&aco); | |
105 | - #else | |
106 | - curbuf = save_curbuf; | |
107 | - #endif | |
108 | } | |
109 | } | |
110 | ||
111 | --- 14228,14234 ---- | |
112 | *** ../vim-7.0.059/src/fileio.c Sun Apr 30 20:33:48 2006 | |
113 | --- src/fileio.c Wed Aug 16 14:39:23 2006 | |
114 | *************** | |
115 | *** 6450,6466 **** | |
116 | int old_ro = buf->b_p_ro; | |
117 | buf_T *savebuf; | |
118 | int saved = OK; | |
119 | - #ifdef FEAT_AUTOCMD | |
120 | aco_save_T aco; | |
121 | ||
122 | /* set curwin/curbuf for "buf" and save some things */ | |
123 | aucmd_prepbuf(&aco, buf); | |
124 | - #else | |
125 | - buf_T *save_curbuf = curbuf; | |
126 | - | |
127 | - curbuf = buf; | |
128 | - curwin->w_buffer = buf; | |
129 | - #endif | |
130 | ||
131 | /* We only want to read the text from the file, not reset the syntax | |
132 | * highlighting, clear marks, diff status, etc. Force the fileformat | |
133 | --- 6450,6459 ---- | |
134 | *************** | |
135 | *** 6573,6586 **** | |
136 | curbuf->b_p_ro |= old_ro; | |
137 | } | |
138 | ||
139 | - #ifdef FEAT_AUTOCMD | |
140 | /* restore curwin/curbuf and a few other things */ | |
141 | aucmd_restbuf(&aco); | |
142 | /* Careful: autocommands may have made "buf" invalid! */ | |
143 | - #else | |
144 | - curwin->w_buffer = save_curbuf; | |
145 | - curbuf = save_curbuf; | |
146 | - #endif | |
147 | } | |
148 | ||
149 | /*ARGSUSED*/ | |
150 | --- 6566,6574 ---- | |
151 | *************** | |
152 | *** 8088,8093 **** | |
153 | --- 8076,8082 ---- | |
154 | * Search a window for the current buffer. Save the cursor position and | |
155 | * screen offset. | |
156 | * Set "curbuf" and "curwin" to match "buf". | |
157 | + * When FEAT_AUTOCMD is not defined another version is used, see below. | |
158 | */ | |
159 | void | |
160 | aucmd_prepbuf(aco, buf) | |
161 | *************** | |
162 | *** 8151,8156 **** | |
163 | --- 8140,8146 ---- | |
164 | /* | |
165 | * Cleanup after executing autocommands for a (hidden) buffer. | |
166 | * Restore the window as it was (if possible). | |
167 | + * When FEAT_AUTOCMD is not defined another version is used, see below. | |
168 | */ | |
169 | void | |
170 | aucmd_restbuf(aco) | |
171 | *************** | |
172 | *** 9063,9069 **** | |
173 | --- 9053,9089 ---- | |
174 | return retval; | |
175 | } | |
176 | ||
177 | + #else /* FEAT_AUTOCMD */ | |
178 | + | |
179 | + /* | |
180 | + * Prepare for executing commands for (hidden) buffer "buf". | |
181 | + * This is the non-autocommand version, it simply saves "curbuf" and sets | |
182 | + * "curbuf" and "curwin" to match "buf". | |
183 | + */ | |
184 | + void | |
185 | + aucmd_prepbuf(aco, buf) | |
186 | + aco_save_T *aco; /* structure to save values in */ | |
187 | + buf_T *buf; /* new curbuf */ | |
188 | + { | |
189 | + aco->save_buf = buf; | |
190 | + curbuf = buf; | |
191 | + curwin->w_buffer = buf; | |
192 | + } | |
193 | + | |
194 | + /* | |
195 | + * Restore after executing commands for a (hidden) buffer. | |
196 | + * This is the non-autocommand version. | |
197 | + */ | |
198 | + void | |
199 | + aucmd_restbuf(aco) | |
200 | + aco_save_T *aco; /* structure holding saved values */ | |
201 | + { | |
202 | + curbuf = aco->save_buf; | |
203 | + curwin->w_buffer = curbuf; | |
204 | + } | |
205 | + | |
206 | #endif /* FEAT_AUTOCMD */ | |
207 | + | |
208 | ||
209 | #if defined(FEAT_AUTOCMD) || defined(FEAT_WILDIGN) || defined(PROTO) | |
210 | /* | |
211 | *** ../vim-7.0.059/src/if_ruby.c Tue Jun 20 21:08:02 2006 | |
212 | --- src/if_ruby.c Wed Aug 16 14:41:11 2006 | |
213 | *************** | |
214 | *** 644,664 **** | |
215 | static VALUE set_buffer_line(buf_T *buf, linenr_T n, VALUE str) | |
216 | { | |
217 | char *line = STR2CSTR(str); | |
218 | - #ifdef FEAT_AUTOCMD | |
219 | aco_save_T aco; | |
220 | - #else | |
221 | - buf_T *save_curbuf = curbuf; | |
222 | - #endif | |
223 | ||
224 | if (n > 0 && n <= buf->b_ml.ml_line_count && line != NULL) | |
225 | { | |
226 | - #ifdef FEAT_AUTOCMD | |
227 | /* set curwin/curbuf for "buf" and save some things */ | |
228 | aucmd_prepbuf(&aco, buf); | |
229 | - #else | |
230 | - curbuf = buf; | |
231 | - curwin->w_buffer = buf; | |
232 | - #endif | |
233 | ||
234 | if (u_savesub(n) == OK) { | |
235 | ml_replace(n, (char_u *)line, TRUE); | |
236 | --- 644,655 ---- | |
237 | *************** | |
238 | *** 668,681 **** | |
239 | #endif | |
240 | } | |
241 | ||
242 | - #ifdef FEAT_AUTOCMD | |
243 | /* restore curwin/curbuf and a few other things */ | |
244 | aucmd_restbuf(&aco); | |
245 | /* Careful: autocommands may have made "buf" invalid! */ | |
246 | ! #else | |
247 | ! curwin->w_buffer = save_curbuf; | |
248 | ! curbuf = save_curbuf; | |
249 | ! #endif | |
250 | update_curbuf(NOT_VALID); | |
251 | } | |
252 | else | |
253 | --- 659,668 ---- | |
254 | #endif | |
255 | } | |
256 | ||
257 | /* restore curwin/curbuf and a few other things */ | |
258 | aucmd_restbuf(&aco); | |
259 | /* Careful: autocommands may have made "buf" invalid! */ | |
260 | ! | |
261 | update_curbuf(NOT_VALID); | |
262 | } | |
263 | else | |
264 | *************** | |
265 | *** 699,719 **** | |
266 | { | |
267 | buf_T *buf = get_buf(self); | |
268 | long n = NUM2LONG(num); | |
269 | - #ifdef FEAT_AUTOCMD | |
270 | aco_save_T aco; | |
271 | - #else | |
272 | - buf_T *save_curbuf = curbuf; | |
273 | - #endif | |
274 | ||
275 | if (n > 0 && n <= buf->b_ml.ml_line_count) | |
276 | { | |
277 | - #ifdef FEAT_AUTOCMD | |
278 | /* set curwin/curbuf for "buf" and save some things */ | |
279 | aucmd_prepbuf(&aco, buf); | |
280 | - #else | |
281 | - curbuf = buf; | |
282 | - curwin->w_buffer = buf; | |
283 | - #endif | |
284 | ||
285 | if (u_savedel(n, 1) == OK) { | |
286 | ml_delete(n, 0); | |
287 | --- 686,697 ---- | |
288 | *************** | |
289 | *** 725,738 **** | |
290 | changed(); | |
291 | } | |
292 | ||
293 | - #ifdef FEAT_AUTOCMD | |
294 | /* restore curwin/curbuf and a few other things */ | |
295 | aucmd_restbuf(&aco); | |
296 | /* Careful: autocommands may have made "buf" invalid! */ | |
297 | ! #else | |
298 | ! curwin->w_buffer = save_curbuf; | |
299 | ! curbuf = save_curbuf; | |
300 | ! #endif | |
301 | update_curbuf(NOT_VALID); | |
302 | } | |
303 | else | |
304 | --- 703,712 ---- | |
305 | changed(); | |
306 | } | |
307 | ||
308 | /* restore curwin/curbuf and a few other things */ | |
309 | aucmd_restbuf(&aco); | |
310 | /* Careful: autocommands may have made "buf" invalid! */ | |
311 | ! | |
312 | update_curbuf(NOT_VALID); | |
313 | } | |
314 | else | |
315 | *************** | |
316 | *** 747,767 **** | |
317 | buf_T *buf = get_buf(self); | |
318 | char *line = STR2CSTR(str); | |
319 | long n = NUM2LONG(num); | |
320 | - #ifdef FEAT_AUTOCMD | |
321 | aco_save_T aco; | |
322 | - #else | |
323 | - buf_T *save_curbuf = curbuf; | |
324 | - #endif | |
325 | ||
326 | if (n >= 0 && n <= buf->b_ml.ml_line_count && line != NULL) | |
327 | { | |
328 | - #ifdef FEAT_AUTOCMD | |
329 | /* set curwin/curbuf for "buf" and save some things */ | |
330 | aucmd_prepbuf(&aco, buf); | |
331 | - #else | |
332 | - curbuf = buf; | |
333 | - curwin->w_buffer = buf; | |
334 | - #endif | |
335 | ||
336 | if (u_inssub(n + 1) == OK) { | |
337 | ml_append(n, (char_u *) line, (colnr_T) 0, FALSE); | |
338 | --- 721,732 ---- | |
339 | *************** | |
340 | *** 773,786 **** | |
341 | changed(); | |
342 | } | |
343 | ||
344 | - #ifdef FEAT_AUTOCMD | |
345 | /* restore curwin/curbuf and a few other things */ | |
346 | aucmd_restbuf(&aco); | |
347 | /* Careful: autocommands may have made "buf" invalid! */ | |
348 | ! #else | |
349 | ! curwin->w_buffer = save_curbuf; | |
350 | ! curbuf = save_curbuf; | |
351 | ! #endif | |
352 | update_curbuf(NOT_VALID); | |
353 | } | |
354 | else { | |
355 | --- 738,747 ---- | |
356 | changed(); | |
357 | } | |
358 | ||
359 | /* restore curwin/curbuf and a few other things */ | |
360 | aucmd_restbuf(&aco); | |
361 | /* Careful: autocommands may have made "buf" invalid! */ | |
362 | ! | |
363 | update_curbuf(NOT_VALID); | |
364 | } | |
365 | else { | |
366 | *** ../vim-7.0.059/src/if_perl.xs Wed Aug 16 18:19:41 2006 | |
367 | --- src/if_perl.xs Wed Aug 16 14:45:15 2006 | |
368 | *************** | |
369 | *** 1068,1097 **** | |
370 | line = SvPV(ST(i),PL_na); | |
371 | if (lnum > 0 && lnum <= vimbuf->b_ml.ml_line_count && line != NULL) | |
372 | { | |
373 | - #ifdef FEAT_AUTOCMD | |
374 | aco_save_T aco; | |
375 | ||
376 | /* set curwin/curbuf for "vimbuf" and save some things */ | |
377 | aucmd_prepbuf(&aco, vimbuf); | |
378 | - #else | |
379 | - buf_T *save_curbuf = curbuf; | |
380 | ||
381 | - curbuf = vimbuf; | |
382 | - curwin->w_buffer = vimbuf; | |
383 | - #endif | |
384 | if (u_savesub(lnum) == OK) | |
385 | { | |
386 | ml_replace(lnum, (char_u *)line, TRUE); | |
387 | changed_bytes(lnum, 0); | |
388 | } | |
389 | ! #ifdef FEAT_AUTOCMD | |
390 | /* restore curwin/curbuf and a few other things */ | |
391 | aucmd_restbuf(&aco); | |
392 | /* Careful: autocommands may have made "vimbuf" invalid! */ | |
393 | - #else | |
394 | - curwin->w_buffer = save_curbuf; | |
395 | - curbuf = save_curbuf; | |
396 | - #endif | |
397 | } | |
398 | } | |
399 | } | |
400 | --- 1068,1087 ---- | |
401 | line = SvPV(ST(i),PL_na); | |
402 | if (lnum > 0 && lnum <= vimbuf->b_ml.ml_line_count && line != NULL) | |
403 | { | |
404 | aco_save_T aco; | |
405 | ||
406 | /* set curwin/curbuf for "vimbuf" and save some things */ | |
407 | aucmd_prepbuf(&aco, vimbuf); | |
408 | ||
409 | if (u_savesub(lnum) == OK) | |
410 | { | |
411 | ml_replace(lnum, (char_u *)line, TRUE); | |
412 | changed_bytes(lnum, 0); | |
413 | } | |
414 | ! | |
415 | /* restore curwin/curbuf and a few other things */ | |
416 | aucmd_restbuf(&aco); | |
417 | /* Careful: autocommands may have made "vimbuf" invalid! */ | |
418 | } | |
419 | } | |
420 | } | |
421 | *************** | |
422 | *** 1128,1158 **** | |
423 | { | |
424 | if (lnum > 0 && lnum <= vimbuf->b_ml.ml_line_count) | |
425 | { | |
426 | - buf_T *save_curbuf = curbuf; | |
427 | - #ifdef FEAT_AUTOCMD | |
428 | aco_save_T aco; | |
429 | ||
430 | /* set curwin/curbuf for "vimbuf" and save some things */ | |
431 | aucmd_prepbuf(&aco, vimbuf); | |
432 | ! #else | |
433 | ! curbuf = vimbuf; | |
434 | ! curwin->w_buffer = vimbuf; | |
435 | ! #endif | |
436 | if (u_savedel(lnum, 1) == OK) | |
437 | { | |
438 | ml_delete(lnum, 0); | |
439 | deleted_lines_mark(lnum, 1L); | |
440 | ! if (save_curbuf == curbuf) | |
441 | check_cursor(); | |
442 | } | |
443 | ! #ifdef FEAT_AUTOCMD | |
444 | /* restore curwin/curbuf and a few other things */ | |
445 | aucmd_restbuf(&aco); | |
446 | /* Careful: autocommands may have made "vimbuf" invalid! */ | |
447 | ! #else | |
448 | ! curwin->w_buffer = save_curbuf; | |
449 | ! curbuf = save_curbuf; | |
450 | ! #endif | |
451 | update_curbuf(VALID); | |
452 | } | |
453 | } | |
454 | --- 1118,1140 ---- | |
455 | { | |
456 | if (lnum > 0 && lnum <= vimbuf->b_ml.ml_line_count) | |
457 | { | |
458 | aco_save_T aco; | |
459 | ||
460 | /* set curwin/curbuf for "vimbuf" and save some things */ | |
461 | aucmd_prepbuf(&aco, vimbuf); | |
462 | ! | |
463 | if (u_savedel(lnum, 1) == OK) | |
464 | { | |
465 | ml_delete(lnum, 0); | |
466 | deleted_lines_mark(lnum, 1L); | |
467 | ! if (aco.save_buf == curbuf) | |
468 | check_cursor(); | |
469 | } | |
470 | ! | |
471 | /* restore curwin/curbuf and a few other things */ | |
472 | aucmd_restbuf(&aco); | |
473 | /* Careful: autocommands may have made "vimbuf" invalid! */ | |
474 | ! | |
475 | update_curbuf(VALID); | |
476 | } | |
477 | } | |
478 | *************** | |
479 | *** 1179,1208 **** | |
480 | line = SvPV(ST(i),PL_na); | |
481 | if (lnum >= 0 && lnum <= vimbuf->b_ml.ml_line_count && line != NULL) | |
482 | { | |
483 | - #ifdef FEAT_AUTOCMD | |
484 | aco_save_T aco; | |
485 | ||
486 | /* set curwin/curbuf for "vimbuf" and save some things */ | |
487 | aucmd_prepbuf(&aco, vimbuf); | |
488 | - #else | |
489 | - buf_T *save_curbuf = curbuf; | |
490 | ||
491 | - curbuf = vimbuf; | |
492 | - curwin->w_buffer = vimbuf; | |
493 | - #endif | |
494 | if (u_inssub(lnum + 1) == OK) | |
495 | { | |
496 | ml_append(lnum, (char_u *)line, (colnr_T)0, FALSE); | |
497 | appended_lines_mark(lnum, 1L); | |
498 | } | |
499 | ! #ifdef FEAT_AUTOCMD | |
500 | /* restore curwin/curbuf and a few other things */ | |
501 | aucmd_restbuf(&aco); | |
502 | /* Careful: autocommands may have made "vimbuf" invalid! */ | |
503 | ! #else | |
504 | ! curwin->w_buffer = save_curbuf; | |
505 | ! curbuf = save_curbuf; | |
506 | ! #endif | |
507 | update_curbuf(VALID); | |
508 | } | |
509 | } | |
510 | --- 1161,1181 ---- | |
511 | line = SvPV(ST(i),PL_na); | |
512 | if (lnum >= 0 && lnum <= vimbuf->b_ml.ml_line_count && line != NULL) | |
513 | { | |
514 | aco_save_T aco; | |
515 | ||
516 | /* set curwin/curbuf for "vimbuf" and save some things */ | |
517 | aucmd_prepbuf(&aco, vimbuf); | |
518 | ||
519 | if (u_inssub(lnum + 1) == OK) | |
520 | { | |
521 | ml_append(lnum, (char_u *)line, (colnr_T)0, FALSE); | |
522 | appended_lines_mark(lnum, 1L); | |
523 | } | |
524 | ! | |
525 | /* restore curwin/curbuf and a few other things */ | |
526 | aucmd_restbuf(&aco); | |
527 | /* Careful: autocommands may have made "vimbuf" invalid! */ | |
528 | ! | |
529 | update_curbuf(VALID); | |
530 | } | |
531 | } | |
532 | *** ../vim-7.0.059/src/quickfix.c Tue Jun 20 20:49:42 2006 | |
533 | --- src/quickfix.c Wed Aug 16 14:43:06 2006 | |
534 | *************** | |
535 | *** 2463,2494 **** | |
536 | qf_info_T *qi; | |
537 | { | |
538 | buf_T *buf; | |
539 | - #ifdef FEAT_AUTOCMD | |
540 | aco_save_T aco; | |
541 | - #else | |
542 | - buf_T *save_curbuf; | |
543 | - #endif | |
544 | ||
545 | /* Check if a buffer for the quickfix list exists. Update it. */ | |
546 | buf = qf_find_buf(qi); | |
547 | if (buf != NULL) | |
548 | { | |
549 | - #ifdef FEAT_AUTOCMD | |
550 | /* set curwin/curbuf to buf and save a few things */ | |
551 | aucmd_prepbuf(&aco, buf); | |
552 | - #else | |
553 | - save_curbuf = curbuf; | |
554 | - curbuf = buf; | |
555 | - #endif | |
556 | ||
557 | qf_fill_buffer(qi); | |
558 | ||
559 | - #ifdef FEAT_AUTOCMD | |
560 | /* restore curwin/curbuf and a few other things */ | |
561 | aucmd_restbuf(&aco); | |
562 | - #else | |
563 | - curbuf = save_curbuf; | |
564 | - #endif | |
565 | ||
566 | (void)qf_win_pos_update(qi, 0); | |
567 | } | |
568 | --- 2463,2481 ---- | |
569 | *************** | |
570 | *** 2977,2986 **** | |
571 | #if defined(FEAT_AUTOCMD) && defined(FEAT_SYN_HL) | |
572 | char_u *save_ei = NULL; | |
573 | #endif | |
574 | - #ifndef FEAT_AUTOCMD | |
575 | - buf_T *save_curbuf; | |
576 | - #else | |
577 | aco_save_T aco; | |
578 | char_u *au_name = NULL; | |
579 | int flags = 0; | |
580 | colnr_T col; | |
581 | --- 2964,2971 ---- | |
582 | #if defined(FEAT_AUTOCMD) && defined(FEAT_SYN_HL) | |
583 | char_u *save_ei = NULL; | |
584 | #endif | |
585 | aco_save_T aco; | |
586 | + #ifdef FEAT_AUTOCMD | |
587 | char_u *au_name = NULL; | |
588 | int flags = 0; | |
589 | colnr_T col; | |
590 | *************** | |
591 | *** 3201,3224 **** | |
592 | * need to be done now, in that buffer. And the modelines | |
593 | * need to be done (again). But not the window-local | |
594 | * options! */ | |
595 | - #if defined(FEAT_AUTOCMD) | |
596 | aucmd_prepbuf(&aco, buf); | |
597 | - #else | |
598 | - save_curbuf = curbuf; | |
599 | - curbuf = buf; | |
600 | - curwin->w_buffer = curbuf; | |
601 | - #endif | |
602 | #if defined(FEAT_AUTOCMD) && defined(FEAT_SYN_HL) | |
603 | apply_autocmds(EVENT_FILETYPE, buf->b_p_ft, | |
604 | buf->b_fname, TRUE, buf); | |
605 | #endif | |
606 | do_modelines(OPT_NOWIN); | |
607 | - #if defined(FEAT_AUTOCMD) | |
608 | aucmd_restbuf(&aco); | |
609 | - #else | |
610 | - curbuf = save_curbuf; | |
611 | - curwin->w_buffer = curbuf; | |
612 | - #endif | |
613 | } | |
614 | } | |
615 | } | |
616 | --- 3186,3198 ---- | |
617 | *************** | |
618 | *** 3319,3329 **** | |
619 | { | |
620 | buf_T *newbuf; | |
621 | int failed = TRUE; | |
622 | - #ifdef FEAT_AUTOCMD | |
623 | aco_save_T aco; | |
624 | - #else | |
625 | - buf_T *old_curbuf = curbuf; | |
626 | - #endif | |
627 | ||
628 | /* Allocate a buffer without putting it in the buffer list. */ | |
629 | newbuf = buflist_new(NULL, NULL, (linenr_T)1, BLN_DUMMY); | |
630 | --- 3293,3299 ---- | |
631 | *************** | |
632 | *** 3333,3345 **** | |
633 | /* Init the options. */ | |
634 | buf_copy_options(newbuf, BCO_ENTER | BCO_NOHELP); | |
635 | ||
636 | - #ifdef FEAT_AUTOCMD | |
637 | /* set curwin/curbuf to buf and save a few things */ | |
638 | aucmd_prepbuf(&aco, newbuf); | |
639 | - #else | |
640 | - curbuf = newbuf; | |
641 | - curwin->w_buffer = newbuf; | |
642 | - #endif | |
643 | ||
644 | /* Need to set the filename for autocommands. */ | |
645 | (void)setfname(curbuf, fname, NULL, FALSE); | |
646 | --- 3303,3310 ---- | |
647 | *************** | |
648 | *** 3370,3382 **** | |
649 | } | |
650 | } | |
651 | ||
652 | - #ifdef FEAT_AUTOCMD | |
653 | /* restore curwin/curbuf and a few other things */ | |
654 | aucmd_restbuf(&aco); | |
655 | - #else | |
656 | - curbuf = old_curbuf; | |
657 | - curwin->w_buffer = old_curbuf; | |
658 | - #endif | |
659 | ||
660 | if (!buf_valid(newbuf)) | |
661 | return NULL; | |
662 | --- 3335,3342 ---- | |
663 | *** ../vim-7.0.059/src/structs.h Sun Apr 9 23:52:16 2006 | |
664 | --- src/structs.h Wed Aug 16 19:30:48 2006 | |
665 | *************** | |
666 | *** 2213,2230 **** | |
667 | ||
668 | /* | |
669 | * Struct to save values in before executing autocommands for a buffer that is | |
670 | ! * not the current buffer. | |
671 | */ | |
672 | typedef struct | |
673 | { | |
674 | buf_T *save_buf; /* saved curbuf */ | |
675 | buf_T *new_curbuf; /* buffer to be used */ | |
676 | win_T *save_curwin; /* saved curwin, NULL if it didn't change */ | |
677 | win_T *new_curwin; /* new curwin if save_curwin != NULL */ | |
678 | pos_T save_cursor; /* saved cursor pos of save_curwin */ | |
679 | linenr_T save_topline; /* saved topline of save_curwin */ | |
680 | ! #ifdef FEAT_DIFF | |
681 | int save_topfill; /* saved topfill of save_curwin */ | |
682 | #endif | |
683 | } aco_save_T; | |
684 | ||
685 | --- 2213,2232 ---- | |
686 | ||
687 | /* | |
688 | * Struct to save values in before executing autocommands for a buffer that is | |
689 | ! * not the current buffer. Without FEAT_AUTOCMD only "curbuf" is remembered. | |
690 | */ | |
691 | typedef struct | |
692 | { | |
693 | buf_T *save_buf; /* saved curbuf */ | |
694 | + #ifdef FEAT_AUTOCMD | |
695 | buf_T *new_curbuf; /* buffer to be used */ | |
696 | win_T *save_curwin; /* saved curwin, NULL if it didn't change */ | |
697 | win_T *new_curwin; /* new curwin if save_curwin != NULL */ | |
698 | pos_T save_cursor; /* saved cursor pos of save_curwin */ | |
699 | linenr_T save_topline; /* saved topline of save_curwin */ | |
700 | ! # ifdef FEAT_DIFF | |
701 | int save_topfill; /* saved topfill of save_curwin */ | |
702 | + # endif | |
703 | #endif | |
704 | } aco_save_T; | |
705 | ||
706 | *** ../vim-7.0.059/src/version.c Wed Aug 16 18:19:41 2006 | |
707 | --- src/version.c Wed Aug 16 19:31:01 2006 | |
708 | *************** | |
709 | *** 668,669 **** | |
710 | --- 668,671 ---- | |
711 | { /* Add new patch number below this line */ | |
712 | + /**/ | |
713 | + 60, | |
714 | /**/ | |
715 | ||
716 | -- | |
717 | hundred-and-one symptoms of being an internet addict: | |
718 | 164. You got out to buy software, instead of going out for a beer. | |
719 | ||
720 | /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ | |
721 | /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ | |
722 | \\\ download, build and distribute -- http://www.A-A-P.org /// | |
723 | \\\ help me help AIDS victims -- http://ICCF-Holland.org /// |