changeset 26948:51ddf6740ac6 v8.2.4003

patch 8.2.4003: error messages are spread out Commit: https://github.com/vim/vim/commit/d88be5be80f47826397d12ffc90150a443821f2b Author: Bram Moolenaar <Bram@vim.org> Date: Tue Jan 4 19:57:55 2022 +0000 patch 8.2.4003: 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 Tue, 04 Jan 2022 21:00:05 +0100
parents 81d60d47ba32
children ef3fe9afe119
files src/channel.c src/errors.h src/ex_docmd.c src/ex_eval.c src/gui_at_fs.c src/hardcopy.c src/if_cscope.c src/menu.c src/netbeans.c src/optionstr.c src/os_mswin.c src/sign.c src/typval.c src/version.c
diffstat 14 files changed, 198 insertions(+), 66 deletions(-) [+]
line wrap: on
line diff
--- a/src/channel.c
+++ b/src/channel.c
@@ -4051,7 +4051,7 @@ channel_send(
 	if (!channel->ch_error && fun != NULL)
 	{
 	    ch_error(channel, "%s(): write while not connected", fun);
-	    semsg(_("E630: %s(): write while not connected"), fun);
+	    semsg(_(e_str_write_while_not_connected), fun);
 	}
 	channel->ch_error = TRUE;
 	return FAIL;
@@ -4197,7 +4197,7 @@ channel_send(
 	    if (!channel->ch_error && fun != NULL)
 	    {
 		ch_error(channel, "%s(): write failed", fun);
-		semsg(_("E631: %s(): write failed"), fun);
+		semsg(_(e_str_write_failed), fun);
 	    }
 	    channel->ch_error = TRUE;
 	    return FAIL;
--- a/src/errors.h
+++ b/src/errors.h
@@ -773,7 +773,7 @@ EXTERN char e_menu_only_exists_in_anothe
 #endif
 EXTERN char_u e_no_menu_str[]
 	INIT(= N_("E329: No menu \"%s\""));
-EXTERN char e_menu_path_must_not_loead_to_sub_menu[]
+EXTERN char e_menu_path_must_not_lead_to_sub_menu[]
 	INIT(= N_("E330: Menu path must not lead to a sub-menu"));
 EXTERN char e_must_not_add_menu_items_directly_to_menu_bar[]
 	INIT(= N_("E331: Must not add menu items directly to menu bar"));
@@ -1388,19 +1388,136 @@ EXTERN char e_value_of_imactivatekey_is_
 #ifdef FEAT_EVAL
 EXTERN char e_missing_endtry[]
 	INIT(= N_("E600: Missing :endtry"));
-
+EXTERN char e_try_nesting_too_deep[]
+	INIT(= N_("E601: :try nesting too deep"));
 EXTERN char e_endtry_without_try[]
 	INIT(= N_("E602: :endtry without :try"));
 EXTERN char e_catch_without_try[]
 	INIT(= N_("E603: :catch without :try"));
+EXTERN char e_catch_after_finally[]
+	INIT(= N_("E604: :catch after :finally"));
+EXTERN char e_exception_not_caught_str[]
+	INIT(= N_("E605: Exception not caught: %s"));
 EXTERN char e_finally_without_try[]
 	INIT(= N_("E606: :finally without :try"));
 EXTERN char e_multiple_finally[]
 	INIT(= N_("E607: multiple :finally"));
+EXTERN char e_cannot_throw_exceptions_with_vim_prefix[]
+	INIT(= N_("E608: Cannot :throw exceptions with 'Vim' prefix"));
+#endif
+#ifdef FEAT_CSCOPE
+EXTERN char e_cscope_error_str[]
+	INIT(= N_("E609: Cscope error: %s"));
+#endif
+EXTERN char e_no_argument_to_delete[]
+	INIT(= N_("E610: No argument to delete"));
+#ifdef FEAT_EVAL
+EXTERN char e_using_special_as_number[]
+	INIT(= N_("E611: Using a Special as a Number"));
+#endif
+#ifdef FEAT_SIGNS
+EXTERN char e_too_many_signs_defined[]
+	INIT(= N_("E612: Too many signs defined"));
+#endif
+#ifdef FEAT_PRINTER
+EXTERN char e_unknown_printer_font_str[]
+	INIT(= N_("E613: Unknown printer font: %s"));
+#endif
+#ifdef FEAT_BROWSE
+EXTERN char e_vim_selfile_cant_return_to_current_directory[]
+	INIT(= N_("E614: vim_SelFile: can't return to current directory"));
+EXTERN char e_vim_selfile_cant_get_current_directory[]
+	INIT(= N_("E615: vim_SelFile: can't get current directory"));
+EXTERN char e_vim_selfile_cant_get_font_str[]
+	INIT(= N_("E616: vim_SelFile: can't get font %s"));
+#endif
+#ifdef FEAT_GUI_GTK
+EXTERN char e_cannot_be_changed_in_gtk_GUI[]
+	INIT(= N_("E617: Cannot be changed in the GTK GUI"));
+#endif
+#ifdef FEAT_POSTSCRIPT
+EXTERN char e_file_str_is_not_postscript_resource_file[]
+	INIT(= N_("E618: file \"%s\" is not a PostScript resource file"));
+EXTERN char e_file_str_is_not_supported_postscript_resource_file[]
+	INIT(= N_("E619: file \"%s\" is not a supported PostScript resource file"));
+EXTERN char e_unable_to_convert_to_print_encoding_str[]
+	INIT(= N_("E620: Unable to convert to print encoding \"%s\""));
+EXTERN char e_str_resource_file_has_wrong_version[]
+	INIT(= N_("E621: \"%s\" resource file has wrong version"));
+#endif
+#ifdef FEAT_CSCOPE
+EXTERN char e_could_not_fork_for_cscope[]
+	INIT(= N_("E622: Could not fork for cscope"));
+EXTERN char e_could_not_spawn_cscope_process[]
+	INIT(= N_("E623: Could not spawn cscope process"));
+#endif
+EXTERN char e_cant_open_file_str_3[]
+	INIT(= N_("E624: Can't open file \"%s\""));
+#ifdef FEAT_CSCOPE
+EXTERN char e_cannot_open_cscope_database_str[]
+	INIT(= N_("E625: cannot open cscope database: %s"));
+EXTERN char e_cannot_get_cscope_database_information[]
+	INIT(= N_("E626: cannot get cscope database information"));
+#endif
+#ifdef FEAT_NETBEANS_INTG
+EXTERN char e_missing_colon_str[]
+	INIT(= "E627: missing colon: %s");
+EXTERN char e_missing_bang_or_slash_in_str[]
+	INIT(= "E628: missing ! or / in: %s");
+EXTERN char e_bad_return_from_nb_do_cmd[]
+	INIT(= "E629: bad return from nb_do_cmd");
+#endif
+#ifdef FEAT_JOB_CHANNEL
+EXTERN char e_str_write_while_not_connected[]
+	INIT(= N_("E630: %s(): write while not connected"));
+EXTERN char e_str_write_failed[]
+	INIT(= N_("E631: %s(): write failed"));
+#endif
+#ifdef FEAT_NETBEANS_INTG
+EXTERN char e_invalid_buffer_identifier_in_getlength[]
+	INIT(= "E632: invalid buffer identifier in getLength");
+EXTERN char e_invalid_buffer_identifier_in_gettext[]
+	INIT(= "E633: invalid buffer identifier in getText");
+EXTERN char e_invalid_buffer_identifier_in_remove[]
+	INIT(= "E634: invalid buffer identifier in remove");
+EXTERN char e_invalid_buffer_identifier_in_insert[]
+	INIT(= "E635: invalid buffer identifier in insert");
+EXTERN char e_invalid_buffer_identifier_in_create[]
+	INIT(= "E636: invalid buffer identifier in create");
+EXTERN char e_invalid_buffer_identifier_in_startdocumentlisten[]
+	INIT(= "E637: invalid buffer identifier in startDocumentListen");
+EXTERN char e_invalid_buffer_identifier_in_stopdocumentlisten[]
+	INIT(= "E638: invalid buffer identifier in stopDocumentListen");
+EXTERN char e_invalid_buffer_identifier_in_settitle[]
+	INIT(= "E639: invalid buffer identifier in setTitle");
+EXTERN char e_invalid_buffer_identifier_in_initdone[]
+	INIT(= "E640: invalid buffer identifier in initDone");
+EXTERN char e_invalid_buffer_identifier_in_setbuffernumber[]
+	INIT(= "E641: invalid buffer identifier in setBufferNumber");
+EXTERN char e_file_str_not_found_in_setbuffernumber[]
+	INIT(= "E642: File %s not found in setBufferNumber");
+EXTERN char e_invalid_buffer_identifier_in_setfullname[]
+	INIT(= "E643: invalid buffer identifier in setFullName");
+EXTERN char e_invalid_buffer_identifier_in_editfile[]
+	INIT(= "E644: invalid buffer identifier in editFile");
+EXTERN char e_invalid_buffer_identifier_in_setvisible[]
+	INIT(= "E645: invalid buffer identifier in setVisible");
+EXTERN char e_invalid_buffer_identifier_in_setmodified[]
+	INIT(= "E646: invalid buffer identifier in setModified");
+EXTERN char e_invalid_buffer_identifier_in_setdot[]
+	INIT(= "E647: invalid buffer identifier in setDot");
+EXTERN char e_invalid_buffer_identifier_in_close[]
+	INIT(= "E648: invalid buffer identifier in close");
+EXTERN char e_invalid_buffer_identifier_in_close_2[]
+	INIT(= "E649: invalid buffer identifier in close");
+EXTERN char e_invalid_buffer_identifier_in_defineannotype[]
+	INIT(= "E650: invalid buffer identifier in defineAnnoType");
+EXTERN char e_invalid_buffer_identifier_in_addanno[]
+	INIT(= "E651: invalid buffer identifier in addAnno");
+EXTERN char e_invalid_buffer_identifier_in_getanno[]
+	INIT(= "E652: Invalid buffer identifier in getAnno");
 #endif
 
-EXTERN char e_no_argument_to_delete[]
-	INIT(= N_("E610: No argument to delete"));
 #ifdef FEAT_NETBEANS_INTG
 	// E656
 EXTERN char e_netbeans_disallows_writes_of_unmodified_buffers[]
@@ -1408,11 +1525,19 @@ EXTERN char e_netbeans_disallows_writes_
 	// E657
 EXTERN char e_partial_writes_disallowed_for_netbeans_buffers[]
 	INIT(= N_("Partial writes disallowed for NetBeans buffers"));
+EXTERN char e_netbeans_connection_lost_for_buffer_nr[]
+	INIT(= N_("E658: NetBeans connection lost for buffer %d"));
+EXTERN char e_cannot_open_netbeans_connection_info_file[]
+	INIT(= "E660: Cannot open NetBeans connection info file");
 #endif
 #ifdef HAVE_FSYNC
 EXTERN char e_fsync_failed[]
 	INIT(= N_("E667: Fsync failed"));
 #endif
+#ifdef FEAT_NETBEANS_INTG
+EXTERN char e_wrong_access_mode_for_netbeans_connection_info_file_str[]
+	INIT(= N_("E668: Wrong access mode for NetBeans connection info file: \"%s\""));
+#endif
 EXTERN char e_no_matching_autocommands_for_acwrite_buffer[]
 	INIT(= N_("E676: No matching autocommands for acwrite buffer"));
 EXTERN char e_buffer_nr_invalid_buffer_number[]
@@ -1532,6 +1657,10 @@ EXTERN char e_conflicts_with_value_of_li
 	INIT(= N_("E834: Conflicts with value of 'listchars'"));
 EXTERN char e_conflicts_with_value_of_fillchars[]
 	INIT(= N_("E835: Conflicts with value of 'fillchars'"));
+#ifdef FEAT_NETBEANS_INTG
+EXTERN char e_netbeans_is_not_supported_with_this_GUI[]
+	INIT(= N_("E838: netbeans is not supported with this GUI"));
+#endif
 // E839 unused
 #ifndef FEAT_CLIPBOARD
 EXTERN char e_invalid_register_name[]
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -1401,7 +1401,7 @@ handle_did_throw()
     {
 	case ET_USER:
 	    vim_snprintf((char *)IObuff, IOSIZE,
-		    _("E605: Exception not caught: %s"),
+		    _(e_exception_not_caught_str),
 		    current_exception->value);
 	    p = (char *)vim_strsave(IObuff);
 	    break;
--- a/src/ex_eval.c
+++ b/src/ex_eval.c
@@ -521,7 +521,7 @@ throw_exception(void *value, except_type
 		&& (((char_u *)value)[3] == NUL || ((char_u *)value)[3] == ':'
 		    || ((char_u *)value)[3] == '('))
 	{
-	    emsg(_("E608: Cannot :throw exceptions with 'Vim' prefix"));
+	    emsg(_(e_cannot_throw_exceptions_with_vim_prefix));
 	    goto fail;
 	}
     }
@@ -1624,7 +1624,7 @@ ex_try(exarg_T *eap)
 	return;
 
     if (cstack->cs_idx == CSTACK_LEN - 1)
-	eap->errmsg = _("E601: :try nesting too deep");
+	eap->errmsg = _(e_try_nesting_too_deep);
     else
     {
 	enter_block(cstack);
@@ -1727,7 +1727,7 @@ ex_catch(exarg_T *eap)
 	{
 	    // Give up for a ":catch" after ":finally" and ignore it.
 	    // Just parse.
-	    eap->errmsg = _("E604: :catch after :finally");
+	    eap->errmsg = _(e_catch_after_finally);
 	    give_up = TRUE;
 	}
 	else
--- a/src/gui_at_fs.c
+++ b/src/gui_at_fs.c
@@ -1066,7 +1066,7 @@ SFinitFont(void)
 #endif
 	if (!SFfont)
 	{
-	    semsg(_("E616: vim_SelFile: can't get font %s"), SF_DEFAULT_FONT);
+	    semsg(_(e_vim_selfile_cant_get_font_str), SF_DEFAULT_FONT);
 	    SFstatus = SEL_FILE_CANCEL;
 	    return;
 	}
@@ -2648,7 +2648,7 @@ SFprepareToReturn(void)
     XtRemoveTimeOut(SFdirModTimerId);
     if (SFchdir(SFstartDir))
     {
-	emsg(_("E614: vim_SelFile: can't return to current directory"));
+	emsg(_(e_vim_selfile_cant_return_to_current_directory));
 	SFstatus = SEL_FILE_CANCEL;
     }
 }
@@ -2677,7 +2677,7 @@ vim_SelFile(
 
     if (mch_dirname((char_u *)SFstartDir, MAXPATHL) == FAIL)
     {
-	emsg(_("E615: vim_SelFile: can't get current directory"));
+	emsg(_(e_vim_selfile_cant_get_current_directory));
 	return NULL;
     }
 
--- a/src/hardcopy.c
+++ b/src/hardcopy.c
@@ -1839,7 +1839,7 @@ prt_open_resource(struct prt_ps_resource
     fd_resource = mch_fopen((char *)resource->filename, READBIN);
     if (fd_resource == NULL)
     {
-	semsg(_("E624: Can't open file \"%s\""), resource->filename);
+	semsg(_(e_cant_open_file_str_3), resource->filename);
 	return FALSE;
     }
     CLEAR_FIELD(prt_resfile.buffer);
@@ -1866,8 +1866,8 @@ prt_open_resource(struct prt_ps_resource
     if (prt_resfile_strncmp(offset, PRT_RESOURCE_HEADER,
 				       (int)STRLEN(PRT_RESOURCE_HEADER)) != 0)
     {
-	semsg(_("E618: file \"%s\" is not a PostScript resource file"),
-		resource->filename);
+	semsg(_(e_file_str_is_not_postscript_resource_file),
+							   resource->filename);
 	return FALSE;
     }
 
@@ -1883,8 +1883,8 @@ prt_open_resource(struct prt_ps_resource
     if (prt_resfile_strncmp(offset, PRT_RESOURCE_RESOURCE,
 				     (int)STRLEN(PRT_RESOURCE_RESOURCE)) != 0)
     {
-	semsg(_("E619: file \"%s\" is not a supported PostScript resource file"),
-		resource->filename);
+	semsg(_(e_file_str_is_not_supported_postscript_resource_file),
+							   resource->filename);
 	return FALSE;
     }
     offset += (int)STRLEN(PRT_RESOURCE_RESOURCE);
@@ -1901,8 +1901,8 @@ prt_open_resource(struct prt_ps_resource
 	resource->type = PRT_RESOURCE_TYPE_CMAP;
     else
     {
-	semsg(_("E619: file \"%s\" is not a supported PostScript resource file"),
-		resource->filename);
+	semsg(_(e_file_str_is_not_supported_postscript_resource_file),
+							   resource->filename);
 	return FALSE;
     }
 
@@ -1943,8 +1943,8 @@ prt_open_resource(struct prt_ps_resource
 
     if (!seen_title || !seen_version)
     {
-	semsg(_("E619: file \"%s\" is not a supported PostScript resource file"),
-		resource->filename);
+	semsg(_(e_file_str_is_not_supported_postscript_resource_file),
+							   resource->filename);
 	return FALSE;
     }
 
@@ -1957,7 +1957,7 @@ prt_check_resource(struct prt_ps_resourc
     // Version number m.n should match, the revision number does not matter
     if (STRNCMP(resource->version, version, STRLEN(version)))
     {
-	semsg(_("E621: \"%s\" resource file has wrong version"),
+	semsg(_(e_str_resource_file_has_wrong_version),
 		resource->name);
 	return FALSE;
     }
@@ -2882,12 +2882,12 @@ mch_print_begin(prt_settings_T *psetting
     }
 
     prt_conv.vc_type = CONV_NONE;
-    if (!(enc_canon_props(p_enc) & enc_canon_props(p_encoding) & ENC_8BIT)) {
+    if (!(enc_canon_props(p_enc) & enc_canon_props(p_encoding) & ENC_8BIT))
+    {
 	// Set up encoding conversion if required
 	if (FAIL == convert_setup(&prt_conv, p_enc, p_encoding))
 	{
-	    semsg(_("E620: Unable to convert to print encoding \"%s\""),
-		    p_encoding);
+	    semsg(_(e_unable_to_convert_to_print_encoding_str), p_encoding);
 	    goto theend;
 	}
 	prt_do_conv = TRUE;
--- a/src/if_cscope.c
+++ b/src/if_cscope.c
@@ -814,7 +814,7 @@ err_closing:
     switch (csinfo[i].pid = fork())
     {
     case -1:
-	(void)emsg(_("E622: Could not fork for cscope"));
+	(void)emsg(_(e_could_not_fork_for_cscope));
 	goto err_closing;
     case 0:				// child: run cscope.
 	if (dup2(to_cs[0], STDIN_FILENO) == -1)
@@ -971,7 +971,7 @@ err_closing:
     if (!created)
     {
 	PERROR(_("cs_create_connection exec failed"));
-	(void)emsg(_("E623: Could not spawn cscope process"));
+	(void)emsg(_(e_could_not_spawn_cscope_process));
 	goto err_closing;
     }
     // else
@@ -1316,7 +1316,7 @@ cs_insert_filelist(
 	case FILEINFO_READ_FAIL:	// CreateFile() failed
 	    if (p_csverbose)
 	    {
-		char *cant_msg = _("E625: cannot open cscope database: %s");
+		char *cant_msg = _(e_cannot_open_cscope_database_str);
 		char *winmsg = GetWin32Error();
 
 		if (winmsg != NULL)
@@ -1332,7 +1332,7 @@ cs_insert_filelist(
 
 	case FILEINFO_INFO_FAIL:    // GetFileInformationByHandle() failed
 	    if (p_csverbose)
-		(void)emsg(_("E626: cannot get cscope database information"));
+		(void)emsg(_(e_cannot_get_cscope_database_information));
 	    return -1;
     }
 #endif
@@ -2061,7 +2061,7 @@ cs_read_prompt(int i)
     int		epromptlen = (int)strlen(eprompt);
     int		n;
 
-    cs_emsg = _("E609: Cscope error: %s");
+    cs_emsg = _(e_cscope_error_str);
     // compute maximum allowed len for Cscope error message
     maxlen = (int)(IOSIZE - strlen(cs_emsg));
 
--- a/src/menu.c
+++ b/src/menu.c
@@ -530,7 +530,7 @@ add_menu_path(
 		if (*next_name == NUL && menu->children != NULL)
 		{
 		    if (!sys_menu)
-			emsg(_(e_menu_path_must_not_loead_to_sub_menu));
+			emsg(_(e_menu_path_must_not_lead_to_sub_menu));
 		    goto erret;
 		}
 		if (*next_name != NUL && menu->children == NULL
--- a/src/netbeans.c
+++ b/src/netbeans.c
@@ -257,7 +257,7 @@ getConnInfo(char *file, char **host, cha
     {
 	nbdebug(("Wrong access mode for NetBeans connection info file: \"%s\"\n",
 								       file));
-	semsg(_("E668: Wrong access mode for NetBeans connection info file: \"%s\""),
+	semsg(_(e_wrong_access_mode_for_netbeans_connection_info_file_str),
 									file);
 	return FAIL;
     }
@@ -267,7 +267,7 @@ getConnInfo(char *file, char **host, cha
     if (fp == NULL)
     {
 	nbdebug(("Cannot open NetBeans connection info file\n"));
-	PERROR("E660: Cannot open NetBeans connection info file");
+	PERROR(e_cannot_open_netbeans_connection_info_file);
 	return FAIL;
     }
 
@@ -477,7 +477,7 @@ nb_parse_cmd(char_u *cmd)
     if (*verb != ':')
     {
 	nbdebug(("    missing colon: %s\n", cmd));
-	semsg("E627: missing colon: %s", cmd);
+	semsg(e_missing_colon_str, cmd);
 	return;
     }
     ++verb; // skip colon
@@ -501,7 +501,7 @@ nb_parse_cmd(char_u *cmd)
     if (isfunc < 0)
     {
 	nbdebug(("    missing ! or / in: %s\n", cmd));
-	semsg("E628: missing ! or / in: %s", cmd);
+	semsg(e_missing_bang_or_slash_in_str, cmd);
 	return;
     }
 
@@ -518,7 +518,7 @@ nb_parse_cmd(char_u *cmd)
 	 * so I'm disabling it except for debugging.
 	 */
 	nbdebug(("nb_parse_cmd: Command error for \"%s\"\n", cmd));
-	emsg("E629: bad return from nb_do_cmd");
+	emsg(e_bad_return_from_nb_do_cmd);
 #endif
     }
 }
@@ -1040,7 +1040,7 @@ nb_do_cmd(
 	    if (buf == NULL || buf->bufp == NULL)
 	    {
 		nbdebug(("    Invalid buffer identifier in getAnno\n"));
-		emsg("E652: Invalid buffer identifier in getAnno");
+		emsg(e_invalid_buffer_identifier_in_getanno);
 		retval = FAIL;
 	    }
 	    else
@@ -1063,7 +1063,7 @@ nb_do_cmd(
 	    if (buf == NULL || buf->bufp == NULL)
 	    {
 		nbdebug(("    invalid buffer identifier in getLength\n"));
-		emsg("E632: invalid buffer identifier in getLength");
+		emsg(e_invalid_buffer_identifier_in_getlength);
 		retval = FAIL;
 	    }
 	    else
@@ -1085,7 +1085,7 @@ nb_do_cmd(
 	    if (buf == NULL || buf->bufp == NULL)
 	    {
 		nbdebug(("    invalid buffer identifier in getText\n"));
-		emsg("E633: invalid buffer identifier in getText");
+		emsg(e_invalid_buffer_identifier_in_gettext);
 		retval = FAIL;
 	    }
 	    else
@@ -1148,7 +1148,7 @@ nb_do_cmd(
 	    if (buf == NULL || buf->bufp == NULL)
 	    {
 		nbdebug(("    invalid buffer identifier in remove\n"));
-		emsg("E634: invalid buffer identifier in remove");
+		emsg(e_invalid_buffer_identifier_in_remove);
 		retval = FAIL;
 	    }
 	    else
@@ -1318,7 +1318,7 @@ nb_do_cmd(
 	    if (buf == NULL || buf->bufp == NULL)
 	    {
 		nbdebug(("    invalid buffer identifier in insert\n"));
-		emsg("E635: invalid buffer identifier in insert");
+		emsg(e_invalid_buffer_identifier_in_insert);
 		retval = FAIL;
 	    }
 	    else if (args != NULL)
@@ -1478,7 +1478,7 @@ nb_do_cmd(
 	    if (buf == NULL)
 	    {
 		nbdebug(("    invalid buffer identifier in create\n"));
-		emsg("E636: invalid buffer identifier in create");
+		emsg(e_invalid_buffer_identifier_in_create);
 		return FAIL;
 	    }
 	    VIM_CLEAR(buf->displayname);
@@ -1526,7 +1526,7 @@ nb_do_cmd(
 	    if (buf == NULL)
 	    {
 		nbdebug(("    invalid buffer identifier in startDocumentListen\n"));
-		emsg("E637: invalid buffer identifier in startDocumentListen");
+		emsg(e_invalid_buffer_identifier_in_startdocumentlisten);
 		return FAIL;
 	    }
 	    buf->fireChanges = 1;
@@ -1537,7 +1537,7 @@ nb_do_cmd(
 	    if (buf == NULL)
 	    {
 		nbdebug(("    invalid buffer identifier in stopDocumentListen\n"));
-		emsg("E638: invalid buffer identifier in stopDocumentListen");
+		emsg(e_invalid_buffer_identifier_in_stopdocumentlisten);
 		return FAIL;
 	    }
 	    buf->fireChanges = 0;
@@ -1545,8 +1545,9 @@ nb_do_cmd(
 	    {
 		if (!buf->bufp->b_netbeans_file)
 		{
-		    nbdebug(("E658: NetBeans connection lost for buffer %d\n", buf->bufp->b_fnum));
-		    semsg(_("E658: NetBeans connection lost for buffer %d"),
+		    nbdebug((e_netbeans_connection_lost_for_buffer_nr,
+							   buf->bufp->b_fnum));
+		    semsg(_(e_netbeans_connection_lost_for_buffer_nr),
 							   buf->bufp->b_fnum);
 		}
 		else
@@ -1566,7 +1567,7 @@ nb_do_cmd(
 	    if (buf == NULL)
 	    {
 		nbdebug(("    invalid buffer identifier in setTitle\n"));
-		emsg("E639: invalid buffer identifier in setTitle");
+		emsg(e_invalid_buffer_identifier_in_settitle);
 		return FAIL;
 	    }
 	    vim_free(buf->displayname);
@@ -1578,7 +1579,7 @@ nb_do_cmd(
 	    if (buf == NULL || buf->bufp == NULL)
 	    {
 		nbdebug(("    invalid buffer identifier in initDone\n"));
-		emsg("E640: invalid buffer identifier in initDone");
+		emsg(e_invalid_buffer_identifier_in_initdone);
 		return FAIL;
 	    }
 	    do_update = 1;
@@ -1599,7 +1600,7 @@ nb_do_cmd(
 	    if (buf == NULL)
 	    {
 		nbdebug(("    invalid buffer identifier in setBufferNumber\n"));
-		emsg("E641: invalid buffer identifier in setBufferNumber");
+		emsg(e_invalid_buffer_identifier_in_setbuffernumber);
 		return FAIL;
 	    }
 	    path = (char_u *)nb_unquote(args, NULL);
@@ -1610,7 +1611,7 @@ nb_do_cmd(
 	    if (bufp == NULL)
 	    {
 		nbdebug(("    File %s not found in setBufferNumber\n", args));
-		semsg("E642: File %s not found in setBufferNumber", args);
+		semsg(e_file_str_not_found_in_setbuffernumber, args);
 		return FAIL;
 	    }
 	    buf->bufp = bufp;
@@ -1635,7 +1636,7 @@ nb_do_cmd(
 	    if (buf == NULL)
 	    {
 		nbdebug(("    invalid buffer identifier in setFullName\n"));
-		emsg("E643: invalid buffer identifier in setFullName");
+		emsg(e_invalid_buffer_identifier_in_setfullname);
 		return FAIL;
 	    }
 	    vim_free(buf->displayname);
@@ -1658,7 +1659,7 @@ nb_do_cmd(
 	    if (buf == NULL)
 	    {
 		nbdebug(("    invalid buffer identifier in editFile\n"));
-		emsg("E644: invalid buffer identifier in editFile");
+		emsg(e_invalid_buffer_identifier_in_editfile);
 		return FAIL;
 	    }
 	    // Edit a file: like create + setFullName + read the file.
@@ -1684,7 +1685,7 @@ nb_do_cmd(
 		// This message was commented out, probably because it can
 		// happen when shutting down.
 		if (p_verbose > 0)
-		    emsg("E645: invalid buffer identifier in setVisible");
+		    emsg(e_invalid_buffer_identifier_in_setvisible);
 		return FAIL;
 	    }
 	    if (streq((char *)args, "T") && buf->bufp != curbuf)
@@ -1724,7 +1725,7 @@ nb_do_cmd(
 		// This message was commented out, probably because it can
 		// happen when shutting down.
 		if (p_verbose > 0)
-		    emsg("E646: invalid buffer identifier in setModified");
+		    emsg(e_invalid_buffer_identifier_in_setmodified);
 		return FAIL;
 	    }
 	    prev_b_changed = buf->bufp->b_changed;
@@ -1807,7 +1808,7 @@ nb_do_cmd(
 	    if (buf == NULL || buf->bufp == NULL)
 	    {
 		nbdebug(("    invalid buffer identifier in setDot\n"));
-		emsg("E647: invalid buffer identifier in setDot");
+		emsg(e_invalid_buffer_identifier_in_setdot);
 		return FAIL;
 	    }
 
@@ -1860,7 +1861,7 @@ nb_do_cmd(
 	    if (buf == NULL)
 	    {
 		nbdebug(("    invalid buffer identifier in close\n"));
-		emsg("E648: invalid buffer identifier in close");
+		emsg(e_invalid_buffer_identifier_in_close);
 		return FAIL;
 	    }
 
@@ -1874,7 +1875,7 @@ nb_do_cmd(
 		// This message was commented out, probably because it can
 		// happen when shutting down.
 		if (p_verbose > 0)
-		    emsg("E649: invalid buffer identifier in close");
+		    emsg(e_invalid_buffer_identifier_in_close_2);
 	    }
 	    nbdebug(("    CLOSE %d: %s\n", bufno, name));
 #ifdef FEAT_GUI
@@ -1913,7 +1914,7 @@ nb_do_cmd(
 	    if (buf == NULL)
 	    {
 		nbdebug(("    invalid buffer identifier in defineAnnoType\n"));
-		emsg("E650: invalid buffer identifier in defineAnnoType");
+		emsg(e_invalid_buffer_identifier_in_defineannotype);
 		return FAIL;
 	    }
 
@@ -1970,7 +1971,7 @@ nb_do_cmd(
 	    if (buf == NULL || buf->bufp == NULL)
 	    {
 		nbdebug(("    invalid buffer identifier in addAnno\n"));
-		emsg("E651: invalid buffer identifier in addAnno");
+		emsg(e_invalid_buffer_identifier_in_addanno);
 		return FAIL;
 	    }
 
@@ -2350,7 +2351,7 @@ ex_nbstart(
 		&& !defined(FEAT_GUI_MSWIN)
     if (gui.in_use)
     {
-	emsg(_("E838: netbeans is not supported with this GUI"));
+	emsg(_(e_netbeans_is_not_supported_with_this_GUI));
 	return;
     }
 # endif
--- a/src/optionstr.c
+++ b/src/optionstr.c
@@ -1003,9 +1003,9 @@ ambw_end:
 #if defined(FEAT_GUI_GTK)
 	if (errmsg == NULL && varp == &p_tenc && gui.in_use)
 	{
-	    // GTK+ 2 uses only a single encoding, and that is UTF-8.
+	    // GTK uses only a single encoding, and that is UTF-8.
 	    if (STRCMP(p_tenc, "utf-8") != 0)
-		errmsg = N_("E617: Cannot be changed in the GTK+ 2 GUI");
+		errmsg = e_cannot_be_changed_in_gtk_GUI;
 	}
 #endif
 
--- a/src/os_mswin.c
+++ b/src/os_mswin.c
@@ -1458,7 +1458,7 @@ mch_print_init(prt_settings_T *psettings
     CLEAR_FIELD(fLogFont);
     if (get_logfont(&fLogFont, p_pfn, prt_dlg.hDC, TRUE) == FAIL)
     {
-	semsg(_("E613: Unknown printer font: %s"), p_pfn);
+	semsg(_(e_unknown_printer_font_str), p_pfn);
 	mch_print_cleanup();
 	return FALSE;
     }
--- a/src/sign.c
+++ b/src/sign.c
@@ -933,7 +933,7 @@ alloc_new_sign(char_u *name)
 	    if (next_sign_typenr == start)
 	    {
 		vim_free(sp);
-		emsg(_("E612: Too many signs defined"));
+		emsg(_(e_too_many_signs_defined));
 		return NULL;
 	    }
 	    lp = first_sign;  // start all over
--- a/src/typval.c
+++ b/src/typval.c
@@ -221,7 +221,7 @@ tv_get_bool_or_number_chk(typval_T *varp
 		if (varp->v_type == VAR_BOOL)
 		    emsg(_(e_using_bool_as_number));
 		else
-		    emsg(_("E611: Using a Special as a Number"));
+		    emsg(_(e_using_special_as_number));
 		break;
 	    }
 	    return varp->vval.v_number == VVAL_TRUE ? 1 : 0;
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    4003,
+/**/
     4002,
 /**/
     4001,