mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
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)
500a1f9972
This commit is contained in:
parent
abe2d90693
commit
054c27075b
@ -116,6 +116,8 @@ struct bw_info {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
static char *e_auchangedbuf = N_("E812: Autocommands changed buffer or buffer name");
|
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)
|
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--;
|
no_wait_return--;
|
||||||
msg_scroll = msg_save;
|
msg_scroll = msg_save;
|
||||||
if (nofile_err) {
|
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
|
if (nofile_err
|
||||||
|
@ -216,6 +216,12 @@ func Test_saveas()
|
|||||||
syntax off
|
syntax off
|
||||||
%bw!
|
%bw!
|
||||||
call delete('Xsaveas.pl')
|
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
|
endfunc
|
||||||
|
|
||||||
func Test_write_errors()
|
func Test_write_errors()
|
||||||
|
Loading…
Reference in New Issue
Block a user