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.
diff --git a/src/normal.c b/src/normal.c
index c973fa1..b7bd864 100644
--- a/src/normal.c
+++ b/src/normal.c
@@ -2211,7 +2211,7 @@
# endif
if (*p_opfunc == NUL)
- EMSG(_("E774: 'operatorfunc' is empty"));
+ emsg(_("E774: 'operatorfunc' is empty"));
else
{
/* Set '[ and '] marks to text to be operated on. */
@@ -2243,7 +2243,7 @@
# endif
}
#else
- EMSG(_("E775: Eval feature not available"));
+ emsg(_("E775: Eval feature not available"));
#endif
}
@@ -3542,9 +3542,9 @@
* didn't find an identifier or string
*/
if (find_type & FIND_STRING)
- EMSG(_("E348: No string under cursor"));
+ emsg(_("E348: No string under cursor"));
else
- EMSG(_(e_noident));
+ emsg(_(e_noident));
return 0;
}
ptr += col;
@@ -5016,7 +5016,7 @@
deleteFold((linenr_T)1, curbuf->b_ml.ml_line_count,
TRUE, FALSE);
else
- EMSG(_("E352: Cannot erase folds with current 'foldmethod'"));
+ emsg(_("E352: Cannot erase folds with current 'foldmethod'"));
break;
/* "zn": fold none: reset 'foldenable' */
@@ -5616,7 +5616,7 @@
|| STRCMP(kp, ":help") == 0);
if (kp_help && *skipwhite(ptr) == NUL)
{
- EMSG(_(e_noident)); /* found white space only */
+ emsg(_(e_noident)); /* found white space only */
return;
}
kp_ex = (*kp == ':');
@@ -5667,7 +5667,7 @@
}
if (n == 0)
{
- EMSG(_(e_noident)); /* found dashes only */
+ emsg(_(e_noident)); /* found dashes only */
vim_free(buf);
return;
}
@@ -7275,7 +7275,7 @@
else if (!checkclearopq(cap->oap))
{
if (!curbuf->b_p_ma)
- EMSG(_(e_modifiable));
+ emsg(_(e_modifiable));
else
{
#ifdef FEAT_VIRTUALEDIT
@@ -7302,7 +7302,7 @@
else if (!checkclearopq(cap->oap))
{
if (!curbuf->b_p_ma)
- EMSG(_(e_modifiable));
+ emsg(_(e_modifiable));
else
{
if (cap->extra_char == Ctrl_V) /* get another character */
@@ -7629,11 +7629,11 @@
else if (cap->cmdchar == 'g')
{
if (curbuf->b_changelistlen == 0)
- EMSG(_("E664: changelist is empty"));
+ emsg(_("E664: changelist is empty"));
else if (cap->count1 < 0)
- EMSG(_("E662: At start of changelist"));
+ emsg(_("E662: At start of changelist"));
else
- EMSG(_("E663: At end of changelist"));
+ emsg(_("E663: At end of changelist"));
}
else
clearopbeep(cap->oap);
@@ -8514,14 +8514,14 @@
if (curwin->w_p_cole > 0 && oldline != curwin->w_cursor.lnum)
redrawWinline(curwin, oldline);
#endif
- /* When '#' is in 'cpoptions' ignore the count. */
- if (vim_strchr(p_cpo, CPO_HASH) != NULL)
- cap->count1 = 1;
#ifdef FEAT_SYN_HL
if (curwin->w_p_cul)
/* force redraw of cursorline */
curwin->w_valid &= ~VALID_CROW;
#endif
+ /* When '#' is in 'cpoptions' ignore the count. */
+ if (vim_strchr(p_cpo, CPO_HASH) != NULL)
+ cap->count1 = 1;
invoke_edit(cap, FALSE, cap->cmdchar, TRUE);
}
}
@@ -9107,7 +9107,7 @@
else if (!curbuf->b_p_ma && !p_im)
{
/* Only give this error when 'insertmode' is off. */
- EMSG(_(e_modifiable));
+ emsg(_(e_modifiable));
clearop(cap->oap);
if (cap->cmdchar == K_PS)
/* drop the pasted text */