Mercurial > vim
comparison src/bufwrite.c @ 26861:df2de1e63de0 v8.2.3959
patch 8.2.3959: error messages are spread out
Commit: https://github.com/vim/vim/commit/6d0570117ac86b7979bf249de5741088212d6e17
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Dec 31 18:49:43 2021 +0000
patch 8.2.3959: error messages are spread out
Problem: Error messages are spread out.
Solution: Move more errors to errors.h.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 31 Dec 2021 20:00:05 +0100 |
parents | 2aeea8611342 |
children | 6ee19c6ae8a2 |
comparison
equal
deleted
inserted
replaced
26860:07ad81bfab52 | 26861:df2de1e63de0 |
---|---|
930 return OK; | 930 return OK; |
931 } | 931 } |
932 #ifdef FEAT_EVAL | 932 #ifdef FEAT_EVAL |
933 if (!aborting()) | 933 if (!aborting()) |
934 #endif | 934 #endif |
935 emsg(_("E203: Autocommands deleted or unloaded buffer to be written")); | 935 emsg(_(e_autocommands_deleted_or_unloaded_buffer_to_be_written)); |
936 return FAIL; | 936 return FAIL; |
937 } | 937 } |
938 | 938 |
939 // The autocommands may have changed the number of lines in the file. | 939 // The autocommands may have changed the number of lines in the file. |
940 // When writing the whole file, adjust the end. | 940 // When writing the whole file, adjust the end. |
951 end -= old_line_count - buf->b_ml.ml_line_count; | 951 end -= old_line_count - buf->b_ml.ml_line_count; |
952 if (end < start) | 952 if (end < start) |
953 { | 953 { |
954 --no_wait_return; | 954 --no_wait_return; |
955 msg_scroll = msg_save; | 955 msg_scroll = msg_save; |
956 emsg(_("E204: Autocommand changed number of lines in unexpected way")); | 956 emsg(_(e_autocommands_changed_number_of_lines_in_unexpected_way)); |
957 return FAIL; | 957 return FAIL; |
958 } | 958 } |
959 } | 959 } |
960 } | 960 } |
961 | 961 |
1744 if (*p_ccv != NUL) | 1744 if (*p_ccv != NUL) |
1745 { | 1745 { |
1746 wfname = vim_tempname('w', FALSE); | 1746 wfname = vim_tempname('w', FALSE); |
1747 if (wfname == NULL) // Can't write without a tempfile! | 1747 if (wfname == NULL) // Can't write without a tempfile! |
1748 { | 1748 { |
1749 errmsg = (char_u *)_("E214: Can't find temp file for writing"); | 1749 errmsg = (char_u *)_(e_cant_find_temp_file_for_writing); |
1750 goto restore_backup; | 1750 goto restore_backup; |
1751 } | 1751 } |
1752 } | 1752 } |
1753 # endif | 1753 # endif |
1754 } | 1754 } |
1762 # endif | 1762 # endif |
1763 ) | 1763 ) |
1764 { | 1764 { |
1765 if (!forceit) | 1765 if (!forceit) |
1766 { | 1766 { |
1767 errmsg = (char_u *)_("E213: Cannot convert (add ! to write without conversion)"); | 1767 errmsg = (char_u *)_(e_cannot_convert_add_bang_to_write_without_conversion); |
1768 goto restore_backup; | 1768 goto restore_backup; |
1769 } | 1769 } |
1770 notconverted = TRUE; | 1770 notconverted = TRUE; |
1771 } | 1771 } |
1772 | 1772 |
1824 errmsg = | 1824 errmsg = |
1825 (char_u *)_(e_cant_open_linked_file_for_writing); | 1825 (char_u *)_(e_cant_open_linked_file_for_writing); |
1826 else | 1826 else |
1827 #endif | 1827 #endif |
1828 { | 1828 { |
1829 errmsg = (char_u *)_("E212: Can't open file for writing"); | 1829 errmsg = (char_u *)_(e_cant_open_file_for_writing); |
1830 if (forceit && vim_strchr(p_cpo, CPO_FWRITE) == NULL | 1830 if (forceit && vim_strchr(p_cpo, CPO_FWRITE) == NULL |
1831 && perm >= 0) | 1831 && perm >= 0) |
1832 { | 1832 { |
1833 #ifdef UNIX | 1833 #ifdef UNIX |
1834 // we write to the file, thus it should be marked | 1834 // we write to the file, thus it should be marked |
2452 stat_T st; | 2452 stat_T st; |
2453 | 2453 |
2454 // If the original file does not exist yet | 2454 // If the original file does not exist yet |
2455 // the current backup file becomes the original file | 2455 // the current backup file becomes the original file |
2456 if (org == NULL) | 2456 if (org == NULL) |
2457 emsg(_("E205: Patchmode: can't save original file")); | 2457 emsg(_(e_patchmode_cant_save_original_file)); |
2458 else if (mch_stat(org, &st) < 0) | 2458 else if (mch_stat(org, &st) < 0) |
2459 { | 2459 { |
2460 vim_rename(backup, (char_u *)org); | 2460 vim_rename(backup, (char_u *)org); |
2461 VIM_CLEAR(backup); // don't delete the file | 2461 VIM_CLEAR(backup); // don't delete the file |
2462 #ifdef UNIX | 2462 #ifdef UNIX |
2472 | 2472 |
2473 if (org == NULL | 2473 if (org == NULL |
2474 || (empty_fd = mch_open(org, | 2474 || (empty_fd = mch_open(org, |
2475 O_CREAT | O_EXTRA | O_EXCL | O_NOFOLLOW, | 2475 O_CREAT | O_EXTRA | O_EXCL | O_NOFOLLOW, |
2476 perm < 0 ? 0666 : (perm & 0777))) < 0) | 2476 perm < 0 ? 0666 : (perm & 0777))) < 0) |
2477 emsg(_("E206: patchmode: can't touch empty original file")); | 2477 emsg(_(e_patchmode_cant_touch_empty_original_file)); |
2478 else | 2478 else |
2479 close(empty_fd); | 2479 close(empty_fd); |
2480 } | 2480 } |
2481 if (org != NULL) | 2481 if (org != NULL) |
2482 { | 2482 { |
2487 | 2487 |
2488 // Remove the backup unless 'backup' option is set or there was a | 2488 // Remove the backup unless 'backup' option is set or there was a |
2489 // conversion error. | 2489 // conversion error. |
2490 if (!p_bk && backup != NULL && !write_info.bw_conv_error | 2490 if (!p_bk && backup != NULL && !write_info.bw_conv_error |
2491 && mch_remove(backup) != 0) | 2491 && mch_remove(backup) != 0) |
2492 emsg(_("E207: Can't delete backup file")); | 2492 emsg(_(e_cant_delete_backup_file)); |
2493 | 2493 |
2494 goto nofail; | 2494 goto nofail; |
2495 | 2495 |
2496 // Finish up. We get here either after failure or success. | 2496 // Finish up. We get here either after failure or success. |
2497 fail: | 2497 fail: |