diff options
Diffstat (limited to 'src/ex_cmds.c')
-rw-r--r-- | src/ex_cmds.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/ex_cmds.c b/src/ex_cmds.c index d9f1c993db..1cf090cd81 100644 --- a/src/ex_cmds.c +++ b/src/ex_cmds.c @@ -2094,12 +2094,17 @@ check_overwrite( /* * Write to another file or b_flags set or not writing the whole file: * overwriting only allowed with '!'. + * If "other" is FALSE and bt_nofilename(buf) is TRUE, this must be + * writing an "acwrite" buffer to the same file as its b_ffname, and + * buf_write() will only allow writing with BufWriteCmd autocommands, + * so there is no need for an overwrite check. */ if ( (other - || (buf->b_flags & BF_NOTEDITED) - || ((buf->b_flags & BF_NEW) - && vim_strchr(p_cpo, CPO_OVERNEW) == NULL) - || (buf->b_flags & BF_READERR)) + || (!bt_nofilename(buf) + && ((buf->b_flags & BF_NOTEDITED) + || ((buf->b_flags & BF_NEW) + && vim_strchr(p_cpo, CPO_OVERNEW) == NULL) + || (buf->b_flags & BF_READERR)))) && !p_wa && vim_fexists(ffname)) { |