forked from aniani/vim
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:
23
src/spell.c
23
src/spell.c
@@ -717,7 +717,7 @@ find_word(matchinf_T *mip, int mode)
|
||||
if (endidxcnt == MAXWLEN)
|
||||
{
|
||||
/* Must be a corrupted spell file. */
|
||||
EMSG(_(e_format));
|
||||
emsg(_(e_format));
|
||||
return;
|
||||
}
|
||||
endlen[endidxcnt] = wlen;
|
||||
@@ -1537,7 +1537,7 @@ no_spell_checking(win_T *wp)
|
||||
if (!wp->w_p_spell || *wp->w_s->b_p_spl == NUL
|
||||
|| wp->w_s->b_langp.ga_len == 0)
|
||||
{
|
||||
EMSG(_("E756: Spell checking is not enabled"));
|
||||
emsg(_("E756: Spell checking is not enabled"));
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
@@ -1888,7 +1888,7 @@ spell_load_lang(char_u *lang)
|
||||
|
||||
if (r == FAIL)
|
||||
{
|
||||
smsg((char_u *)
|
||||
smsg(
|
||||
#ifdef VMS
|
||||
_("Warning: Cannot find word list \"%s_%s.spl\" or \"%s_ascii.spl\""),
|
||||
#else
|
||||
@@ -2307,7 +2307,7 @@ count_syllables(slang_T *slang, char_u *word)
|
||||
* Parse 'spelllang' and set w_s->b_langp accordingly.
|
||||
* Returns NULL if it's OK, an error message otherwise.
|
||||
*/
|
||||
char_u *
|
||||
char *
|
||||
did_set_spelllang(win_T *wp)
|
||||
{
|
||||
garray_T ga;
|
||||
@@ -2330,7 +2330,7 @@ did_set_spelllang(win_T *wp)
|
||||
int i, j;
|
||||
langp_T *lp, *lp2;
|
||||
static int recursive = FALSE;
|
||||
char_u *ret_msg = NULL;
|
||||
char *ret_msg = NULL;
|
||||
char_u *spl_copy;
|
||||
bufref_T bufref;
|
||||
|
||||
@@ -2435,7 +2435,7 @@ did_set_spelllang(win_T *wp)
|
||||
* destroying the buffer we are using... */
|
||||
if (!bufref_valid(&bufref))
|
||||
{
|
||||
ret_msg = (char_u *)N_("E797: SpellFileMissing autocommand deleted buffer");
|
||||
ret_msg = N_("E797: SpellFileMissing autocommand deleted buffer");
|
||||
goto theend;
|
||||
}
|
||||
}
|
||||
@@ -2464,8 +2464,7 @@ did_set_spelllang(win_T *wp)
|
||||
else
|
||||
/* This is probably an error. Give a warning and
|
||||
* accept the words anyway. */
|
||||
smsg((char_u *)
|
||||
_("Warning: region %s not supported"),
|
||||
smsg(_("Warning: region %s not supported"),
|
||||
region);
|
||||
}
|
||||
else
|
||||
@@ -3380,7 +3379,7 @@ spell_suggest(int count)
|
||||
else if (count > 0)
|
||||
{
|
||||
if (count > sug.su_ga.ga_len)
|
||||
smsg((char_u *)_("Sorry, only %ld suggestions"),
|
||||
smsg(_("Sorry, only %ld suggestions"),
|
||||
(long)sug.su_ga.ga_len);
|
||||
}
|
||||
else
|
||||
@@ -3615,7 +3614,7 @@ ex_spellrepall(exarg_T *eap UNUSED)
|
||||
|
||||
if (repl_from == NULL || repl_to == NULL)
|
||||
{
|
||||
EMSG(_("E752: No previous spell replacement"));
|
||||
emsg(_("E752: No previous spell replacement"));
|
||||
return;
|
||||
}
|
||||
addlen = (int)(STRLEN(repl_to) - STRLEN(repl_from));
|
||||
@@ -3665,7 +3664,7 @@ ex_spellrepall(exarg_T *eap UNUSED)
|
||||
vim_free(frompat);
|
||||
|
||||
if (sub_nsubs == 0)
|
||||
EMSG2(_("E753: Not found: %s"), repl_from);
|
||||
semsg(_("E753: Not found: %s"), repl_from);
|
||||
else
|
||||
do_sub_msg(FALSE);
|
||||
}
|
||||
@@ -3905,7 +3904,7 @@ spell_suggest_file(suginfo_T *su, char_u *fname)
|
||||
fd = mch_fopen((char *)fname, "r");
|
||||
if (fd == NULL)
|
||||
{
|
||||
EMSG2(_(e_notopen), fname);
|
||||
semsg(_(e_notopen), fname);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user