aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-09-20 19:49:00 +0800
committerGitHub <noreply@github.com>2022-09-20 19:49:00 +0800
commit054c27075bdad4d42d19d29f6bc578f777a50208 (patch)
tree67eec149de6bf0e0beabb2b8fff87a659b8b8d06
parentabe2d90693e5cec3428c0162c48f0ea38972ff31 (diff)
downloadrneovim-054c27075bdad4d42d19d29f6bc578f777a50208.tar.gz
rneovim-054c27075bdad4d42d19d29f6bc578f777a50208.tar.bz2
rneovim-054c27075bdad4d42d19d29f6bc578f777a50208.zip
vim-patch:9.0.0509: confusing error for "saveas" command with "nofile" buffer (#20258)
Problem: Confusing error for "saveas" command with "nofile" buffer. Solution: Give a clearer error message. (closes vim/vim#11171) https://github.com/vim/vim/commit/500a1f9972afa354f0bc77bc535aabf9f5f0116d
-rw-r--r--src/nvim/fileio.c4
-rw-r--r--src/nvim/testdir/test_writefile.vim6
2 files changed, 9 insertions, 1 deletions
diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c
index 280d32df79..d391e19964 100644
--- a/src/nvim/fileio.c
+++ b/src/nvim/fileio.c
@@ -116,6 +116,8 @@ struct bw_info {
#endif
static char *e_auchangedbuf = N_("E812: Autocommands changed buffer or buffer name");
+static char e_no_matching_autocommands_for_buftype_str_buffer[]
+ = N_("E676: No matching autocommands for buftype=%s buffer");
void filemess(buf_T *buf, char *name, char *s, int attr)
{
@@ -2366,7 +2368,7 @@ int buf_write(buf_T *buf, char *fname, char *sfname, linenr_T start, linenr_T en
no_wait_return--;
msg_scroll = msg_save;
if (nofile_err) {
- emsg(_("E676: No matching autocommands for acwrite buffer"));
+ semsg(_(e_no_matching_autocommands_for_buftype_str_buffer), curbuf->b_p_bt);
}
if (nofile_err
diff --git a/src/nvim/testdir/test_writefile.vim b/src/nvim/testdir/test_writefile.vim
index a8735bcaf1..adc05ab979 100644
--- a/src/nvim/testdir/test_writefile.vim
+++ b/src/nvim/testdir/test_writefile.vim
@@ -216,6 +216,12 @@ func Test_saveas()
syntax off
%bw!
call delete('Xsaveas.pl')
+
+ " :saveas fails for "nofile" buffer
+ set buftype=nofile
+ call assert_fails('saveas Xsafile', 'E676: No matching autocommands for buftype=nofile buffer')
+
+ bwipe!
endfunc
func Test_write_errors()