mirror of
https://github.com/vim/vim.git
synced 2025-09-25 03:54:15 -04:00
patch 8.1.0743: giving error messages is not flexible
Problem: Giving error messages is not flexible. Solution: Add semsg(). Change argument from "char_u *" to "char *", also for msg() and get rid of most MSG macros. (Ozaki Kiichi, closes #3302) Also make emsg() accept a "char *" argument. Get rid of an enormous number of type casts.
This commit is contained in:
@@ -536,7 +536,7 @@ PythonIO_Init_io(void)
|
||||
|
||||
if (PyErr_Occurred())
|
||||
{
|
||||
EMSG(_("E264: Python: Error initialising I/O objects"));
|
||||
emsg(_("E264: Python: Error initialising I/O objects"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -5664,7 +5664,7 @@ run_cmd(const char *cmd, void *arg UNUSED
|
||||
}
|
||||
else if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_SystemExit))
|
||||
{
|
||||
EMSG2(_(e_py_systemexit), "python");
|
||||
semsg(_(e_py_systemexit), "python");
|
||||
PyErr_Clear();
|
||||
}
|
||||
else
|
||||
@@ -5691,7 +5691,7 @@ run_do(const char *cmd, void *arg UNUSED
|
||||
|
||||
if (u_save((linenr_T)RangeStart - 1, (linenr_T)RangeEnd + 1) != OK)
|
||||
{
|
||||
EMSG(_("cannot save undo information"));
|
||||
emsg(_("cannot save undo information"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -5709,7 +5709,7 @@ run_do(const char *cmd, void *arg UNUSED
|
||||
else if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_SystemExit))
|
||||
{
|
||||
PyMem_Free(code);
|
||||
EMSG2(_(e_py_systemexit), "python");
|
||||
semsg(_(e_py_systemexit), "python");
|
||||
PyErr_Clear();
|
||||
return;
|
||||
}
|
||||
@@ -5720,7 +5720,7 @@ run_do(const char *cmd, void *arg UNUSED
|
||||
|
||||
if (status)
|
||||
{
|
||||
EMSG(_("failed to run the code"));
|
||||
emsg(_("failed to run the code"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -5810,20 +5810,20 @@ run_eval(const char *cmd, typval_T *rettv
|
||||
{
|
||||
if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_SystemExit))
|
||||
{
|
||||
EMSG2(_(e_py_systemexit), "python");
|
||||
semsg(_(e_py_systemexit), "python");
|
||||
PyErr_Clear();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (PyErr_Occurred() && !msg_silent)
|
||||
PyErr_PrintEx(0);
|
||||
EMSG(_("E858: Eval did not return a valid python object"));
|
||||
emsg(_("E858: Eval did not return a valid python object"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ConvertFromPyObject(run_ret, rettv) == -1)
|
||||
EMSG(_("E859: Failed to convert returned python object to vim value"));
|
||||
emsg(_("E859: Failed to convert returned python object to vim value"));
|
||||
Py_DECREF(run_ret);
|
||||
}
|
||||
PyErr_Clear();
|
||||
@@ -6727,7 +6727,7 @@ init_sys_path(void)
|
||||
else
|
||||
{
|
||||
VimTryStart();
|
||||
EMSG(_("Failed to set path hook: sys.path_hooks is not a list\n"
|
||||
emsg(_("Failed to set path hook: sys.path_hooks is not a list\n"
|
||||
"You should now do the following:\n"
|
||||
"- append vim.path_hook to sys.path_hooks\n"
|
||||
"- append vim.VIM_SPECIAL_PATH to sys.path\n"));
|
||||
@@ -6757,7 +6757,7 @@ init_sys_path(void)
|
||||
else
|
||||
{
|
||||
VimTryStart();
|
||||
EMSG(_("Failed to set path: sys.path is not a list\n"
|
||||
emsg(_("Failed to set path: sys.path is not a list\n"
|
||||
"You should now append vim.VIM_SPECIAL_PATH to sys.path"));
|
||||
VimTryEnd(); /* Discard the error */
|
||||
}
|
||||
|
Reference in New Issue
Block a user