Patch 9.0.0509
Problem:    Confusing error for "saveas" command with "nofile" buffer.
Solution:   Give a clearer error message. (closes #11171)
Files:      src/errors.h, src/bufwrite.c, src/testdir/test_writefile.vim


*** ../vim-9.0.0508/src/errors.h        2022-09-19 15:54:29.539117880 +0100
--- src/errors.h        2022-09-20 11:41:23.252619038 +0100
***************
*** 1715,1722 ****
  EXTERN char e_no_default_font_specified_for_multi_byte_printing[]
        INIT(= N_("E675: No default font specified for multi-byte printing."));
  #endif
! EXTERN char e_no_matching_autocommands_for_acwrite_buffer[]
!       INIT(= N_("E676: No matching autocommands for acwrite buffer"));
  #ifdef FEAT_SYN_HL
  EXTERN char e_error_writing_temp_file[]
        INIT(= N_("E677: Error writing temp file"));
--- 1715,1722 ----
  EXTERN char e_no_default_font_specified_for_multi_byte_printing[]
        INIT(= N_("E675: No default font specified for multi-byte printing."));
  #endif
! EXTERN char e_no_matching_autocommands_for_buftype_str_buffer[]
!       INIT(= N_("E676: No matching autocommands for buftype=%s buffer"));
  #ifdef FEAT_SYN_HL
  EXTERN char e_error_writing_temp_file[]
        INIT(= N_("E677: Error writing temp file"));
*** ../vim-9.0.0508/src/bufwrite.c      2022-08-26 16:41:10.033072432 +0100
--- src/bufwrite.c      2022-09-20 11:42:51.924483834 +0100
***************
*** 888,894 ****
            --no_wait_return;
            msg_scroll = msg_save;
            if (nofile_err)
!               emsg(_(e_no_matching_autocommands_for_acwrite_buffer));
  
            if (nofile_err
  #ifdef FEAT_EVAL
--- 888,895 ----
            --no_wait_return;
            msg_scroll = msg_save;
            if (nofile_err)
!               semsg(_(e_no_matching_autocommands_for_buftype_str_buffer),
!                                                              curbuf->b_p_bt);
  
            if (nofile_err
  #ifdef FEAT_EVAL
*** ../vim-9.0.0508/src/testdir/test_writefile.vim      2022-09-07 
21:30:40.143379043 +0100
--- src/testdir/test_writefile.vim      2022-09-20 11:46:15.380125699 +0100
***************
*** 238,243 ****
--- 238,249 ----
    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()
*** ../vim-9.0.0508/src/version.c       2022-09-20 11:04:43.705967100 +0100
--- src/version.c       2022-09-20 11:42:25.480525706 +0100
***************
*** 701,702 ****
--- 701,704 ----
  {   /* Add new patch number below this line */
+ /**/
+     509,
  /**/

-- 
To be rich is not the end, but only a change of worries.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20220920104942.1A52C1C04B1%40moolenaar.net.

Raspunde prin e-mail lui