• R/O
  • SSH

vim: Commit

Mirror of the Vim source from https://github.com/vim/vim


Commit MetaInfo

Revisioncdd82acd75b449784a574058387449096667e56f (tree)
Time2007-09-29 21:16:41
Authorvimboss
Commitervimboss

Log Message

updated for version 7.1-125

Change Summary

Incremental Difference

diff -r 4ee809acd1ab -r cdd82acd75b4 src/buffer.c
--- a/src/buffer.c Sat Sep 29 11:16:17 2007 +0000
+++ b/src/buffer.c Sat Sep 29 12:16:41 2007 +0000
@@ -5515,11 +5515,11 @@
55155515
55165516 #ifdef FEAT_AUTOCMD
55175517 if (!aucmd) /* Don't trigger BufDelete autocommands here. */
5518- ++autocmd_block;
5518+ block_autocmds();
55195519 #endif
55205520 close_buffer(NULL, buf, DOBUF_WIPE);
55215521 #ifdef FEAT_AUTOCMD
55225522 if (!aucmd)
5523- --autocmd_block;
5523+ unblock_autocmds();
55245524 #endif
55255525 }
diff -r 4ee809acd1ab -r cdd82acd75b4 src/diff.c
--- a/src/diff.c Sat Sep 29 11:16:17 2007 +0000
+++ b/src/diff.c Sat Sep 29 12:16:41 2007 +0000
@@ -840,11 +840,11 @@
840840 tmp_orig, tmp_new);
841841 append_redir(cmd, p_srr, tmp_diff);
842842 #ifdef FEAT_AUTOCMD
843- ++autocmd_block; /* Avoid ShellCmdPost stuff */
843+ block_autocmds(); /* Avoid ShellCmdPost stuff */
844844 #endif
845845 (void)call_shell(cmd, SHELL_FILTER|SHELL_SILENT|SHELL_DOOUT);
846846 #ifdef FEAT_AUTOCMD
847- --autocmd_block;
847+ unblock_autocmds();
848848 #endif
849849 vim_free(cmd);
850850 }
@@ -949,11 +949,11 @@
949949 # endif
950950 eap->arg);
951951 #ifdef FEAT_AUTOCMD
952- ++autocmd_block; /* Avoid ShellCmdPost stuff */
952+ block_autocmds(); /* Avoid ShellCmdPost stuff */
953953 #endif
954954 (void)call_shell(buf, SHELL_FILTER | SHELL_COOKED);
955955 #ifdef FEAT_AUTOCMD
956- --autocmd_block;
956+ unblock_autocmds();
957957 #endif
958958 }
959959
diff -r 4ee809acd1ab -r cdd82acd75b4 src/ex_getln.c
--- a/src/ex_getln.c Sat Sep 29 11:16:17 2007 +0000
+++ b/src/ex_getln.c Sat Sep 29 12:16:41 2007 +0000
@@ -5925,7 +5925,7 @@
59255925
59265926 # ifdef FEAT_AUTOCMD
59275927 /* Don't execute autocommands while creating the window. */
5928- ++autocmd_block;
5928+ block_autocmds();
59295929 # endif
59305930 /* don't use a new tab page */
59315931 cmdmod.tab = 0;
@@ -5934,6 +5934,9 @@
59345934 if (win_split((int)p_cwh, WSP_BOT) == FAIL)
59355935 {
59365936 beep_flush();
5937+# ifdef FEAT_AUTOCMD
5938+ unblock_autocmds();
5939+# endif
59375940 return K_IGNORE;
59385941 }
59395942 cmdwin_type = ccline.cmdfirstc;
@@ -5956,7 +5959,7 @@
59565959
59575960 # ifdef FEAT_AUTOCMD
59585961 /* Do execute autocommands for setting the filetype (load syntax). */
5959- --autocmd_block;
5962+ unblock_autocmds();
59605963 # endif
59615964
59625965 /* Showing the prompt may have set need_wait_return, reset it. */
@@ -6110,7 +6113,7 @@
61106113
61116114 # ifdef FEAT_AUTOCMD
61126115 /* Don't execute autocommands while deleting the window. */
6113- ++autocmd_block;
6116+ block_autocmds();
61146117 # endif
61156118 wp = curwin;
61166119 bp = curbuf;
@@ -6122,7 +6125,7 @@
61226125 win_size_restore(&winsizes);
61236126
61246127 # ifdef FEAT_AUTOCMD
6125- --autocmd_block;
6128+ unblock_autocmds();
61266129 # endif
61276130 }
61286131
diff -r 4ee809acd1ab -r cdd82acd75b4 src/fileio.c
--- a/src/fileio.c Sat Sep 29 11:16:17 2007 +0000
+++ b/src/fileio.c Sat Sep 29 12:16:41 2007 +0000
@@ -7165,6 +7165,7 @@
71657165
71667166 static event_T last_event;
71677167 static int last_group;
7168+static int autocmd_blocked = 0; /* block all autocmds */
71687169
71697170 /*
71707171 * Show the autocommands for one AutoPat.
@@ -8454,7 +8455,7 @@
84548455 * Quickly return if there are no autocommands for this event or
84558456 * autocommands are blocked.
84568457 */
8457- if (first_autopat[(int)event] == NULL || autocmd_block > 0)
8458+ if (first_autopat[(int)event] == NULL || autocmd_blocked > 0)
84588459 goto BYPASS_AU;
84598460
84608461 /*
@@ -8768,6 +8769,40 @@
87688769 return retval;
87698770 }
87708771
8772+# ifdef FEAT_EVAL
8773+static char_u *old_termresponse = NULL;
8774+# endif
8775+
8776+/*
8777+ * Block triggering autocommands until unblock_autocmd() is called.
8778+ * Can be used recursively, so long as it's symmetric.
8779+ */
8780+ void
8781+block_autocmds()
8782+{
8783+# ifdef FEAT_EVAL
8784+ /* Remember the value of v:termresponse. */
8785+ if (autocmd_blocked == 0)
8786+ old_termresponse = get_vim_var_str(VV_TERMRESPONSE);
8787+# endif
8788+ ++autocmd_blocked;
8789+}
8790+
8791+ void
8792+unblock_autocmds()
8793+{
8794+ --autocmd_blocked;
8795+
8796+# ifdef FEAT_EVAL
8797+ /* When v:termresponse was set while autocommands were blocked, trigger
8798+ * the autocommands now. Esp. useful when executing a shell command
8799+ * during startup (vimdiff). */
8800+ if (autocmd_blocked == 0
8801+ && get_vim_var_str(VV_TERMRESPONSE) != old_termresponse)
8802+ apply_autocmds(EVENT_TERMRESPONSE, NULL, NULL, FALSE, curbuf);
8803+# endif
8804+}
8805+
87718806 /*
87728807 * Find next autocommand pattern that matches.
87738808 */
diff -r 4ee809acd1ab -r cdd82acd75b4 src/globals.h
--- a/src/globals.h Sat Sep 29 11:16:17 2007 +0000
+++ b/src/globals.h Sat Sep 29 12:16:41 2007 +0000
@@ -366,7 +366,6 @@
366366 EXTERN int autocmd_busy INIT(= FALSE); /* Is apply_autocmds() busy? */
367367 EXTERN int autocmd_no_enter INIT(= FALSE); /* *Enter autocmds disabled */
368368 EXTERN int autocmd_no_leave INIT(= FALSE); /* *Leave autocmds disabled */
369-EXTERN int autocmd_block INIT(= 0); /* block all autocmds */
370369 EXTERN int modified_was_set; /* did ":set modified" */
371370 EXTERN int did_filetype INIT(= FALSE); /* FileType event found */
372371 EXTERN int keep_filetype INIT(= FALSE); /* value for did_filetype when
diff -r 4ee809acd1ab -r cdd82acd75b4 src/misc2.c
--- a/src/misc2.c Sat Sep 29 11:16:17 2007 +0000
+++ b/src/misc2.c Sat Sep 29 12:16:41 2007 +0000
@@ -972,7 +972,7 @@
972972 return;
973973 entered = TRUE;
974974
975- ++autocmd_block; /* don't want to trigger autocommands here */
975+ block_autocmds(); /* don't want to trigger autocommands here */
976976
977977 #ifdef FEAT_WINDOWS
978978 /* close all tabs and windows */
diff -r 4ee809acd1ab -r cdd82acd75b4 src/proto/fileio.pro
--- a/src/proto/fileio.pro Sat Sep 29 11:16:17 2007 +0000
+++ b/src/proto/fileio.pro Sat Sep 29 12:16:41 2007 +0000
@@ -40,6 +40,8 @@
4040 int trigger_cursorhold __ARGS((void));
4141 int has_cursormoved __ARGS((void));
4242 int has_cursormovedI __ARGS((void));
43+void block_autocmds __ARGS((void));
44+void unblock_autocmds __ARGS((void));
4345 int has_autocmd __ARGS((event_T event, char_u *sfname, buf_T *buf));
4446 char_u *get_augroup_name __ARGS((expand_T *xp, int idx));
4547 char_u *set_context_in_autocmd __ARGS((expand_T *xp, char_u *arg, int doautocmd));
diff -r 4ee809acd1ab -r cdd82acd75b4 src/version.c
--- a/src/version.c Sat Sep 29 11:16:17 2007 +0000
+++ b/src/version.c Sat Sep 29 12:16:41 2007 +0000
@@ -667,6 +667,8 @@
667667 static int included_patches[] =
668668 { /* Add new patch number below this line */
669669 /**/
670+ 125,
671+/**/
670672 124,
671673 /**/
672674 123,
diff -r 4ee809acd1ab -r cdd82acd75b4 src/window.c
--- a/src/window.c Sat Sep 29 11:16:17 2007 +0000
+++ b/src/window.c Sat Sep 29 12:16:41 2007 +0000
@@ -1291,7 +1291,7 @@
12911291 * Don't execute autocommands while creating the windows. Must do that
12921292 * when putting the buffers in the windows.
12931293 */
1294- ++autocmd_block;
1294+ block_autocmds();
12951295 #endif
12961296
12971297 /* todo is number of windows left to create */
@@ -1313,7 +1313,7 @@
13131313 }
13141314
13151315 #ifdef FEAT_AUTOCMD
1316- --autocmd_block;
1316+ unblock_autocmds();
13171317 #endif
13181318
13191319 /* return actual number of windows */
@@ -3415,7 +3415,7 @@
34153415 * Don't execute autocommands while creating the tab pages. Must do that
34163416 * when putting the buffers in the windows.
34173417 */
3418- ++autocmd_block;
3418+ block_autocmds();
34193419 #endif
34203420
34213421 for (todo = count - 1; todo > 0; --todo)
@@ -3423,7 +3423,7 @@
34233423 break;
34243424
34253425 #ifdef FEAT_AUTOCMD
3426- --autocmd_block;
3426+ unblock_autocmds();
34273427 #endif
34283428
34293429 /* return actual number of tab pages */
@@ -4162,7 +4162,7 @@
41624162 /* Don't execute autocommands while the window is not properly
41634163 * initialized yet. gui_create_scrollbar() may trigger a FocusGained
41644164 * event. */
4165- ++autocmd_block;
4165+ block_autocmds();
41664166 #endif
41674167 /*
41684168 * link the window in the window list
@@ -4207,7 +4207,7 @@
42074207 foldInitWin(newwin);
42084208 #endif
42094209 #ifdef FEAT_AUTOCMD
4210- --autocmd_block;
4210+ unblock_autocmds();
42114211 #endif
42124212 #ifdef FEAT_SEARCH_EXTRA
42134213 newwin->w_match_head = NULL;
@@ -4232,7 +4232,7 @@
42324232 #ifdef FEAT_AUTOCMD
42334233 /* Don't execute autocommands while the window is halfway being deleted.
42344234 * gui_mch_destroy_scrollbar() may trigger a FocusGained event. */
4235- ++autocmd_block;
4235+ block_autocmds();
42364236 #endif
42374237
42384238 #ifdef FEAT_MZSCHEME
@@ -4295,7 +4295,7 @@
42954295 vim_free(wp);
42964296
42974297 #ifdef FEAT_AUTOCMD
4298- --autocmd_block;
4298+ unblock_autocmds();
42994299 #endif
43004300 }
43014301
Show on old repository browser