diff options
author | Bram Moolenaar <Bram@vim.org> | 2004-07-16 20:18:37 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2004-07-16 20:18:37 +0000 |
commit | 21cf823a906f1f66391a145a976fdae8e98e0394 (patch) | |
tree | 5bae960027f0aefb74dc7176fd8e1509aea71200 /src/fileio.c | |
parent | 2df6dcc596d3c79283ec9efc36425a5564a45ab5 (diff) | |
download | vim-21cf823a906f1f66391a145a976fdae8e98e0394.zip |
updated for version 7.0009
Diffstat (limited to 'src/fileio.c')
-rw-r--r-- | src/fileio.c | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/src/fileio.c b/src/fileio.c index 240c7e9d0..02e5ad1e1 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -2720,6 +2720,7 @@ buf_write(buf, fname, sfname, start, end, eap, append, forceit, int buf_fname_f = FALSE; int buf_fname_s = FALSE; int did_cmd = FALSE; + int nofile_err = FALSE; /* * Apply PRE aucocommands. @@ -2742,8 +2743,13 @@ buf_write(buf, fname, sfname, start, end, eap, append, forceit, { if (!(did_cmd = apply_autocmds_exarg(EVENT_FILEAPPENDCMD, sfname, sfname, FALSE, curbuf, eap))) - apply_autocmds_exarg(EVENT_FILEAPPENDPRE, + { + if (bt_nofile(curbuf)) + nofile_err = TRUE; + else + apply_autocmds_exarg(EVENT_FILEAPPENDPRE, sfname, sfname, FALSE, curbuf, eap); + } } else if (filtering) { @@ -2754,15 +2760,25 @@ buf_write(buf, fname, sfname, start, end, eap, append, forceit, { if (!(did_cmd = apply_autocmds_exarg(EVENT_BUFWRITECMD, sfname, sfname, FALSE, curbuf, eap))) - apply_autocmds_exarg(EVENT_BUFWRITEPRE, + { + if (bt_nofile(curbuf)) + nofile_err = TRUE; + else + apply_autocmds_exarg(EVENT_BUFWRITEPRE, sfname, sfname, FALSE, curbuf, eap); + } } else { if (!(did_cmd = apply_autocmds_exarg(EVENT_FILEWRITECMD, sfname, sfname, FALSE, curbuf, eap))) - apply_autocmds_exarg(EVENT_FILEWRITEPRE, + { + if (bt_nofile(curbuf)) + nofile_err = TRUE; + else + apply_autocmds_exarg(EVENT_FILEWRITEPRE, sfname, sfname, FALSE, curbuf, eap); + } } /* restore curwin/curbuf and a few other things */ @@ -2776,11 +2792,15 @@ buf_write(buf, fname, sfname, start, end, eap, append, forceit, */ if (!buf_valid(buf)) buf = NULL; - if (buf == NULL || buf->b_ml.ml_mfp == NULL || did_cmd || aborting()) + if (buf == NULL || buf->b_ml.ml_mfp == NULL + || did_cmd || nofile_err || aborting()) { --no_wait_return; msg_scroll = msg_save; - if (aborting()) + if (nofile_err) + EMSG(_("E676: No matching autocommands for acwrite buffer")); + + if (aborting() || nofile_err) /* An aborting error, interrupt or exception in the * autocommands. */ return FAIL; |