summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2010-05-28 21:07:08 +0200
committerBram Moolenaar <Bram@vim.org>2010-05-28 21:07:08 +0200
commit0e1e25fb0a95ac5be411fbf25c8e25e1008c0d3f (patch)
treec2dd9604e8d09cea184ba3d995aa16d564775dcd /src
parent1d68952a3eeb40efc5568d99d0b2dd37960975e7 (diff)
downloadvim-0e1e25fb0a95ac5be411fbf25c8e25e1008c0d3f.zip
Don't execute some autocommands when v:dying is 2 or more.
Diffstat (limited to 'src')
-rw-r--r--src/main.c57
1 files changed, 31 insertions, 26 deletions
diff --git a/src/main.c b/src/main.c
index ec7675e47..f4e1fde19 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1276,40 +1276,44 @@ getout(exitval)
#endif
#ifdef FEAT_AUTOCMD
- /* Trigger BufWinLeave for all windows, but only once per buffer. */
-# if defined FEAT_WINDOWS
- for (tp = first_tabpage; tp != NULL; tp = next_tp)
+ if (get_vim_var_nr(VV_DYING) <= 1)
{
- next_tp = tp->tp_next;
- for (wp = (tp == curtab)
- ? firstwin : tp->tp_firstwin; wp != NULL; wp = wp->w_next)
+ /* Trigger BufWinLeave for all windows, but only once per buffer. */
+# if defined FEAT_WINDOWS
+ for (tp = first_tabpage; tp != NULL; tp = next_tp)
{
- buf = wp->w_buffer;
- if (buf->b_changedtick != -1)
+ next_tp = tp->tp_next;
+ for (wp = (tp == curtab)
+ ? firstwin : tp->tp_firstwin; wp != NULL; wp = wp->w_next)
{
- apply_autocmds(EVENT_BUFWINLEAVE, buf->b_fname, buf->b_fname,
- FALSE, buf);
- buf->b_changedtick = -1; /* note that we did it already */
- /* start all over, autocommands may mess up the lists */
- next_tp = first_tabpage;
- break;
+ buf = wp->w_buffer;
+ if (buf->b_changedtick != -1)
+ {
+ apply_autocmds(EVENT_BUFWINLEAVE, buf->b_fname,
+ buf->b_fname, FALSE, buf);
+ buf->b_changedtick = -1; /* note that we did it already */
+ /* start all over, autocommands may mess up the lists */
+ next_tp = first_tabpage;
+ break;
+ }
}
}
- }
# else
- apply_autocmds(EVENT_BUFWINLEAVE, curbuf, curbuf->b_fname, FALSE, curbuf);
+ apply_autocmds(EVENT_BUFWINLEAVE, curbuf, curbuf->b_fname,
+ FALSE, curbuf);
# endif
- /* Trigger BufUnload for buffers that are loaded */
- for (buf = firstbuf; buf != NULL; buf = buf->b_next)
- if (buf->b_ml.ml_mfp != NULL)
- {
- apply_autocmds(EVENT_BUFUNLOAD, buf->b_fname, buf->b_fname,
+ /* Trigger BufUnload for buffers that are loaded */
+ for (buf = firstbuf; buf != NULL; buf = buf->b_next)
+ if (buf->b_ml.ml_mfp != NULL)
+ {
+ apply_autocmds(EVENT_BUFUNLOAD, buf->b_fname, buf->b_fname,
FALSE, buf);
- if (!buf_valid(buf)) /* autocmd may delete the buffer */
- break;
- }
- apply_autocmds(EVENT_VIMLEAVEPRE, NULL, NULL, FALSE, curbuf);
+ if (!buf_valid(buf)) /* autocmd may delete the buffer */
+ break;
+ }
+ apply_autocmds(EVENT_VIMLEAVEPRE, NULL, NULL, FALSE, curbuf);
+ }
#endif
#ifdef FEAT_VIMINFO
@@ -1319,7 +1323,8 @@ getout(exitval)
#endif
#ifdef FEAT_AUTOCMD
- apply_autocmds(EVENT_VIMLEAVE, NULL, NULL, FALSE, curbuf);
+ if (get_vim_var_nr(VV_DYING) <= 1)
+ apply_autocmds(EVENT_VIMLEAVE, NULL, NULL, FALSE, curbuf);
#endif
#ifdef FEAT_PROFILE