]> git.pld-linux.org Git - packages/vim.git/blob - 7.1.125
- new
[packages/vim.git] / 7.1.125
1 To: vim-dev@vim.org
2 Subject: patch 7.1.125
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.1.125
11 Problem:    The TermResponse autocommand event is not always triggered. (Aron
12             Griffis)
13 Solution:   When unblocking autocommands check if v:termresponse changed and
14             trigger the event then.
15 Files:      src/buffer.c, src/diff.c, src/ex_getln.c, src/fileio.c,
16             src/globals.h, src/misc2.c, src/proto/fileio.pro, src/window.c
17
18
19 *** ../vim-7.1.124/src/buffer.c Sun Aug 12 15:50:26 2007
20 --- src/buffer.c        Wed Sep 26 20:05:38 2007
21 ***************
22 *** 5515,5525 ****
23   
24   #ifdef FEAT_AUTOCMD
25       if (!aucmd)                   /* Don't trigger BufDelete autocommands here. */
26 !       ++autocmd_block;
27   #endif
28       close_buffer(NULL, buf, DOBUF_WIPE);
29   #ifdef FEAT_AUTOCMD
30       if (!aucmd)
31 !       --autocmd_block;
32   #endif
33   }
34 --- 5512,5522 ----
35   
36   #ifdef FEAT_AUTOCMD
37       if (!aucmd)                   /* Don't trigger BufDelete autocommands here. */
38 !       block_autocmds();
39   #endif
40       close_buffer(NULL, buf, DOBUF_WIPE);
41   #ifdef FEAT_AUTOCMD
42       if (!aucmd)
43 !       unblock_autocmds();
44   #endif
45   }
46 *** ../vim-7.1.124/src/diff.c   Tue Feb 20 04:43:13 2007
47 --- src/diff.c  Tue Sep 25 22:01:40 2007
48 ***************
49 *** 840,850 ****
50                     tmp_orig, tmp_new);
51             append_redir(cmd, p_srr, tmp_diff);
52   #ifdef FEAT_AUTOCMD
53 !           ++autocmd_block;    /* Avoid ShellCmdPost stuff */
54   #endif
55             (void)call_shell(cmd, SHELL_FILTER|SHELL_SILENT|SHELL_DOOUT);
56   #ifdef FEAT_AUTOCMD
57 !           --autocmd_block;
58   #endif
59             vim_free(cmd);
60         }
61 --- 840,850 ----
62                     tmp_orig, tmp_new);
63             append_redir(cmd, p_srr, tmp_diff);
64   #ifdef FEAT_AUTOCMD
65 !           block_autocmds();   /* Avoid ShellCmdPost stuff */
66   #endif
67             (void)call_shell(cmd, SHELL_FILTER|SHELL_SILENT|SHELL_DOOUT);
68   #ifdef FEAT_AUTOCMD
69 !           unblock_autocmds();
70   #endif
71             vim_free(cmd);
72         }
73 ***************
74 *** 949,959 ****
75   # endif
76                 eap->arg);
77   #ifdef FEAT_AUTOCMD
78 !       ++autocmd_block;        /* Avoid ShellCmdPost stuff */
79   #endif
80         (void)call_shell(buf, SHELL_FILTER | SHELL_COOKED);
81   #ifdef FEAT_AUTOCMD
82 !       --autocmd_block;
83   #endif
84       }
85   
86 --- 949,959 ----
87   # endif
88                 eap->arg);
89   #ifdef FEAT_AUTOCMD
90 !       block_autocmds();       /* Avoid ShellCmdPost stuff */
91   #endif
92         (void)call_shell(buf, SHELL_FILTER | SHELL_COOKED);
93   #ifdef FEAT_AUTOCMD
94 !       unblock_autocmds();
95   #endif
96       }
97   
98 *** ../vim-7.1.124/src/ex_getln.c       Thu Sep 13 18:25:08 2007
99 --- src/ex_getln.c      Tue Sep 25 22:03:05 2007
100 ***************
101 *** 5925,5931 ****
102   
103   # ifdef FEAT_AUTOCMD
104       /* Don't execute autocommands while creating the window. */
105 !     ++autocmd_block;
106   # endif
107       /* don't use a new tab page */
108       cmdmod.tab = 0;
109 --- 5925,5931 ----
110   
111   # ifdef FEAT_AUTOCMD
112       /* Don't execute autocommands while creating the window. */
113 !     block_autocmds();
114   # endif
115       /* don't use a new tab page */
116       cmdmod.tab = 0;
117 ***************
118 *** 5934,5939 ****
119 --- 5934,5942 ----
120       if (win_split((int)p_cwh, WSP_BOT) == FAIL)
121       {
122         beep_flush();
123 + # ifdef FEAT_AUTOCMD
124 +       unblock_autocmds();
125 + # endif
126         return K_IGNORE;
127       }
128       cmdwin_type = ccline.cmdfirstc;
129 ***************
130 *** 5956,5962 ****
131   
132   # ifdef FEAT_AUTOCMD
133       /* Do execute autocommands for setting the filetype (load syntax). */
134 !     --autocmd_block;
135   # endif
136   
137       /* Showing the prompt may have set need_wait_return, reset it. */
138 --- 5959,5965 ----
139   
140   # ifdef FEAT_AUTOCMD
141       /* Do execute autocommands for setting the filetype (load syntax). */
142 !     unblock_autocmds();
143   # endif
144   
145       /* Showing the prompt may have set need_wait_return, reset it. */
146 ***************
147 *** 6110,6116 ****
148   
149   # ifdef FEAT_AUTOCMD
150         /* Don't execute autocommands while deleting the window. */
151 !       ++autocmd_block;
152   # endif
153         wp = curwin;
154         bp = curbuf;
155 --- 6113,6119 ----
156   
157   # ifdef FEAT_AUTOCMD
158         /* Don't execute autocommands while deleting the window. */
159 !       block_autocmds();
160   # endif
161         wp = curwin;
162         bp = curbuf;
163 ***************
164 *** 6122,6128 ****
165         win_size_restore(&winsizes);
166   
167   # ifdef FEAT_AUTOCMD
168 !       --autocmd_block;
169   # endif
170       }
171   
172 --- 6125,6131 ----
173         win_size_restore(&winsizes);
174   
175   # ifdef FEAT_AUTOCMD
176 !       unblock_autocmds();
177   # endif
178       }
179   
180 *** ../vim-7.1.124/src/fileio.c Sun Aug 12 15:50:26 2007
181 --- src/fileio.c        Wed Sep 26 20:02:54 2007
182 ***************
183 *** 7165,7170 ****
184 --- 7187,7193 ----
185   
186   static event_T        last_event;
187   static int    last_group;
188 + static int    autocmd_blocked = 0;    /* block all autocmds */
189   
190   /*
191    * Show the autocommands for one AutoPat.
192 ***************
193 *** 8454,8460 ****
194        * Quickly return if there are no autocommands for this event or
195        * autocommands are blocked.
196        */
197 !     if (first_autopat[(int)event] == NULL || autocmd_block > 0)
198         goto BYPASS_AU;
199   
200       /*
201 --- 8477,8483 ----
202        * Quickly return if there are no autocommands for this event or
203        * autocommands are blocked.
204        */
205 !     if (first_autopat[(int)event] == NULL || autocmd_blocked > 0)
206         goto BYPASS_AU;
207   
208       /*
209 ***************
210 *** 8766,8771 ****
211 --- 8789,8828 ----
212         aubuflocal_remove(buf);
213   
214       return retval;
215 + }
216
217 + # ifdef FEAT_EVAL
218 + static char_u *old_termresponse = NULL;
219 + # endif
220
221 + /*
222 +  * Block triggering autocommands until unblock_autocmd() is called.
223 +  * Can be used recursively, so long as it's symmetric.
224 +  */
225 +     void
226 + block_autocmds()
227 + {
228 + # ifdef FEAT_EVAL
229 +     /* Remember the value of v:termresponse. */
230 +     if (autocmd_blocked == 0)
231 +       old_termresponse = get_vim_var_str(VV_TERMRESPONSE);
232 + # endif
233 +     ++autocmd_blocked;
234 + }
235
236 +     void
237 + unblock_autocmds()
238 + {
239 +     --autocmd_blocked;
240
241 + # ifdef FEAT_EVAL
242 +     /* When v:termresponse was set while autocommands were blocked, trigger
243 +      * the autocommands now.  Esp. useful when executing a shell command
244 +      * during startup (vimdiff). */
245 +     if (autocmd_blocked == 0
246 +                     && get_vim_var_str(VV_TERMRESPONSE) != old_termresponse)
247 +       apply_autocmds(EVENT_TERMRESPONSE, NULL, NULL, FALSE, curbuf);
248 + # endif
249   }
250   
251   /*
252 *** ../vim-7.1.124/src/globals.h        Tue Sep 25 17:54:41 2007
253 --- src/globals.h       Tue Sep 25 22:03:39 2007
254 ***************
255 *** 366,372 ****
256   EXTERN int    autocmd_busy INIT(= FALSE);     /* Is apply_autocmds() busy? */
257   EXTERN int    autocmd_no_enter INIT(= FALSE); /* *Enter autocmds disabled */
258   EXTERN int    autocmd_no_leave INIT(= FALSE); /* *Leave autocmds disabled */
259 - EXTERN int    autocmd_block INIT(= 0);        /* block all autocmds */
260   EXTERN int    modified_was_set;               /* did ":set modified" */
261   EXTERN int    did_filetype INIT(= FALSE);     /* FileType event found */
262   EXTERN int    keep_filetype INIT(= FALSE);    /* value for did_filetype when
263 --- 366,371 ----
264 *** ../vim-7.1.124/src/misc2.c  Thu May 10 19:58:47 2007
265 --- src/misc2.c Tue Sep 25 22:04:39 2007
266 ***************
267 *** 972,978 ****
268         return;
269       entered = TRUE;
270   
271 !     ++autocmd_block;      /* don't want to trigger autocommands here */
272   
273   #ifdef FEAT_WINDOWS
274       /* close all tabs and windows */
275 --- 973,979 ----
276         return;
277       entered = TRUE;
278   
279 !     block_autocmds();     /* don't want to trigger autocommands here */
280   
281   #ifdef FEAT_WINDOWS
282       /* close all tabs and windows */
283 *** ../vim-7.1.124/src/proto/fileio.pro Thu Jun 28 21:57:08 2007
284 --- src/proto/fileio.pro        Wed Sep 26 20:05:02 2007
285 ***************
286 *** 40,45 ****
287 --- 41,48 ----
288   int trigger_cursorhold __ARGS((void));
289   int has_cursormoved __ARGS((void));
290   int has_cursormovedI __ARGS((void));
291 + void block_autocmds __ARGS((void));
292 + void unblock_autocmds __ARGS((void));
293   int has_autocmd __ARGS((event_T event, char_u *sfname, buf_T *buf));
294   char_u *get_augroup_name __ARGS((expand_T *xp, int idx));
295   char_u *set_context_in_autocmd __ARGS((expand_T *xp, char_u *arg, int doautocmd));
296 *** ../vim-7.1.124/src/window.c Tue Sep 25 14:50:19 2007
297 --- src/window.c        Tue Sep 25 22:05:45 2007
298 ***************
299 *** 1291,1297 ****
300        * Don't execute autocommands while creating the windows.  Must do that
301        * when putting the buffers in the windows.
302        */
303 !     ++autocmd_block;
304   #endif
305   
306       /* todo is number of windows left to create */
307 --- 1291,1297 ----
308        * Don't execute autocommands while creating the windows.  Must do that
309        * when putting the buffers in the windows.
310        */
311 !     block_autocmds();
312   #endif
313   
314       /* todo is number of windows left to create */
315 ***************
316 *** 1313,1319 ****
317         }
318   
319   #ifdef FEAT_AUTOCMD
320 !     --autocmd_block;
321   #endif
322   
323       /* return actual number of windows */
324 --- 1313,1319 ----
325         }
326   
327   #ifdef FEAT_AUTOCMD
328 !     unblock_autocmds();
329   #endif
330   
331       /* return actual number of windows */
332 ***************
333 *** 3415,3421 ****
334        * Don't execute autocommands while creating the tab pages.  Must do that
335        * when putting the buffers in the windows.
336        */
337 !     ++autocmd_block;
338   #endif
339   
340       for (todo = count - 1; todo > 0; --todo)
341 --- 3415,3421 ----
342        * Don't execute autocommands while creating the tab pages.  Must do that
343        * when putting the buffers in the windows.
344        */
345 !     block_autocmds();
346   #endif
347   
348       for (todo = count - 1; todo > 0; --todo)
349 ***************
350 *** 3423,3429 ****
351             break;
352   
353   #ifdef FEAT_AUTOCMD
354 !     --autocmd_block;
355   #endif
356   
357       /* return actual number of tab pages */
358 --- 3423,3429 ----
359             break;
360   
361   #ifdef FEAT_AUTOCMD
362 !     unblock_autocmds();
363   #endif
364   
365       /* return actual number of tab pages */
366 ***************
367 *** 4162,4168 ****
368         /* Don't execute autocommands while the window is not properly
369          * initialized yet.  gui_create_scrollbar() may trigger a FocusGained
370          * event. */
371 !       ++autocmd_block;
372   #endif
373         /*
374          * link the window in the window list
375 --- 4162,4168 ----
376         /* Don't execute autocommands while the window is not properly
377          * initialized yet.  gui_create_scrollbar() may trigger a FocusGained
378          * event. */
379 !       block_autocmds();
380   #endif
381         /*
382          * link the window in the window list
383 ***************
384 *** 4207,4213 ****
385         foldInitWin(newwin);
386   #endif
387   #ifdef FEAT_AUTOCMD
388 !       --autocmd_block;
389   #endif
390   #ifdef FEAT_SEARCH_EXTRA
391         newwin->w_match_head = NULL;
392 --- 4207,4213 ----
393         foldInitWin(newwin);
394   #endif
395   #ifdef FEAT_AUTOCMD
396 !       unblock_autocmds();
397   #endif
398   #ifdef FEAT_SEARCH_EXTRA
399         newwin->w_match_head = NULL;
400 ***************
401 *** 4232,4238 ****
402   #ifdef FEAT_AUTOCMD
403       /* Don't execute autocommands while the window is halfway being deleted.
404        * gui_mch_destroy_scrollbar() may trigger a FocusGained event. */
405 !     ++autocmd_block;
406   #endif
407   
408   #ifdef FEAT_MZSCHEME
409 --- 4232,4238 ----
410   #ifdef FEAT_AUTOCMD
411       /* Don't execute autocommands while the window is halfway being deleted.
412        * gui_mch_destroy_scrollbar() may trigger a FocusGained event. */
413 !     block_autocmds();
414   #endif
415   
416   #ifdef FEAT_MZSCHEME
417 ***************
418 *** 4295,4301 ****
419       vim_free(wp);
420   
421   #ifdef FEAT_AUTOCMD
422 !     --autocmd_block;
423   #endif
424   }
425   
426 --- 4295,4301 ----
427       vim_free(wp);
428   
429   #ifdef FEAT_AUTOCMD
430 !     unblock_autocmds();
431   #endif
432   }
433   
434 *** ../vim-7.1.124/src/version.c        Sat Sep 29 13:15:29 2007
435 --- src/version.c       Sat Sep 29 14:08:31 2007
436 ***************
437 *** 668,669 ****
438 --- 668,671 ----
439   {   /* Add new patch number below this line */
440 + /**/
441 +     125,
442   /**/
443
444 -- 
445 MICHAEL PALIN PLAYED: 1ST SOLDIER WITH A KEEN INTEREST IN BIRDS, DENNIS, MR
446                       DUCK (A VILLAGE CARPENTER WHO IS ALMOST KEENER THAN
447                       ANYONE ELSE TO BURN WITCHES), THREE-HEADED KNIGHT, SIR
448                       GALAHAD, KING OF SWAMP CASTLE, BROTHER MAYNARD'S ROOMATE
449                  "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
450
451  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
452 ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
453 \\\        download, build and distribute -- http://www.A-A-P.org        ///
454  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
This page took 0.063374 seconds and 3 git commands to generate.