diff src/memline.c @ 26909:aa65d1808bd0 v8.2.3983

patch 8.2.3983: error messages are spread out Commit: https://github.com/vim/vim/commit/eaaac014a01ce37c1f86dbda054c01a5c6f034e7 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jan 2 17:00:40 2022 +0000 patch 8.2.3983: error messages are spread out Problem: Error messages are spread out. Solution: Move more error messages to errors.h.
author Bram Moolenaar <Bram@vim.org>
date Sun, 02 Jan 2022 18:15:04 +0100
parents d02d40f0261c
children d92e0d85923f
line wrap: on
line diff
--- a/src/memline.c
+++ b/src/memline.c
@@ -719,7 +719,7 @@ ml_setname(buf_T *buf)
 	if (mfp->mf_fd < 0)
 	{
 	    // could not (re)open the swap file, what can we do????
-	    emsg(_("E301: Oops, lost the swap file!!!"));
+	    emsg(_(e_oops_lost_the_swap_file));
 	    return;
 	}
 #ifdef HAVE_FD_CLOEXEC
@@ -731,7 +731,7 @@ ml_setname(buf_T *buf)
 #endif
     }
     if (!success)
-	emsg(_("E302: Could not rename swap file"));
+	emsg(_(e_could_not_rename_swap_file));
 }
 
 /*
@@ -823,7 +823,7 @@ ml_open_file(buf_T *buf)
     {
 	need_wait_return = TRUE;	// call wait_return later
 	++no_wait_return;
-	(void)semsg(_("E303: Unable to open swap file for \"%s\", recovery impossible"),
+	(void)semsg(_(e_unable_to_open_swap_file_for_str_recovery_impossible),
 		    buf_spname(buf) != NULL ? buf_spname(buf) : buf->b_fname);
 	--no_wait_return;
     }
@@ -959,7 +959,7 @@ ml_upd_block0(buf_T *buf, upd_block0_T w
 
     b0p = (ZERO_BL *)(hp->bh_data);
     if (ml_check_b0_id(b0p) == FAIL)
-	iemsg(_("E304: ml_upd_block0(): Didn't get block 0??"));
+	iemsg(_(e_ml_upd_block0_didnt_get_block_zero));
     else
     {
 	if (what == UB_FNAME)
@@ -1209,7 +1209,7 @@ ml_recover(int checkext)
 	len = recover_names(fname, FALSE, 0, NULL);
 	if (len == 0)		    // no swap files found
 	{
-	    semsg(_("E305: No swap file found for %s"), fname);
+	    semsg(_(e_no_swap_file_found_for_str), fname);
 	    goto theend;
 	}
 	if (len == 1)		    // one swap file found, use it
@@ -1266,7 +1266,7 @@ ml_recover(int checkext)
     if (mfp == NULL || mfp->mf_fd < 0)
     {
 	if (fname_used != NULL)
-	    semsg(_("E306: Cannot open %s"), fname_used);
+	    semsg(_(e_cannot_open_str), fname_used);
 	goto theend;
     }
     buf->b_ml.ml_mfp = mfp;
@@ -1308,7 +1308,7 @@ ml_recover(int checkext)
     }
     if (ml_check_b0_id(b0p) == FAIL)
     {
-	semsg(_("E307: %s does not look like a Vim swap file"), mfp->mf_fname);
+	semsg(_(e_str_does_not_look_like_vim_swap_file), mfp->mf_fname);
 	goto theend;
     }
     if (b0_magic_wrong(b0p))
@@ -1410,7 +1410,7 @@ ml_recover(int checkext)
 	    && ((mch_stat((char *)mfp->mf_fname, &swp_stat) != -1
 		    && org_stat.st_mtime > swp_stat.st_mtime)
 		|| org_stat.st_mtime != mtime))
-	emsg(_("E308: Warning: Original file may have been changed"));
+	emsg(_(e_warning_original_file_may_have_been_changed));
     out_flush();
 
     // Get the 'fileformat' and 'fileencoding' from block zero.
@@ -1514,7 +1514,7 @@ ml_recover(int checkext)
 	{
 	    if (bnum == 1)
 	    {
-		semsg(_("E309: Unable to read block 1 from %s"), mfp->mf_fname);
+		semsg(_(e_unable_to_read_block_one_from_str), mfp->mf_fname);
 		goto theend;
 	    }
 	    ++error;
@@ -1600,7 +1600,7 @@ ml_recover(int checkext)
 		{
 		    if (bnum == 1)
 		    {
-			semsg(_("E310: Block 1 ID wrong (%s not a .swp file?)"),
+			semsg(_(e_block_one_id_wrong_str_not_swp_file),
 							       mfp->mf_fname);
 			goto theend;
 		    }
@@ -1721,12 +1721,12 @@ ml_recover(int checkext)
 
     recoverymode = FALSE;
     if (got_int)
-	emsg(_("E311: Recovery Interrupted"));
+	emsg(_(e_recovery_interrupted));
     else if (error)
     {
 	++no_wait_return;
 	msg(">>>>>>>>>>>>>");
-	emsg(_("E312: Errors detected while recovering; look for lines starting with ???"));
+	emsg(_(e_errors_detected_while_recovering_look_for_lines_starting_with_questions));
 	--no_wait_return;
 	msg(_("See \":help E312\" for more information."));
 	msg(">>>>>>>>>>>>>");
@@ -2485,7 +2485,7 @@ ml_preserve(buf_T *buf, int message)
     if (mfp == NULL || mfp->mf_fname == NULL)
     {
 	if (message)
-	    emsg(_("E313: Cannot preserve, there is no swap file"));
+	    emsg(_(e_cannot_preserve_there_is_no_swap_file));
 	return;
     }
 
@@ -2540,7 +2540,7 @@ theend:
 	if (status == OK)
 	    msg(_("File preserved"));
 	else
-	    emsg(_("E314: Preserve failed"));
+	    emsg(_(e_preserve_failed));
     }
 }
 
@@ -2615,7 +2615,7 @@ ml_get_buf(
 	    // Avoid giving this message for a recursive call, may happen when
 	    // the GUI redraws part of the text.
 	    ++recursive;
-	    siemsg(_("E315: ml_get: invalid lnum: %ld"), lnum);
+	    siemsg(_(e_ml_get_invalid_lnum_nr), lnum);
 	    --recursive;
 	}
 errorret:
@@ -2660,7 +2660,7 @@ errorret:
 		++recursive;
 		get_trans_bufname(buf);
 		shorten_dir(NameBuff);
-		siemsg(_("E316: ml_get: cannot find line %ld in buffer %d %s"),
+		siemsg(_(e_ml_get_cannot_find_line_nr_in_buffer_nr_str),
 						  lnum, buf->b_fnum, NameBuff);
 		--recursive;
 	    }
@@ -3114,7 +3114,7 @@ ml_append_int(
 	    pp = (PTR_BL *)(hp->bh_data);   // must be pointer block
 	    if (pp->pb_id != PTR_ID)
 	    {
-		iemsg(_("E317: pointer block id wrong 3"));
+		iemsg(_(e_pointer_block_id_wrong_three));
 		mf_put(mfp, hp, FALSE, FALSE);
 		goto theend;
 	    }
@@ -3256,7 +3256,7 @@ ml_append_int(
 	 */
 	if (stack_idx < 0)
 	{
-	    iemsg(_("E318: Updated too many blocks?"));
+	    iemsg(_(e_updated_too_many_blocks));
 	    buf->b_ml.ml_stack_top = 0;	// invalidate stack
 	}
     }
