comparison src/fileio.c @ 1410:cdd82acd75b4 v7.1.125

updated for version 7.1-125
author vimboss
date Sat, 29 Sep 2007 12:16:41 +0000
parents c544a3507e83
children 0e6b369b9760
comparison
equal deleted inserted replaced
1409:4ee809acd1ab 1410:cdd82acd75b4
7163 static void auto_next_pat __ARGS((AutoPatCmd *apc, int stop_at_last)); 7163 static void auto_next_pat __ARGS((AutoPatCmd *apc, int stop_at_last));
7164 7164
7165 7165
7166 static event_T last_event; 7166 static event_T last_event;
7167 static int last_group; 7167 static int last_group;
7168 static int autocmd_blocked = 0; /* block all autocmds */
7168 7169
7169 /* 7170 /*
7170 * Show the autocommands for one AutoPat. 7171 * Show the autocommands for one AutoPat.
7171 */ 7172 */
7172 static void 7173 static void
8452 8453
8453 /* 8454 /*
8454 * Quickly return if there are no autocommands for this event or 8455 * Quickly return if there are no autocommands for this event or
8455 * autocommands are blocked. 8456 * autocommands are blocked.
8456 */ 8457 */
8457 if (first_autopat[(int)event] == NULL || autocmd_block > 0) 8458 if (first_autopat[(int)event] == NULL || autocmd_blocked > 0)
8458 goto BYPASS_AU; 8459 goto BYPASS_AU;
8459 8460
8460 /* 8461 /*
8461 * When autocommands are busy, new autocommands are only executed when 8462 * When autocommands are busy, new autocommands are only executed when
8462 * explicitly enabled with the "nested" flag. 8463 * explicitly enabled with the "nested" flag.
8764 * are deleted. */ 8765 * are deleted. */
8765 if (event == EVENT_BUFWIPEOUT && buf != NULL) 8766 if (event == EVENT_BUFWIPEOUT && buf != NULL)
8766 aubuflocal_remove(buf); 8767 aubuflocal_remove(buf);
8767 8768
8768 return retval; 8769 return retval;
8770 }
8771
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
8769 } 8804 }
8770 8805
8771 /* 8806 /*
8772 * Find next autocommand pattern that matches. 8807 * Find next autocommand pattern that matches.
8773 */ 8808 */