@@ -3713,7 +3713,7 @@ ml_delete_int(buf_T *buf, linenr_T lnum,
 	    pp = (PTR_BL *)(hp->bh_data);   // must be pointer block
 	    if (pp->pb_id != PTR_ID)
 	    {
-		iemsg(_("E317: pointer block id wrong 4"));
+		iemsg(_(e_pointer_block_id_wrong_four));
 		mf_put(mfp, hp, FALSE, FALSE);
 		goto theend;
 	    }
@@ -3978,7 +3978,7 @@ ml_flush_line(buf_T *buf)
 
 	hp = ml_find_line(buf, lnum, ML_FIND);
 	if (hp == NULL)
-	    siemsg(_("E320: Cannot find line %ld"), lnum);
+	    siemsg(_(e_cannot_find_line_nr), lnum);
 	else
 	{
 	    dp = (DATA_BL *)(hp->bh_data);
@@ -4238,7 +4238,7 @@ ml_find_line(buf_T *buf, linenr_T lnum, 
 	pp = (PTR_BL *)(dp);		// must be pointer block
 	if (pp->pb_id != PTR_ID)
 	{
-	    iemsg(_("E317: pointer block id wrong"));
+	    iemsg(_(e_pointer_block_id_wrong));
 	    goto error_block;
 	}
 
@@ -4283,11 +4283,11 @@ ml_find_line(buf_T *buf, linenr_T lnum, 
 	if (idx >= (int)pp->pb_count)	    // past the end: something wrong!
 	{
 	    if (lnum > buf->b_ml.ml_line_count)
-		siemsg(_("E322: line number out of range: %ld past the end"),
+		siemsg(_(e_line_number_out_of_range_nr_past_the_end),
 					      lnum - buf->b_ml.ml_line_count);
 
 	    else
-		siemsg(_("E323: line count wrong in block %ld"), bnum);
+		siemsg(_(e_line_count_wrong_in_block_nr), bnum);
 	    goto error_block;
 	}
 	if (action == ML_DELETE)
@@ -4380,7 +4380,7 @@ ml_lineadd(buf_T *buf, int count)
 	if (pp->pb_id != PTR_ID)
 	{
 	    mf_put(mfp, hp, FALSE, FALSE);
-	    iemsg(_("E317: pointer block id wrong 2"));
+	    iemsg(_(e_pointer_block_id_wrong_two));
 	    break;
 	}
 	pp->pb_pointer[ip->ip_index].pe_line_count += count;
@@ -4594,7 +4594,7 @@ attention_message(
     time_t	swap_mtime;
 
     ++no_wait_return;
-    (void)emsg(_("E325: ATTENTION"));
+    (void)emsg(_(e_attention));
     msg_puts(_("\nFound a swap file by the name \""));
     msg_home_replace(fname);
     msg_puts("\"\n");
@@ -5141,7 +5141,7 @@ findswapname(
 	{
 	    if (fname[n - 2] == 'a')    // ".saa": tried enough, give up
 	    {
-		emsg(_("E326: Too many swap files found"));
+		emsg(_(e_too_many_swap_files_found));
 		VIM_CLEAR(fname);
 		break;
 	    }