aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames McCoy <jamessan@jamessan.com>2021-10-18 09:08:46 -0400
committerJames McCoy <jamessan@jamessan.com>2021-11-01 06:41:28 -0400
commitefa924f66b183d9cf2404ce91c4f009c27e0515a (patch)
treeadc8c74cba88e76c2ae0548cd6e9b01804da9933
parent684640f5518a483cf2bc48efc8f68449379cef69 (diff)
downloadrneovim-efa924f66b183d9cf2404ce91c4f009c27e0515a.tar.gz
rneovim-efa924f66b183d9cf2404ce91c4f009c27e0515a.tar.bz2
rneovim-efa924f66b183d9cf2404ce91c4f009c27e0515a.zip
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 vim/vim#3302) Also make emsg() accept a "char *" argument. Get rid of an enormous number of type casts. https://github.com/vim/vim/commit/f9e3e09fdc93be9f0d47afbc6c7df1188c2a5a0d
-rw-r--r--src/nvim/api/vim.c2
-rw-r--r--src/nvim/autocmd.c26
-rw-r--r--src/nvim/buffer.c64
-rw-r--r--src/nvim/change.c2
-rw-r--r--src/nvim/channel.c6
-rw-r--r--src/nvim/context.c2
-rw-r--r--src/nvim/cursor_shape.c12
-rw-r--r--src/nvim/debugger.c8
-rw-r--r--src/nvim/diff.c28
-rw-r--r--src/nvim/digraph.c14
-rw-r--r--src/nvim/edit.c18
-rw-r--r--src/nvim/eval.c288
-rw-r--r--src/nvim/eval/decode.c82
-rw-r--r--src/nvim/eval/encode.c18
-rw-r--r--src/nvim/eval/executor.c2
-rw-r--r--src/nvim/eval/funcs.c422
-rw-r--r--src/nvim/eval/typval.c66
-rw-r--r--src/nvim/eval/typval.h4
-rw-r--r--src/nvim/eval/userfunc.c68
-rw-r--r--src/nvim/ex_cmds.c110
-rw-r--r--src/nvim/ex_cmds2.c42
-rw-r--r--src/nvim/ex_cmds_defs.h2
-rw-r--r--src/nvim/ex_docmd.c252
-rw-r--r--src/nvim/ex_eval.c68
-rw-r--r--src/nvim/ex_eval.h6
-rw-r--r--src/nvim/ex_getln.c22
-rw-r--r--src/nvim/ex_session.c10
-rw-r--r--src/nvim/file_search.c14
-rw-r--r--src/nvim/fileio.c54
-rw-r--r--src/nvim/fold.c14
-rw-r--r--src/nvim/getchar.c28
-rw-r--r--src/nvim/globals.h284
-rw-r--r--src/nvim/hardcopy.c62
-rw-r--r--src/nvim/hashtab.c4
-rw-r--r--src/nvim/highlight.c2
-rw-r--r--src/nvim/if_cscope.c42
-rw-r--r--src/nvim/keymap.c6
-rw-r--r--src/nvim/lua/converter.c16
-rw-r--r--src/nvim/lua/executor.c8
-rw-r--r--src/nvim/main.c8
-rw-r--r--src/nvim/mark.c16
-rw-r--r--src/nvim/memfile.c10
-rw-r--r--src/nvim/memline.c68
-rw-r--r--src/nvim/memory.c2
-rw-r--r--src/nvim/menu.c40
-rw-r--r--src/nvim/message.c44
-rw-r--r--src/nvim/message.h24
-rw-r--r--src/nvim/misc1.c8
-rw-r--r--src/nvim/normal.c24
-rw-r--r--src/nvim/ops.c24
-rw-r--r--src/nvim/option.c132
-rw-r--r--src/nvim/os/dl.c4
-rw-r--r--src/nvim/os/env.c12
-rw-r--r--src/nvim/os/fileio.c2
-rw-r--r--src/nvim/os/fs.c6
-rw-r--r--src/nvim/os/shell.c6
-rw-r--r--src/nvim/os/users.c2
-rw-r--r--src/nvim/path.c6
-rw-r--r--src/nvim/quickfix.c131
-rw-r--r--src/nvim/regexp.c46
-rw-r--r--src/nvim/regexp_nfa.c40
-rw-r--r--src/nvim/runtime.c4
-rw-r--r--src/nvim/search.c32
-rw-r--r--src/nvim/shada.c134
-rw-r--r--src/nvim/sign.c50
-rw-r--r--src/nvim/spell.c19
-rw-r--r--src/nvim/spellfile.c72
-rw-r--r--src/nvim/strings.c14
-rw-r--r--src/nvim/syntax.c110
-rw-r--r--src/nvim/tag.c46
-rw-r--r--src/nvim/tui/input.c2
-rw-r--r--src/nvim/undo.c58
-rw-r--r--src/nvim/vim.h4
-rw-r--r--src/nvim/viml/parser/expressions.h2
-rw-r--r--src/nvim/window.c64
75 files changed, 1700 insertions, 1744 deletions
diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c
index f51b5536e7..2f1df31858 100644
--- a/src/nvim/api/vim.c
+++ b/src/nvim/api/vim.c
@@ -1724,7 +1724,7 @@ static void write_msg(String message, bool to_err)
#define PUSH_CHAR(i, pos, line_buf, msg) \
if (message.data[i] == NL || pos == LINE_BUFFER_SIZE - 1) { \
line_buf[pos] = NUL; \
- msg((char_u *)line_buf); \
+ msg(line_buf); \
pos = 0; \
continue; \
} \
diff --git a/src/nvim/autocmd.c b/src/nvim/autocmd.c
index d991b88131..b1d22ffc74 100644
--- a/src/nvim/autocmd.c
+++ b/src/nvim/autocmd.c
@@ -313,9 +313,9 @@ static void au_del_group(char_u *name)
{
int i = au_find_group(name);
if (i == AUGROUP_ERROR) { // the group doesn't exist
- EMSG2(_("E367: No such group: \"%s\""), name);
+ semsg(_("E367: No such group: \"%s\""), name);
} else if (i == current_augroup) {
- EMSG(_("E936: Cannot delete the current group"));
+ emsg(_("E936: Cannot delete the current group"));
} else {
event_T event;
AutoPat *ap;
@@ -372,7 +372,7 @@ void do_augroup(char_u *arg, int del_group)
{
if (del_group) {
if (*arg == NUL) {
- EMSG(_(e_argreq));
+ emsg(_(e_argreq));
} else {
au_del_group(arg);
}
@@ -469,7 +469,7 @@ static char_u *find_end_event(char_u *arg, int have_group)
if (*arg == '*') {
if (arg[1] && !ascii_iswhite(arg[1])) {
- EMSG2(_("E215: Illegal character after *: %s"), arg);
+ semsg(_("E215: Illegal character after *: %s"), arg);
return NULL;
}
pat = arg + 1;
@@ -477,9 +477,9 @@ static char_u *find_end_event(char_u *arg, int have_group)
for (pat = arg; *pat && *pat != '|' && !ascii_iswhite(*pat); pat = p) {
if ((int)event_name2nr(pat, &p) >= NUM_EVENTS) {
if (have_group) {
- EMSG2(_("E216: No such event: %s"), pat);
+ semsg(_("E216: No such event: %s"), pat);
} else {
- EMSG2(_("E216: No such group or event: %s"), pat);
+ semsg(_("E216: No such group or event: %s"), pat);
}
return NULL;
}
@@ -651,7 +651,7 @@ void do_autocmd(char_u *arg_in, int forceit)
// Check for "++once" flag.
if (STRNCMP(cmd, "++once", 6) == 0 && ascii_iswhite(cmd[6])) {
if (once) {
- EMSG2(_(e_duparg2), "++once");
+ semsg(_(e_duparg2), "++once");
}
once = true;
cmd = skipwhite(cmd + 6);
@@ -660,7 +660,7 @@ void do_autocmd(char_u *arg_in, int forceit)
// Check for "++nested" flag.
if ((STRNCMP(cmd, "++nested", 8) == 0 && ascii_iswhite(cmd[8]))) {
if (nested) {
- EMSG2(_(e_duparg2), "++nested");
+ semsg(_(e_duparg2), "++nested");
}
nested = true;
cmd = skipwhite(cmd + 8);
@@ -669,7 +669,7 @@ void do_autocmd(char_u *arg_in, int forceit)
// Check for the old (deprecated) "nested" flag.
if (STRNCMP(cmd, "nested", 6) == 0 && ascii_iswhite(cmd[6])) {
if (nested) {
- EMSG2(_(e_duparg2), "nested");
+ semsg(_(e_duparg2), "nested");
}
nested = true;
cmd = skipwhite(cmd + 6);
@@ -699,7 +699,7 @@ void do_autocmd(char_u *arg_in, int forceit)
last_group = AUGROUP_ERROR; // for listing the group name
if (*arg == '*' || *arg == NUL || *arg == '|') {
if (!forceit && *cmd != NUL) {
- EMSG(_(e_cannot_define_autocommands_for_all_events));
+ emsg(_(e_cannot_define_autocommands_for_all_events));
} else {
for (event_T event = (event_T)0; event < NUM_EVENTS;
event = (event_T)(event + 1)) {
@@ -899,7 +899,7 @@ static int do_autocmd_event(event_T event, char_u *pat, bool once, int nested, c
// refuse to add buffer-local ap if buffer number is invalid
if (is_buflocal
&& (buflocal_nr == 0 || buflist_findnr(buflocal_nr) == NULL)) {
- emsgf(_("E680: <buffer=%d>: invalid buffer number "), buflocal_nr);
+ semsg(_("E680: <buffer=%d>: invalid buffer number "), buflocal_nr);
return FAIL;
}
@@ -974,7 +974,7 @@ int do_doautocmd(char_u *arg, bool do_msg, bool *did_something)
group = au_get_grouparg(&arg);
if (*arg == '*') {
- EMSG(_("E217: Can't execute autocommands for ALL events"));
+ emsg(_("E217: Can't execute autocommands for ALL events"));
return FAIL;
}
@@ -1414,7 +1414,7 @@ static bool apply_autocmds_group(event_T event, char_u *fname, char_u *fname_io,
// Allow nesting of autocommands, but restrict the depth, because it's
// possible to create an endless loop.
if (nesting == 10) {
- EMSG(_("E218: autocommand nesting too deep"));
+ emsg(_("E218: autocommand nesting too deep"));
goto BYPASS_AU;
}
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c
index 62d41051e0..db436c0afc 100644
--- a/src/nvim/buffer.c
+++ b/src/nvim/buffer.c
@@ -186,7 +186,7 @@ int open_buffer(int read_stdin, exarg_T *eap, int flags)
// If there is no memfile at all, exit.
// This is OK, since there are no changes to lose.
if (curbuf == NULL) {
- EMSG(_("E82: Cannot allocate any buffer, exiting..."));
+ emsg(_("E82: Cannot allocate any buffer, exiting..."));
// Don't try to do any saving, with "curbuf" NULL almost nothing
// will work.
@@ -194,7 +194,7 @@ int open_buffer(int read_stdin, exarg_T *eap, int flags)
getout(2);
}
- EMSG(_("E83: Cannot allocate buffer, using other one..."));
+ emsg(_("E83: Cannot allocate buffer, using other one..."));
enter_buffer(curbuf);
if (old_tw != curbuf->b_p_tw) {
check_colorcolumn(curwin);
@@ -439,7 +439,7 @@ bool close_buffer(win_T *win, buf_T *buf, int action, bool abort_if_last)
// Disallow deleting the buffer when it is locked (already being closed or
// halfway a command that relies on it). Unloading is allowed.
if (buf->b_locked > 0 && (del_buf || wipe_buf)) {
- EMSG(_("E937: Attempt to delete a buffer that is in use"));
+ emsg(_("E937: Attempt to delete a buffer that is in use"));
return false;
}
@@ -466,13 +466,13 @@ bool close_buffer(win_T *win, buf_T *buf, int action, bool abort_if_last)
if (apply_autocmds(EVENT_BUFWINLEAVE, buf->b_fname, buf->b_fname, false,
buf) && !bufref_valid(&bufref)) {
// Autocommands deleted the buffer.
- EMSG(_(e_auabort));
+ emsg(_(e_auabort));
return false;
}
buf->b_locked--;
if (abort_if_last && last_nonfloat(win)) {
// Autocommands made this the only window.
- EMSG(_(e_auabort));
+ emsg(_(e_auabort));
return false;
}
@@ -483,13 +483,13 @@ bool close_buffer(win_T *win, buf_T *buf, int action, bool abort_if_last)
if (apply_autocmds(EVENT_BUFHIDDEN, buf->b_fname, buf->b_fname, false,
buf) && !bufref_valid(&bufref)) {
// Autocommands deleted the buffer.
- EMSG(_(e_auabort));
+ emsg(_(e_auabort));
return false;
}
buf->b_locked--;
if (abort_if_last && last_nonfloat(win)) {
// Autocommands made this the only window.
- EMSG(_(e_auabort));
+ emsg(_(e_auabort));
return false;
}
}
@@ -944,11 +944,11 @@ void handle_swap_exists(bufref_T *old_curbuf)
/// @param end_bnr buffer nr or last buffer nr in a range
///
/// @return error message or NULL
-char_u *do_bufdel(int command, char_u *arg, int addr_count, int start_bnr, int end_bnr, int forceit)
+char *do_bufdel(int command, char_u *arg, int addr_count, int start_bnr, int end_bnr, int forceit)
{
int do_current = 0; // delete current buffer?
int deleted = 0; // number of buffers deleted
- char_u *errormsg = NULL; // return value
+ char *errormsg = NULL; // return value
int bnr; // buffer number
char_u *p;
@@ -957,7 +957,7 @@ char_u *do_bufdel(int command, char_u *arg, int addr_count, int start_bnr, int e
} else {
if (addr_count == 2) {
if (*arg) { // both range and argument is not allowed
- return (char_u *)_(e_trailing);
+ return _(e_trailing);
}
bnr = start_bnr;
} else { // addr_count == 1
@@ -1013,7 +1013,7 @@ char_u *do_bufdel(int command, char_u *arg, int addr_count, int start_bnr, int e
} else {
STRCPY(IObuff, _("E517: No buffers were wiped out"));
}
- errormsg = IObuff;
+ errormsg = (char *)IObuff;
} else if (deleted >= p_report) {
if (command == DOBUF_UNLOAD) {
smsg(NGETTEXT("%d buffer unloaded", "%d buffers unloaded", (unsigned long)deleted),
@@ -1043,7 +1043,7 @@ static int empty_curbuf(int close_others, int forceit, int action)
buf_T *buf = curbuf;
if (action == DOBUF_UNLOAD) {
- EMSG(_("E90: Cannot unload last buffer"));
+ emsg(_("E90: Cannot unload last buffer"));
return FAIL;
}
@@ -1116,7 +1116,7 @@ int do_buffer(int action, int start, int dir, int count, int forceit)
} while (buf != curbuf && !bufIsChanged(buf));
}
if (!bufIsChanged(buf)) {
- EMSG(_("E84: No modified buffer found"));
+ emsg(_("E84: No modified buffer found"));
return FAIL;
}
} else if (start == DOBUF_FIRST && count) { // find specified buffer number
@@ -1149,7 +1149,7 @@ int do_buffer(int action, int start, int dir, int count, int forceit)
}
if (bp == buf) {
// back where we started, didn't find anything.
- EMSG(_("E85: There is no listed buffer"));
+ emsg(_("E85: There is no listed buffer"));
return FAIL;
}
}
@@ -1159,12 +1159,12 @@ int do_buffer(int action, int start, int dir, int count, int forceit)
if (start == DOBUF_FIRST) {
// don't warn when deleting
if (!unload) {
- EMSGN(_(e_nobufnr), count);
+ semsg(_(e_nobufnr), (int64_t)count);
}
} else if (dir == FORWARD) {
- EMSG(_("E87: Cannot go beyond last buffer"));
+ emsg(_("E87: Cannot go beyond last buffer"));
} else {
- EMSG(_("E88: Cannot go before first buffer"));
+ emsg(_("E88: Cannot go before first buffer"));
}
return FAIL;
}
@@ -1195,9 +1195,9 @@ int do_buffer(int action, int start, int dir, int count, int forceit)
return FAIL;
}
} else {
- EMSGN(_("E89: No write since last change for buffer %" PRId64
+ semsg(_("E89: No write since last change for buffer %" PRId64
" (add ! to override)"),
- buf->b_fnum);
+ (int64_t)buf->b_fnum);
return FAIL;
}
}
@@ -1208,7 +1208,7 @@ int do_buffer(int action, int start, int dir, int count, int forceit)
return FAIL;
}
} else {
- EMSG2(_("E89: %s will be killed (add ! to override)"),
+ semsg(_("E89: %s will be killed (add ! to override)"),
(char *)buf->b_fname);
return FAIL;
}
@@ -1597,9 +1597,9 @@ void no_write_message(void)
{
if (curbuf->terminal
&& channel_job_running((uint64_t)curbuf->b_p_channel)) {
- EMSG(_("E948: Job still running (add ! to end the job)"));
+ emsg(_("E948: Job still running (add ! to end the job)"));
} else {
- EMSG(_("E37: No write since last change (add ! to override)"));
+ emsg(_("E37: No write since last change (add ! to override)"));
}
}
@@ -1608,9 +1608,9 @@ void no_write_message_nobang(const buf_T *const buf)
{
if (buf->terminal
&& channel_job_running((uint64_t)buf->b_p_channel)) {
- EMSG(_("E948: Job still running"));
+ emsg(_("E948: Job still running"));
} else {
- EMSG(_("E37: No write since last change"));
+ emsg(_("E37: No write since last change"));
}
}
@@ -1793,7 +1793,7 @@ buf_T *buflist_new(char_u *ffname_arg, char_u *sfname_arg, linenr_T lnum, int fl
buf->b_fnum = top_file_num++;
pmap_put(handle_T)(&buffer_handles, buf->b_fnum, buf);
if (top_file_num < 0) { // wrap around (may cause duplicates)
- EMSG(_("W14: Warning: List of file names overflow"));
+ emsg(_("W14: Warning: List of file names overflow"));
if (emsg_silent == 0) {
ui_flush();
os_delay(3001L, true); // make sure it is noticed
@@ -1962,9 +1962,9 @@ int buflist_getfile(int n, linenr_T lnum, int options, int forceit)
buf = buflist_findnr(n);
if (buf == NULL) {
if ((options & GETF_ALT) && n == 0) {
- EMSG(_(e_noalt));
+ emsg(_(e_noalt));
} else {
- EMSGN(_("E92: Buffer %" PRId64 " not found"), n);
+ semsg(_("E92: Buffer %" PRId64 " not found"), (int64_t)n);
}
return FAIL;
}
@@ -2224,9 +2224,9 @@ int buflist_findpat(const char_u *pattern, const char_u *pattern_end, bool unlis
}
if (match == -2) {
- EMSG2(_("E93: More than one match for %s"), pattern);
+ semsg(_("E93: More than one match for %s"), pattern);
} else if (match < 0) {
- EMSG2(_("E94: No matching buffer for %s"), pattern);
+ semsg(_("E94: No matching buffer for %s"), pattern);
}
return match;
}
@@ -2795,7 +2795,7 @@ int setfname(buf_T *buf, char_u *ffname_arg, char_u *sfname_arg, bool message)
if (obuf != NULL && obuf != buf) {
if (obuf->b_ml.ml_mfp != NULL) { // it's loaded, fail
if (message) {
- EMSG(_("E95: Buffer with this name already exists"));
+ emsg(_("E95: Buffer with this name already exists"));
}
xfree(ffname);
return FAIL;
@@ -2900,7 +2900,7 @@ char_u *getaltfname(bool errmsg)
if (buflist_name_nr(0, &fname, &dummy) == FAIL) {
if (errmsg) {
- EMSG(_(e_noalt));
+ emsg(_(e_noalt));
}
return NULL;
}
@@ -5386,7 +5386,7 @@ bool bt_dontwrite_msg(const buf_T *const buf)
FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
{
if (bt_dontwrite(buf)) {
- EMSG(_("E382: Cannot write, 'buftype' option is set"));
+ emsg(_("E382: Cannot write, 'buftype' option is set"));
return true;
}
return false;
diff --git a/src/nvim/change.c b/src/nvim/change.c
index 2450c56838..21a4798bfe 100644
--- a/src/nvim/change.c
+++ b/src/nvim/change.c
@@ -759,7 +759,7 @@ int del_bytes(colnr_T count, bool fixpos_arg, bool use_delcombine)
}
// If "count" is negative the caller must be doing something wrong.
if (count < 1) {
- IEMSGN("E292: Invalid count for del_bytes(): %ld", count);
+ siemsg("E292: Invalid count for del_bytes(): %ld", (int64_t)count);
return FAIL;
}
diff --git a/src/nvim/channel.c b/src/nvim/channel.c
index cfeaafe77a..0eae87c1f8 100644
--- a/src/nvim/channel.c
+++ b/src/nvim/channel.c
@@ -319,7 +319,7 @@ Channel *channel_job_start(char **argv, CallbackReader on_stdout, CallbackReader
if (pty) {
if (detach) {
- EMSG2(_(e_invarg2), "terminal/pty job cannot be detached");
+ semsg(_(e_invarg2), "terminal/pty job cannot be detached");
shell_free_argv(argv);
if (env) {
tv_dict_free(env);
@@ -369,7 +369,7 @@ Channel *channel_job_start(char **argv, CallbackReader on_stdout, CallbackReader
int status = process_spawn(proc, has_in, has_out, has_err);
if (status) {
- EMSG3(_(e_jobspawn), os_strerror(status), cmd);
+ semsg(_(e_jobspawn), os_strerror(status), cmd);
xfree(cmd);
if (proc->env) {
tv_dict_free(proc->env);
@@ -672,7 +672,7 @@ void channel_reader_callbacks(Channel *chan, CallbackReader *reader)
tv_dict_add_list(reader->self, reader->type, strlen(reader->type),
data);
} else {
- EMSG3(_(e_streamkey), reader->type, chan->id);
+ semsg(_(e_streamkey), reader->type, chan->id);
}
} else {
channel_callback_call(chan, reader);
diff --git a/src/nvim/context.c b/src/nvim/context.c
index 4a8e645d2c..614a3ce30e 100644
--- a/src/nvim/context.c
+++ b/src/nvim/context.c
@@ -316,7 +316,7 @@ static inline msgpack_sbuffer array_to_sbuf(Array array)
object_to_vim(ARRAY_OBJ(array), &list_tv, &err);
if (!encode_vim_list_to_buf(list_tv.vval.v_list, &sbuf.size, &sbuf.data)) {
- EMSG(_("E474: Failed to convert list to msgpack string buffer"));
+ emsg(_("E474: Failed to convert list to msgpack string buffer"));
}
sbuf.alloc = sbuf.size;
diff --git a/src/nvim/cursor_shape.c b/src/nvim/cursor_shape.c
index 18cade1052..644bb2c324 100644
--- a/src/nvim/cursor_shape.c
+++ b/src/nvim/cursor_shape.c
@@ -93,7 +93,7 @@ Array mode_style_array(void)
/// @param what SHAPE_CURSOR or SHAPE_MOUSE ('mouseshape')
///
/// @returns error message for an illegal option, NULL otherwise.
-char_u *parse_shape_opt(int what)
+char *parse_shape_opt(int what)
{
char_u *modep;
char_u *colonp;
@@ -126,10 +126,10 @@ char_u *parse_shape_opt(int what)
commap = vim_strchr(modep, ',');
if (colonp == NULL || (commap != NULL && commap < colonp)) {
- return (char_u *)N_("E545: Missing colon");
+ return N_("E545: Missing colon");
}
if (colonp == modep) {
- return (char_u *)N_("E546: Illegal mode");
+ return N_("E546: Illegal mode");
}
// Repeat for all modes before the colon.
@@ -154,7 +154,7 @@ char_u *parse_shape_opt(int what)
}
if (idx == SHAPE_IDX_COUNT
|| (shape_table[idx].used_for & what) == 0) {
- return (char_u *)N_("E546: Illegal mode");
+ return N_("E546: Illegal mode");
}
if (len == 2 && modep[0] == 'v' && modep[1] == 'e') {
found_ve = true;
@@ -189,12 +189,12 @@ char_u *parse_shape_opt(int what)
if (len != 0) {
p += len;
if (!ascii_isdigit(*p)) {
- return (char_u *)N_("E548: digit expected");
+ return N_("E548: digit expected");
}
int n = getdigits_int(&p, false, 0);
if (len == 3) { // "ver" or "hor"
if (n == 0) {
- return (char_u *)N_("E549: Illegal percentage");
+ return N_("E549: Illegal percentage");
}
if (round == 2) {
if (TOLOWER_ASC(i) == 'v') {
diff --git a/src/nvim/debugger.c b/src/nvim/debugger.c
index aeaf2555b1..9657e903d1 100644
--- a/src/nvim/debugger.c
+++ b/src/nvim/debugger.c
@@ -496,7 +496,7 @@ static int dbg_parsearg(char_u *arg, garray_T *gap)
bp->dbg_type = DBG_FILE;
} else if (gap != &prof_ga && STRNCMP(p, "here", 4) == 0) {
if (curbuf->b_ffname == NULL) {
- EMSG(_(e_noname));
+ emsg(_(e_noname));
return FAIL;
}
bp->dbg_type = DBG_FILE;
@@ -504,7 +504,7 @@ static int dbg_parsearg(char_u *arg, garray_T *gap)
} else if (gap != &prof_ga && STRNCMP(p, "expr", 4) == 0) {
bp->dbg_type = DBG_EXPR;
} else {
- EMSG2(_(e_invarg2), p);
+ semsg(_(e_invarg2), p);
return FAIL;
}
p = skipwhite(p + 4);
@@ -523,7 +523,7 @@ static int dbg_parsearg(char_u *arg, garray_T *gap)
if ((!here && *p == NUL)
|| (here && *p != NUL)
|| (bp->dbg_type == DBG_FUNC && strstr((char *)p, "()") != NULL)) {
- EMSG2(_(e_invarg2), arg);
+ semsg(_(e_invarg2), arg);
return FAIL;
}
@@ -661,7 +661,7 @@ void ex_breakdel(exarg_T *eap)
}
if (todel < 0) {
- EMSG2(_("E161: Breakpoint not found: %s"), eap->arg);
+ semsg(_("E161: Breakpoint not found: %s"), eap->arg);
} else {
while (!GA_EMPTY(gap)) {
xfree(DEBUGGY(gap, todel).dbg_name);
diff --git a/src/nvim/diff.c b/src/nvim/diff.c
index 6e54c0bf0e..1cc9399465 100644
--- a/src/nvim/diff.c
+++ b/src/nvim/diff.c
@@ -168,7 +168,7 @@ void diff_buf_add(buf_T *buf)
}
}
- EMSGN(_("E96: Cannot diff more than %" PRId64 " buffers"), DB_COUNT);
+ semsg(_("E96: Cannot diff more than %" PRId64 " buffers"), (int64_t)DB_COUNT);
}
///
@@ -1039,9 +1039,9 @@ static int check_external_diff(diffio_T *diffio)
if (!ok) {
if (io_error) {
- EMSG(_("E810: Cannot read or write temp files"));
+ emsg(_("E810: Cannot read or write temp files"));
}
- EMSG(_("E97: Cannot create diffs"));
+ emsg(_("E97: Cannot create diffs"));
diff_a_works = kNone;
return FAIL;
}
@@ -1082,7 +1082,7 @@ static int diff_file_internal(diffio_T *diffio)
if (xdl_diff(&diffio->dio_orig.din_mmfile,
&diffio->dio_new.din_mmfile,
&param, &emit_cfg, &emit_cb) < 0) {
- EMSG(_("E960: Problem creating the internal diff"));
+ emsg(_("E960: Problem creating the internal diff"));
return FAIL;
}
return OK;
@@ -1225,7 +1225,7 @@ void ex_diffpatch(exarg_T *eap)
#ifdef UNIX
if (dirbuf[0] != NUL) {
if (os_chdir((char *)dirbuf) != 0) {
- EMSG(_(e_prev_dir));
+ emsg(_(e_prev_dir));
}
shorten_fnames(true);
}
@@ -1244,7 +1244,7 @@ void ex_diffpatch(exarg_T *eap)
bool info_ok = os_fileinfo((char *)tmp_new, &file_info);
uint64_t filesize = os_fileinfo_size(&file_info);
if (!info_ok || filesize == 0) {
- EMSG(_("E816: Cannot read patch output"));
+ emsg(_("E816: Cannot read patch output"));
} else {
if (curbuf->b_fname != NULL) {
newname = vim_strnsave(curbuf->b_fname, STRLEN(curbuf->b_fname) + 4);
@@ -1544,7 +1544,7 @@ static void diff_read(int idx_orig, int idx_new, diffout_T *dout)
} else {
fd = os_fopen((char *)dout->dout_fname, "r");
if (fd == NULL) {
- EMSG(_("E98: Cannot read diff output"));
+ emsg(_("E98: Cannot read diff output"));
return;
}
}
@@ -2497,7 +2497,7 @@ void ex_diffgetput(exarg_T *eap)
// Find the current buffer in the list of diff buffers.
int idx_cur = diff_buf_idx(curbuf);
if (idx_cur == DB_COUNT) {
- EMSG(_("E99: Current buffer is not in diff mode"));
+ emsg(_("E99: Current buffer is not in diff mode"));
return;
}
@@ -2516,9 +2516,9 @@ void ex_diffgetput(exarg_T *eap)
if (idx_other == DB_COUNT) {
if (found_not_ma) {
- EMSG(_("E793: No other buffer in diff mode is modifiable"));
+ emsg(_("E793: No other buffer in diff mode is modifiable"));
} else {
- EMSG(_("E100: No other buffer in diff mode"));
+ emsg(_("E100: No other buffer in diff mode"));
}
return;
}
@@ -2529,7 +2529,7 @@ void ex_diffgetput(exarg_T *eap)
&& (curtab->tp_diffbuf[i] != NULL)
&& ((eap->cmdidx != CMD_diffput)
|| MODIFIABLE(curtab->tp_diffbuf[i]))) {
- EMSG(_("E101: More than two buffers in diff mode, don't know "
+ emsg(_("E101: More than two buffers in diff mode, don't know "
"which one to use"));
return;
}
@@ -2558,7 +2558,7 @@ void ex_diffgetput(exarg_T *eap)
buf = buflist_findnr(i);
if (buf == NULL) {
- EMSG2(_("E102: Can't find buffer \"%s\""), eap->arg);
+ semsg(_("E102: Can't find buffer \"%s\""), eap->arg);
return;
}
@@ -2569,7 +2569,7 @@ void ex_diffgetput(exarg_T *eap)
idx_other = diff_buf_idx(buf);
if (idx_other == DB_COUNT) {
- EMSG2(_("E103: Buffer \"%s\" is not in diff mode"), eap->arg);
+ semsg(_("E103: Buffer \"%s\" is not in diff mode"), eap->arg);
return;
}
}
@@ -2610,7 +2610,7 @@ void ex_diffgetput(exarg_T *eap)
if (!curbuf->b_changed) {
change_warning(curbuf, 0);
if (diff_buf_idx(curbuf) != idx_to) {
- EMSG(_("E787: Buffer changed unexpectedly"));
+ emsg(_("E787: Buffer changed unexpectedly"));
goto theend;
}
}
diff --git a/src/nvim/digraph.c b/src/nvim/digraph.c
index 0fa6ebcd94..d1dd9b8309 100644
--- a/src/nvim/digraph.c
+++ b/src/nvim/digraph.c
@@ -1628,18 +1628,18 @@ void putdigraph(char_u *str)
char2 = *str++;
if (char2 == 0) {
- EMSG(_(e_invarg));
+ emsg(_(e_invarg));
return;
}
if ((char1 == ESC) || (char2 == ESC)) {
- EMSG(_("E104: Escape not allowed in digraph"));
+ emsg(_("E104: Escape not allowed in digraph"));
return;
}
str = skipwhite(str);
if (!ascii_isdigit(*str)) {
- EMSG(_(e_number_exp));
+ emsg(_(e_number_exp));
return;
}
int n = getdigits_int(&str, true, 0);
@@ -1821,7 +1821,7 @@ typedef struct {
/// @return NULL if OK, an error message for failure. This only needs to be
/// used when setting the option, not later when the value has already
/// been checked.
-char_u *keymap_init(void)
+char *keymap_init(void)
{
curbuf->b_kmap_state &= ~KEYMAP_INIT;
@@ -1850,7 +1850,7 @@ char_u *keymap_init(void)
if (source_runtime(buf, 0) == FAIL) {
xfree(buf);
- return (char_u *)N_("E544: Keymap file not found");
+ return N_("E544: Keymap file not found");
}
}
xfree(buf);
@@ -1873,7 +1873,7 @@ void ex_loadkeymap(exarg_T *eap)
char_u *save_cpo = p_cpo;
if (!getline_equal(eap->getline, eap->cookie, getsourceline)) {
- EMSG(_("E105: Using :loadkeymap not in a sourced file"));
+ emsg(_("E105: Using :loadkeymap not in a sourced file"));
return;
}
@@ -1908,7 +1908,7 @@ void ex_loadkeymap(exarg_T *eap)
|| (*kp->from == NUL)
|| (*kp->to == NUL)) {
if (*kp->to == NUL) {
- EMSG(_("E791: Empty keymap entry"));
+ emsg(_("E791: Empty keymap entry"));
}
xfree(kp->from);
xfree(kp->to);
diff --git a/src/nvim/edit.c b/src/nvim/edit.c
index e2884c242b..60f2d0b2ec 100644
--- a/src/nvim/edit.c
+++ b/src/nvim/edit.c
@@ -1398,20 +1398,20 @@ bool edit(int cmdchar, bool startln, long count)
// Don't allow inserting in the sandbox.
if (sandbox != 0) {
- EMSG(_(e_sandbox));
+ emsg(_(e_sandbox));
return false;
}
// Don't allow changes in the buffer while editing the cmdline. The
// caller of getcmdline() may get confused.
if (textlock != 0) {
- EMSG(_(e_secure));
+ emsg(_(e_secure));
return false;
}
// Don't allow recursive insert mode when busy with completion.
if (compl_started || compl_busy || pum_visible()) {
- EMSG(_(e_secure));
+ emsg(_(e_secure));
return false;
}
@@ -3974,13 +3974,13 @@ static void expand_by_function(int type, char_u *base)
}
if (curwin_save != curwin || curbuf_save != curbuf) {
- EMSG(_(e_complwin));
+ emsg(_(e_complwin));
goto theend;
}
curwin->w_cursor = pos; // restore the cursor position
validate_cursor();
if (!equalpos(curwin->w_cursor, pos)) {
- EMSG(_(e_compldel));
+ emsg(_(e_compldel));
goto theend;
}
@@ -5220,7 +5220,7 @@ static int ins_complete(int c, bool enable_pum)
funcname = ctrl_x_mode == CTRL_X_FUNCTION
? curbuf->b_p_cfu : curbuf->b_p_ofu;
if (*funcname == NUL) {
- EMSG2(_(e_notset), ctrl_x_mode == CTRL_X_FUNCTION
+ semsg(_(e_notset), ctrl_x_mode == CTRL_X_FUNCTION
? "completefunc" : "omnifunc");
// restore did_ai, so that adding comment leader works
did_ai = save_did_ai;
@@ -5241,13 +5241,13 @@ static int ins_complete(int c, bool enable_pum)
State = save_State;
if (curwin_save != curwin || curbuf_save != curbuf) {
- EMSG(_(e_complwin));
+ emsg(_(e_complwin));
return FAIL;
}
curwin->w_cursor = pos; // restore the cursor position
validate_cursor();
if (!equalpos(curwin->w_cursor, pos)) {
- EMSG(_(e_compldel));
+ emsg(_(e_compldel));
return FAIL;
}
@@ -7017,7 +7017,7 @@ int stuff_inserted(int c, long count, int no_esc)
ptr = get_last_insert();
if (ptr == NULL) {
- EMSG(_(e_noinstext));
+ emsg(_(e_noinstext));
return FAIL;
}
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index 19aaced7c6..9570ec0649 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -501,7 +501,7 @@ int var_redir_start(char_u *name, int append)
// Catch a bad name early.
if (!eval_isnamec1(*name)) {
- EMSG(_(e_invarg));
+ emsg(_(e_invarg));
return FAIL;
}
@@ -521,9 +521,9 @@ int var_redir_start(char_u *name, int append)
clear_lval(redir_lval);
if (redir_endp != NULL && *redir_endp != NUL) {
// Trailing characters are present after the variable name
- EMSG(_(e_trailing));
+ emsg(_(e_trailing));
} else {
- EMSG(_(e_invarg));
+ emsg(_(e_invarg));
}
redir_endp = NULL; // don't store a value, only cleanup
var_redir_stop();
@@ -728,7 +728,7 @@ static int eval1_emsg(char_u **arg, typval_T *rettv, bool evaluate)
if (!aborting()
&& did_emsg == did_emsg_before
&& called_emsg == called_emsg_before) {
- emsgf(_(e_invexpr2), start);
+ semsg(_(e_invexpr2), start);
}
}
return ret;
@@ -771,7 +771,7 @@ int eval_expr_typval(const typval_T *expr, typval_T *argv, int argc, typval_T *r
}
if (*skipwhite(s) != NUL) { // check for trailing chars after expr
tv_clear(rettv);
- emsgf(_(e_invexpr2), s);
+ semsg(_(e_invexpr2), s);
return FAIL;
}
}
@@ -1029,7 +1029,7 @@ list_T *eval_spell_expr(char_u *badword, char_u *expr)
int get_spellword(list_T *const list, const char **ret_word)
{
if (tv_list_len(list) != 2) {
- EMSG(_("E5700: Expression from 'spellsuggest' must yield lists with "
+ emsg(_("E5700: Expression from 'spellsuggest' must yield lists with "
"exactly two values"));
return -1;
}
@@ -1256,7 +1256,7 @@ static list_T *heredoc_get(exarg_T *eap, char_u *cmd)
char_u *text_indent = NULL;
if (eap->getline == NULL) {
- EMSG(_("E991: cannot use =<< here"));
+ emsg(_("E991: cannot use =<< here"));
return NULL;
}
@@ -1283,16 +1283,16 @@ static list_T *heredoc_get(exarg_T *eap, char_u *cmd)
marker = skipwhite(cmd);
p = skiptowhite(marker);
if (*skipwhite(p) != NUL && *skipwhite(p) != '"') {
- EMSG(_(e_trailing));
+ emsg(_(e_trailing));
return NULL;
}
*p = NUL;
if (islower(*marker)) {
- EMSG(_("E221: Marker cannot start with lower case letter"));
+ emsg(_("E221: Marker cannot start with lower case letter"));
return NULL;
}
} else {
- EMSG(_("E172: Missing marker"));
+ emsg(_("E172: Missing marker"));
return NULL;
}
@@ -1303,7 +1303,7 @@ static list_T *heredoc_get(exarg_T *eap, char_u *cmd)
char_u *theline = eap->getline(NUL, eap->cookie, 0, false);
if (theline == NULL) {
- EMSG2(_("E990: Missing end marker '%s'"), marker);
+ semsg(_("E990: Missing end marker '%s'"), marker);
break;
}
@@ -1385,7 +1385,7 @@ static void ex_let_const(exarg_T *eap, const bool is_const)
&& expr[1] == '=') || STRNCMP(expr, "..=", 3) == 0)) {
// ":let" without "=": list variables
if (*arg == '[') {
- EMSG(_(e_invarg));
+ emsg(_(e_invarg));
} else if (!ends_excmd(*arg)) {
// ":let var1 var2"
arg = (char_u *)list_arg_vars(eap, (const char *)arg, &first);
@@ -1475,18 +1475,18 @@ static int ex_let_vars(char_u *arg_start, typval_T *tv, int copy, int semicolon,
// ":let [v1, v2] = list" or ":for [v1, v2] in listlist"
if (tv->v_type != VAR_LIST) {
- EMSG(_(e_listreq));
+ emsg(_(e_listreq));
return FAIL;
}
list_T *const l = tv->vval.v_list;
const int len = tv_list_len(l);
if (semicolon == 0 && var_count < len) {
- EMSG(_("E687: Less targets than List items"));
+ emsg(_("E687: Less targets than List items"));
return FAIL;
}
if (var_count - semicolon > len) {
- EMSG(_("E688: More targets than List items"));
+ emsg(_("E688: More targets than List items"));
return FAIL;
}
// List l may actually be NULL, but it should fail with E688 or even earlier
@@ -1555,7 +1555,7 @@ static const char_u *skip_var_list(const char_u *arg, int *var_count, int *semic
p = skipwhite(p + 1); // skip whites after '[', ';' or ','
s = skip_var_one(p);
if (s == p) {
- EMSG2(_(e_invarg2), p);
+ semsg(_(e_invarg2), p);
return NULL;
}
++*var_count;
@@ -1565,12 +1565,12 @@ static const char_u *skip_var_list(const char_u *arg, int *var_count, int *semic
break;
} else if (*p == ';') {
if (*semicolon == 1) {
- EMSG(_("E452: Double ; in list of variables"));
+ emsg(_("E452: Double ; in list of variables"));
return NULL;
}
*semicolon = 1;
} else if (*p != ',') {
- EMSG2(_(e_invarg2), p);
+ semsg(_(e_invarg2), p);
return NULL;
}
}
@@ -1690,7 +1690,7 @@ static const char *list_arg_vars(exarg_T *eap, const char *arg, int *first)
FNE_INCL_BR | FNE_CHECK_START);
if (!ascii_iswhite(*arg) && !ends_excmd(*arg)) {
emsg_severe = true;
- EMSG(_(e_trailing));
+ emsg(_(e_trailing));
break;
}
} else {
@@ -1703,7 +1703,7 @@ static const char *list_arg_vars(exarg_T *eap, const char *arg, int *first)
* curly braces fails overrule the exception error message. */
if (len < 0 && !aborting()) {
emsg_severe = true;
- EMSG2(_(e_invarg2), arg);
+ semsg(_(e_invarg2), arg);
break;
}
error = TRUE;
@@ -1739,7 +1739,7 @@ static const char *list_arg_vars(exarg_T *eap, const char *arg, int *first)
case 'l':
list_func_vars(first); break;
default:
- EMSG2(_("E738: Can't list variables for %s"), name);
+ semsg(_("E738: Can't list variables for %s"), name);
}
} else {
char *const s = encode_tv2echo(&tv, NULL);
@@ -1794,7 +1794,7 @@ static char_u *ex_let_one(char_u *arg, typval_T *const tv, const bool copy, cons
*/
if (*arg == '$') {
if (is_const) {
- EMSG(_("E996: Cannot lock an environment variable"));
+ emsg(_("E996: Cannot lock an environment variable"));
return NULL;
}
// Find the end of the name.
@@ -1802,13 +1802,13 @@ static char_u *ex_let_one(char_u *arg, typval_T *const tv, const bool copy, cons
char *name = (char *)arg;
len = get_env_len((const char_u **)&arg);
if (len == 0) {
- EMSG2(_(e_invarg2), name - 1);
+ semsg(_(e_invarg2), name - 1);
} else {
if (op != NULL && vim_strchr((char_u *)"+-*/%", *op) != NULL) {
- EMSG2(_(e_letwrong), op);
+ semsg(_(e_letwrong), op);
} else if (endchars != NULL
&& vim_strchr(endchars, *skipwhite(arg)) == NULL) {
- EMSG(_(e_letunexp));
+ emsg(_(e_letunexp));
} else if (!check_secure()) {
const char c1 = name[len];
name[len] = NUL;
@@ -1843,7 +1843,7 @@ static char_u *ex_let_one(char_u *arg, typval_T *const tv, const bool copy, cons
// ":let &g:option = expr": Set global option value.
} else if (*arg == '&') {
if (is_const) {
- EMSG(_("E996: Cannot lock an option"));
+ emsg(_("E996: Cannot lock an option"));
return NULL;
}
// Find the end of the name.
@@ -1851,7 +1851,7 @@ static char_u *ex_let_one(char_u *arg, typval_T *const tv, const bool copy, cons
if (p == NULL
|| (endchars != NULL
&& vim_strchr(endchars, *skipwhite((const char_u *)p)) == NULL)) {
- EMSG(_(e_letunexp));
+ emsg(_(e_letunexp));
} else {
int opt_type;
long numval;
@@ -1870,7 +1870,7 @@ static char_u *ex_let_one(char_u *arg, typval_T *const tv, const bool copy, cons
opt_flags);
if ((opt_type == 1 && *op == '.')
|| (opt_type == 0 && *op != '.')) {
- EMSG2(_(e_letwrong), op);
+ semsg(_(e_letwrong), op);
s = NULL; // don't set the value
} else {
if (opt_type == 1) { // number
@@ -1906,15 +1906,15 @@ static char_u *ex_let_one(char_u *arg, typval_T *const tv, const bool copy, cons
// ":let @r = expr": Set register contents.
} else if (*arg == '@') {
if (is_const) {
- EMSG(_("E996: Cannot lock a register"));
+ emsg(_("E996: Cannot lock a register"));
return NULL;
}
arg++;
if (op != NULL && vim_strchr((char_u *)"+-*/%", *op) != NULL) {
- emsgf(_(e_letwrong), op);
+ semsg(_(e_letwrong), op);
} else if (endchars != NULL
&& vim_strchr(endchars, *skipwhite(arg + 1)) == NULL) {
- EMSG(_(e_letunexp));
+ emsg(_(e_letunexp));
} else {
char_u *s;
@@ -1946,7 +1946,7 @@ static char_u *ex_let_one(char_u *arg, typval_T *const tv, const bool copy, cons
char_u *const p = get_lval(arg, tv, &lv, false, false, 0, FNE_CHECK_START);
if (p != NULL && lv.ll_name != NULL) {
if (endchars != NULL && vim_strchr(endchars, *skipwhite(p)) == NULL) {
- EMSG(_(e_letunexp));
+ emsg(_(e_letunexp));
} else {
set_var_lval(&lv, p, tv, copy, is_const, (const char *)op);
arg_end = p;
@@ -1954,7 +1954,7 @@ static char_u *ex_let_one(char_u *arg, typval_T *const tv, const bool copy, cons
}
clear_lval(&lv);
} else {
- EMSG2(_(e_invarg2), arg);
+ semsg(_(e_invarg2), arg);
}
return arg_end;
@@ -2018,7 +2018,7 @@ char_u *get_lval(char_u *const name, typval_T *const rettv, lval_T *const lp, co
// Don't expand the name when we already know there is an error.
if (unlet && !ascii_iswhite(*p) && !ends_excmd(*p)
&& *p != '[' && *p != '.') {
- EMSG(_(e_trailing));
+ emsg(_(e_trailing));
return NULL;
}
@@ -2031,7 +2031,7 @@ char_u *get_lval(char_u *const name, typval_T *const rettv, lval_T *const lp, co
// aborting error, an interrupt, or an exception.
if (!aborting() && !quiet) {
emsg_severe = true;
- EMSG2(_(e_invarg2), name);
+ semsg(_(e_invarg2), name);
return NULL;
}
lp->ll_name_len = 0;
@@ -2054,7 +2054,7 @@ char_u *get_lval(char_u *const name, typval_T *const rettv, lval_T *const lp, co
(flags & GLV_READ_ONLY) ? NULL : &ht,
flags & GLV_NO_AUTOLOAD);
if (v == NULL && !quiet) {
- emsgf(_("E121: Undefined variable: %.*s"),
+ semsg(_("E121: Undefined variable: %.*s"),
(int)lp->ll_name_len, lp->ll_name);
}
if (v == NULL) {
@@ -2070,13 +2070,13 @@ char_u *get_lval(char_u *const name, typval_T *const rettv, lval_T *const lp, co
&& !(lp->ll_tv->v_type == VAR_DICT && lp->ll_tv->vval.v_dict != NULL)
&& !(lp->ll_tv->v_type == VAR_BLOB && lp->ll_tv->vval.v_blob != NULL)) {
if (!quiet) {
- EMSG(_("E689: Can only index a List, Dictionary or Blob"));
+ emsg(_("E689: Can only index a List, Dictionary or Blob"));
}
return NULL;
}
if (lp->ll_range) {
if (!quiet) {
- EMSG(_("E708: [:] must come last"));
+ emsg(_("E708: [:] must come last"));
}
return NULL;
}
@@ -2089,7 +2089,7 @@ char_u *get_lval(char_u *const name, typval_T *const rettv, lval_T *const lp, co
}
if (len == 0) {
if (!quiet) {
- EMSG(_("E713: Cannot use empty key after ."));
+ emsg(_("E713: Cannot use empty key after ."));
}
return NULL;
}
@@ -2116,7 +2116,7 @@ char_u *get_lval(char_u *const name, typval_T *const rettv, lval_T *const lp, co
if (*p == ':') {
if (lp->ll_tv->v_type == VAR_DICT) {
if (!quiet) {
- EMSG(_(e_dictrange));
+ emsg(_(e_dictrange));
}
tv_clear(&var1);
return NULL;
@@ -2125,7 +2125,7 @@ char_u *get_lval(char_u *const name, typval_T *const rettv, lval_T *const lp, co
&& !(rettv->v_type == VAR_LIST && rettv->vval.v_list != NULL)
&& !(rettv->v_type == VAR_BLOB && rettv->vval.v_blob != NULL)) {
if (!quiet) {
- EMSG(_("E709: [:] requires a List or Blob value"));
+ emsg(_("E709: [:] requires a List or Blob value"));
}
tv_clear(&var1);
return NULL;
@@ -2153,7 +2153,7 @@ char_u *get_lval(char_u *const name, typval_T *const rettv, lval_T *const lp, co
if (*p != ']') {
if (!quiet) {
- EMSG(_(e_missbrac));
+ emsg(_(e_missbrac));
}
tv_clear(&var1);
tv_clear(&var2);
@@ -2201,7 +2201,7 @@ char_u *get_lval(char_u *const name, typval_T *const rettv, lval_T *const lp, co
if (lp->ll_di != NULL && tv_is_luafunc(&lp->ll_di->di_tv)
&& len == -1 && rettv == NULL) {
tv_clear(&var1);
- EMSG2(e_illvar, "v:['lua']");
+ semsg(e_illvar, "v:['lua']");
return NULL;
}
@@ -2209,7 +2209,7 @@ char_u *get_lval(char_u *const name, typval_T *const rettv, lval_T *const lp, co
// Can't add "v:" or "a:" variable.
if (lp->ll_dict == &vimvardict
|| &lp->ll_dict->dv_hashtab == get_funccal_args_ht()) {
- EMSG2(_(e_illvar), name);
+ semsg(_(e_illvar), name);
tv_clear(&var1);
return NULL;
}
@@ -2217,7 +2217,7 @@ char_u *get_lval(char_u *const name, typval_T *const rettv, lval_T *const lp, co
// Key does not exist in dict: may need to add it.
if (*p == '[' || *p == '.' || unlet) {
if (!quiet) {
- emsgf(_(e_dictkey), key);
+ semsg(_(e_dictkey), key);
}
tv_clear(&var1);
return NULL;
@@ -2253,7 +2253,7 @@ char_u *get_lval(char_u *const name, typval_T *const rettv, lval_T *const lp, co
if (lp->ll_n1 < 0 || lp->ll_n1 > bloblen
|| (lp->ll_range && lp->ll_n1 == bloblen)) {
if (!quiet) {
- EMSGN(_(e_blobidx), lp->ll_n1);
+ semsg(_(e_blobidx), (int64_t)lp->ll_n1);
}
tv_clear(&var2);
return NULL;
@@ -2263,7 +2263,7 @@ char_u *get_lval(char_u *const name, typval_T *const rettv, lval_T *const lp, co
tv_clear(&var2);
if (lp->ll_n2 < 0 || lp->ll_n2 >= bloblen || lp->ll_n2 < lp->ll_n1) {
if (!quiet) {
- EMSGN(_(e_blobidx), lp->ll_n2);
+ semsg(_(e_blobidx), (int64_t)lp->ll_n2);
}
return NULL;
}
@@ -2293,7 +2293,7 @@ char_u *get_lval(char_u *const name, typval_T *const rettv, lval_T *const lp, co
if (lp->ll_li == NULL) {
tv_clear(&var2);
if (!quiet) {
- EMSGN(_(e_listidx), lp->ll_n1);
+ semsg(_(e_listidx), (int64_t)lp->ll_n1);
}
return NULL;
}
@@ -2309,7 +2309,7 @@ char_u *get_lval(char_u *const name, typval_T *const rettv, lval_T *const lp, co
ni = tv_list_find(lp->ll_list, lp->ll_n2);
if (ni == NULL) {
if (!quiet) {
- EMSGN(_(e_listidx), lp->ll_n2);
+ semsg(_(e_listidx), (int64_t)lp->ll_n2);
}
return NULL;
}
@@ -2322,7 +2322,7 @@ char_u *get_lval(char_u *const name, typval_T *const rettv, lval_T *const lp, co
}
if (lp->ll_n2 < lp->ll_n1) {
if (!quiet) {
- EMSGN(_(e_listidx), lp->ll_n2);
+ semsg(_(e_listidx), (int64_t)lp->ll_n2);
}
return NULL;
}
@@ -2367,7 +2367,7 @@ static void set_var_lval(lval_T *lp, char_u *endp, typval_T *rettv, int copy, co
*endp = NUL;
if (lp->ll_blob != NULL) {
if (op != NULL && *op != '=') {
- EMSG2(_(e_letwrong), op);
+ semsg(_(e_letwrong), op);
return;
}
if (var_check_lock(lp->ll_blob->bv_lock, lp->ll_name, TV_CSTRING)) {
@@ -2380,7 +2380,7 @@ static void set_var_lval(lval_T *lp, char_u *endp, typval_T *rettv, int copy, co
}
if (lp->ll_n2 - lp->ll_n1 + 1 != tv_blob_len(rettv->vval.v_blob)) {
- EMSG(_("E972: Blob value does not have the right number of bytes"));
+ emsg(_("E972: Blob value does not have the right number of bytes"));
return;
}
if (lp->ll_empty2) {
@@ -2412,7 +2412,7 @@ static void set_var_lval(lval_T *lp, char_u *endp, typval_T *rettv, int copy, co
typval_T tv;
if (is_const) {
- EMSG(_(e_cannot_mod));
+ emsg(_(e_cannot_mod));
*endp = cc;
return;
}
@@ -2442,7 +2442,7 @@ static void set_var_lval(lval_T *lp, char_u *endp, typval_T *rettv, int copy, co
int ll_n1 = lp->ll_n1;
if (is_const) {
- EMSG(_("E996: Cannot lock a range"));
+ emsg(_("E996: Cannot lock a range"));
return;
}
@@ -2487,12 +2487,12 @@ static void set_var_lval(lval_T *lp, char_u *endp, typval_T *rettv, int copy, co
lp->ll_n1++;
}
if (ri != NULL) {
- EMSG(_("E710: List value has more items than target"));
+ emsg(_("E710: List value has more items than target"));
} else if (lp->ll_empty2
? (lp->ll_li != NULL
&& TV_LIST_ITEM_NEXT(lp->ll_list, lp->ll_li) != NULL)
: lp->ll_n1 != lp->ll_n2) {
- EMSG(_("E711: List value has not enough items"));
+ emsg(_("E711: List value has not enough items"));
}
} else {
typval_T oldtv = TV_INITIAL_VALUE;
@@ -2500,14 +2500,14 @@ static void set_var_lval(lval_T *lp, char_u *endp, typval_T *rettv, int copy, co
bool watched = tv_dict_is_watched(dict);
if (is_const) {
- EMSG(_("E996: Cannot lock a list or dict"));
+ emsg(_("E996: Cannot lock a list or dict"));
return;
}
// Assign to a List or Dictionary item.
if (lp->ll_newkey != NULL) {
if (op != NULL && *op != '=') {
- EMSG2(_(e_letwrong), op);
+ semsg(_(e_letwrong), op);
return;
}
@@ -2579,7 +2579,7 @@ void *eval_for_line(const char_u *arg, bool *errp, char_u **nextcmdp, int skip)
expr = skipwhite(expr);
if (expr[0] != 'i' || expr[1] != 'n' || !ascii_iswhite(expr[2])) {
- EMSG(_("E690: Missing \"in\" after :for"));
+ emsg(_("E690: Missing \"in\" after :for"));
return fi;
}
@@ -2613,7 +2613,7 @@ void *eval_for_line(const char_u *arg, bool *errp, char_u **nextcmdp, int skip)
}
tv_clear(&tv);
} else {
- EMSG(_(e_listblobreq));
+ emsg(_(e_listblobreq));
tv_clear(&tv);
}
}
@@ -2837,7 +2837,7 @@ static void ex_unletlock(exarg_T *eap, char_u *argstart, int deep, ex_unletlock_
lv.ll_tv = NULL;
arg++;
if (get_env_len((const char_u **)&arg) == 0) {
- EMSG2(_(e_invarg2), arg - 1);
+ semsg(_(e_invarg2), arg - 1);
return;
}
if (!error && !eap->skip && callback(&lv, arg, eap, deep) == FAIL) {
@@ -2855,7 +2855,7 @@ static void ex_unletlock(exarg_T *eap, char_u *argstart, int deep, ex_unletlock_
|| (!ascii_iswhite(*name_end) && !ends_excmd(*name_end))) {
if (name_end != NULL) {
emsg_severe = true;
- EMSG(_(e_trailing));
+ emsg(_(e_trailing));
}
if (!(eap->skip || error)) {
clear_lval(&lv);
@@ -3037,7 +3037,7 @@ int do_unlet(const char *const name, const size_t name_len, const bool forceit)
if (forceit) {
return OK;
}
- EMSG2(_("E108: No such variable: \"%s\""), name);
+ semsg(_("E108: No such variable: \"%s\""), name);
return FAIL;
}
@@ -3065,7 +3065,7 @@ static int do_lock_var(lval_T *lp, char_u *name_end FUNC_ATTR_UNUSED, exarg_T *e
if (lp->ll_tv == NULL) {
if (*lp->ll_name == '$') {
- EMSG2(_(e_lock_unlock), lp->ll_name);
+ semsg(_(e_lock_unlock), lp->ll_name);
ret = FAIL;
} else {
// Normal name or expanded name.
@@ -3078,7 +3078,7 @@ static int do_lock_var(lval_T *lp, char_u *name_end FUNC_ATTR_UNUSED, exarg_T *e
&& di->di_tv.v_type != VAR_LIST) {
// For historical reasons this error is not given for Lists and
// Dictionaries. E.g. b: dictionary may be locked/unlocked.
- EMSG2(_(e_lock_unlock), lp->ll_name);
+ semsg(_(e_lock_unlock), lp->ll_name);
ret = FAIL;
} else {
if (lock) {
@@ -3359,7 +3359,7 @@ int eval0(char_u *arg, typval_T *rettv, char_u **nextcmd, int evaluate)
// Also check called_emsg for when using assert_fails().
if (!aborting() && did_emsg == did_emsg_before
&& called_emsg == called_emsg_before) {
- emsgf(_(e_invexpr2), arg);
+ semsg(_(e_invexpr2), arg);
}
ret = FAIL;
}
@@ -3421,7 +3421,7 @@ int eval1(char_u **arg, typval_T *rettv, int evaluate)
* Check for the ":".
*/
if ((*arg)[0] != ':') {
- EMSG(_("E109: Missing ':' after '?'"));
+ emsg(_("E109: Missing ':' after '?'"));
if (evaluate && result) {
tv_clear(rettv);
}
@@ -3978,7 +3978,7 @@ static int eval6(char_u **arg, typval_T *rettv, int evaluate, int want_string)
)
: f1 / f2);
} else {
- EMSG(_("E804: Cannot use '%' with Float"));
+ emsg(_("E804: Cannot use '%' with Float"));
return FAIL;
}
rettv->v_type = VAR_FLOAT;
@@ -4107,7 +4107,7 @@ static int eval7(char_u **arg, typval_T *rettv, int evaluate, int want_string)
for (bp = *arg + 2; ascii_isxdigit(bp[0]); bp += 2) {
if (!ascii_isxdigit(bp[1])) {
if (blob != NULL) {
- EMSG(_("E973: Blob literal should have an even number of hex "
+ emsg(_("E973: Blob literal should have an even number of hex "
"characters"));
ga_clear(&blob->bv_ga);
XFREE_CLEAR(blob);
@@ -4130,7 +4130,7 @@ static int eval7(char_u **arg, typval_T *rettv, int evaluate, int want_string)
// decimal, hex or octal number
vim_str2nr(*arg, NULL, &len, STR2NR_ALL, &n, NULL, 0, true);
if (len == 0) {
- EMSG2(_(e_invexpr2), *arg);
+ semsg(_(e_invexpr2), *arg);
ret = FAIL;
break;
}
@@ -4205,7 +4205,7 @@ static int eval7(char_u **arg, typval_T *rettv, int evaluate, int want_string)
if (**arg == ')') {
++*arg;
} else if (ret == OK) {
- EMSG(_("E110: Missing ')'"));
+ emsg(_("E110: Missing ')'"));
tv_clear(rettv);
ret = FAIL;
}
@@ -4378,9 +4378,9 @@ static int eval_lambda(char_u **const arg, typval_T *const rettv, const bool eva
} else if (**arg != '(') {
if (verbose) {
if (*skipwhite(*arg) == '(') {
- EMSG(_(e_nowhitespace));
+ emsg(_(e_nowhitespace));
} else {
- EMSG2(_(e_missingparen), "lambda");
+ semsg(_(e_missingparen), "lambda");
}
}
tv_clear(rettv);
@@ -4431,21 +4431,21 @@ static int eval_method(char_u **const arg, typval_T *const rettv, const bool eva
if (len <= 0) {
if (verbose) {
if (lua_funcname == NULL) {
- EMSG(_("E260: Missing name after ->"));
+ emsg(_("E260: Missing name after ->"));
} else {
- EMSG2(_(e_invexpr2), name);
+ semsg(_(e_invexpr2), name);
}
}
ret = FAIL;
} else {
if (**arg != '(') {
if (verbose) {
- EMSG2(_(e_missingparen), name);
+ semsg(_(e_missingparen), name);
}
ret = FAIL;
} else if (ascii_iswhite((*arg)[-1])) {
if (verbose) {
- EMSG(_(e_nowhitespace));
+ emsg(_(e_nowhitespace));
}
ret = FAIL;
} else if (lua_funcname != NULL) {
@@ -4489,18 +4489,18 @@ static int eval_index(char_u **arg, typval_T *rettv, int evaluate, int verbose)
case VAR_FUNC:
case VAR_PARTIAL:
if (verbose) {
- EMSG(_("E695: Cannot index a Funcref"));
+ emsg(_("E695: Cannot index a Funcref"));
}
return FAIL;
case VAR_FLOAT:
if (verbose) {
- EMSG(_(e_float_as_string));
+ emsg(_(e_float_as_string));
}
return FAIL;
case VAR_BOOL:
case VAR_SPECIAL:
if (verbose) {
- EMSG(_("E909: Cannot index a special variable"));
+ emsg(_("E909: Cannot index a special variable"));
}
return FAIL;
case VAR_UNKNOWN:
@@ -4572,7 +4572,7 @@ static int eval_index(char_u **arg, typval_T *rettv, int evaluate, int verbose)
// Check for the ']'.
if (**arg != ']') {
if (verbose) {
- EMSG(_(e_missbrac));
+ emsg(_(e_missbrac));
}
tv_clear(&var1);
if (range) {
@@ -4680,7 +4680,7 @@ static int eval_index(char_u **arg, typval_T *rettv, int evaluate, int verbose)
rettv->v_type = VAR_NUMBER;
rettv->vval.v_number = v;
} else {
- EMSGN(_(e_blobidx), n1);
+ semsg(_(e_blobidx), (int64_t)n1);
}
}
break;
@@ -4694,7 +4694,7 @@ static int eval_index(char_u **arg, typval_T *rettv, int evaluate, int verbose)
// list. A list index out of range is an error.
if (!range) {
if (verbose) {
- EMSGN(_(e_listidx), n1);
+ semsg(_(e_listidx), (int64_t)n1);
}
return FAIL;
}
@@ -4729,7 +4729,7 @@ static int eval_index(char_u **arg, typval_T *rettv, int evaluate, int verbose)
case VAR_DICT: {
if (range) {
if (verbose) {
- EMSG(_(e_dictrange));
+ emsg(_(e_dictrange));
}
if (len == -1) {
tv_clear(&var1);
@@ -4749,7 +4749,7 @@ static int eval_index(char_u **arg, typval_T *rettv, int evaluate, int verbose)
(const char *)key, len);
if (item == NULL && verbose) {
- emsgf(_(e_dictkey), key);
+ semsg(_(e_dictkey), key);
}
if (len == -1) {
tv_clear(&var1);
@@ -4801,7 +4801,7 @@ int get_option_tv(const char **const arg, typval_T *const rettv, const bool eval
char *option_end = (char *)find_option_end(arg, &opt_flags);
if (option_end == NULL) {
if (rettv != NULL) {
- EMSG2(_("E112: Option name missing: %s"), *arg);
+ semsg(_("E112: Option name missing: %s"), *arg);
}
return FAIL;
}
@@ -4818,7 +4818,7 @@ int get_option_tv(const char **const arg, typval_T *const rettv, const bool eval
if (opt_type == -3) { // invalid name
if (rettv != NULL) {
- EMSG2(_("E113: Unknown option: %s"), *arg);
+ semsg(_("E113: Unknown option: %s"), *arg);
}
ret = FAIL;
} else if (rettv != NULL) {
@@ -4871,7 +4871,7 @@ static int get_string_tv(char_u **arg, typval_T *rettv, int evaluate)
}
if (*p != '"') {
- EMSG2(_("E114: Missing quote: %s"), *arg);
+ semsg(_("E114: Missing quote: %s"), *arg);
return FAIL;
}
@@ -5009,7 +5009,7 @@ static int get_lit_string_tv(char_u **arg, typval_T *rettv, int evaluate)
}
if (*p != '\'') {
- EMSG2(_("E115: Missing quote: %s"), *arg);
+ semsg(_("E115: Missing quote: %s"), *arg);
return FAIL;
}
@@ -5104,14 +5104,14 @@ static int get_list_tv(char_u **arg, typval_T *rettv, int evaluate)
break;
}
if (**arg != ',') {
- emsgf(_("E696: Missing comma in List: %s"), *arg);
+ semsg(_("E696: Missing comma in List: %s"), *arg);
goto failret;
}
*arg = skipwhite(*arg + 1);
}
if (**arg != ']') {
- emsgf(_("E697: Missing end of List ']': %s"), *arg);
+ semsg(_("E697: Missing end of List ']': %s"), *arg);
failret:
if (evaluate) {
tv_list_free(l);
@@ -5741,7 +5741,7 @@ static int dict_get_tv(char_u **arg, typval_T *rettv, int evaluate, bool literal
goto failret;
}
if (**arg != ':') {
- EMSG2(_("E720: Missing colon in Dictionary: %s"), *arg);
+ semsg(_("E720: Missing colon in Dictionary: %s"), *arg);
tv_clear(&tvkey);
goto failret;
}
@@ -5764,7 +5764,7 @@ static int dict_get_tv(char_u **arg, typval_T *rettv, int evaluate, bool literal
if (evaluate) {
item = tv_dict_find(d, (const char *)key, -1);
if (item != NULL) {
- EMSG2(_("E721: Duplicate key in Dictionary: \"%s\""), key);
+ semsg(_("E721: Duplicate key in Dictionary: \"%s\""), key);
tv_clear(&tvkey);
tv_clear(&tv);
goto failret;
@@ -5782,14 +5782,14 @@ static int dict_get_tv(char_u **arg, typval_T *rettv, int evaluate, bool literal
break;
}
if (**arg != ',') {
- EMSG2(_("E722: Missing comma in Dictionary: %s"), *arg);
+ semsg(_("E722: Missing comma in Dictionary: %s"), *arg);
goto failret;
}
*arg = skipwhite(*arg + 1);
}
if (**arg != '}') {
- EMSG2(_("E723: Missing end of Dictionary '}': %s"), *arg);
+ semsg(_("E723: Missing end of Dictionary '}': %s"), *arg);
failret:
if (d != NULL) {
tv_dict_free(d);
@@ -6351,7 +6351,7 @@ int assert_match_common(typval_T *argvars, assert_type_T atype)
const char *const text = tv_get_string_buf_chk(&argvars[1], buf2);
if (pat == NULL || text == NULL) {
- EMSG(_(e_invarg));
+ emsg(_(e_invarg));
} else if (pattern_match((char_u *)pat, (char_u *)text, false)
!= (atype == ASSERT_MATCH)) {
garray_T ga;
@@ -6419,7 +6419,7 @@ void filter_map(typval_T *argvars, typval_T *rettv, int map)
return;
}
} else {
- EMSG2(_(e_listdictblobarg), ermsg);
+ semsg(_(e_listdictblobarg), ermsg);
return;
}
@@ -6482,7 +6482,7 @@ void filter_map(typval_T *argvars, typval_T *rettv, int map)
break;
}
if (tv.v_type != VAR_NUMBER) {
- EMSG(_(e_invalblob));
+ emsg(_(e_invalblob));
return;
}
if (map) {
@@ -6598,14 +6598,14 @@ void common_function(typval_T *argvars, typval_T *rettv, bool is_funcref, FunPtr
}
if (s == NULL || *s == NUL || (use_string && ascii_isdigit(*s))
|| (is_funcref && trans_name == NULL)) {
- emsgf(_(e_invarg2), (use_string
+ semsg(_(e_invarg2), (use_string
? tv_get_string(&argvars[0])
: (const char *)s));
// Don't check an autoload name for existence here.
} else if (trans_name != NULL
&& (is_funcref ? find_func(trans_name) == NULL
: !translated_function_exists((const char *)trans_name))) {
- emsgf(_("E700: Unknown function: %s"), s);
+ semsg(_("E700: Unknown function: %s"), s);
} else {
int dict_idx = 0;
int arg_idx = 0;
@@ -6641,7 +6641,7 @@ void common_function(typval_T *argvars, typval_T *rettv, bool is_funcref, FunPtr
}
if (dict_idx > 0) {
if (argvars[dict_idx].v_type != VAR_DICT) {
- EMSG(_("E922: expected a dict"));
+ emsg(_("E922: expected a dict"));
xfree(name);
goto theend;
}
@@ -6651,7 +6651,7 @@ void common_function(typval_T *argvars, typval_T *rettv, bool is_funcref, FunPtr
}
if (arg_idx > 0) {
if (argvars[arg_idx].v_type != VAR_LIST) {
- EMSG(_("E923: Second argument of function() must be "
+ emsg(_("E923: Second argument of function() must be "
"a list or a dict"));
xfree(name);
goto theend;
@@ -6809,7 +6809,7 @@ void get_qf_loc_list(int is_qf, win_T *wp, typval_T *what_arg, typval_T *rettv)
qf_get_properties(wp, d, rettv->vval.v_dict);
}
} else {
- EMSG(_(e_dictreq));
+ emsg(_(e_dictreq));
}
}
}
@@ -7014,7 +7014,7 @@ void get_user_input(const typval_T *const argvars, typval_T *const rettv, const
char def[1] = { 0 };
if (argvars[0].v_type == VAR_DICT) {
if (argvars[1].v_type != VAR_UNKNOWN) {
- EMSG(_("E5050: {opts} must be the only argument"));
+ emsg(_("E5050: {opts} must be the only argument"));
return;
}
dict_T *const dict = argvars[0].vval.v_dict;
@@ -7133,7 +7133,7 @@ void get_user_input(const typval_T *const argvars, typval_T *const rettv, const
void dict_list(typval_T *const tv, typval_T *const rettv, const DictListType what)
{
if (tv->v_type != VAR_DICT) {
- EMSG(_(e_dictreq));
+ emsg(_(e_dictreq));
return;
}
if (tv->vval.v_dict == NULL) {
@@ -7196,14 +7196,14 @@ char **tv_to_argv(typval_T *cmd_tv, const char **cmd, bool *executable)
}
if (cmd_tv->v_type != VAR_LIST) {
- EMSG2(_(e_invarg2), "expected String or List");
+ semsg(_(e_invarg2), "expected String or List");
return NULL;
}
list_T *argl = cmd_tv->vval.v_list;
int argc = tv_list_len(argl);
if (!argc) {
- EMSG(_(e_invarg)); // List must have at least one item.
+ emsg(_(e_invarg)); // List must have at least one item.
return NULL;
}
@@ -7213,7 +7213,7 @@ char **tv_to_argv(typval_T *cmd_tv, const char **cmd, bool *executable)
if (arg0 && executable) {
char buf[IOSIZE];
snprintf(buf, sizeof(buf), "'%s' is not executable", arg0);
- EMSG3(_(e_invargNval), "cmd", buf);
+ semsg(_(e_invargNval), "cmd", buf);
*executable = false;
}
return NULL;
@@ -7293,7 +7293,7 @@ int matchadd_dict_arg(typval_T *tv, const char **conceal_char, win_T **win)
dictitem_T *di;
if (tv->v_type != VAR_DICT) {
- EMSG(_(e_dictreq));
+ emsg(_(e_dictreq));
return FAIL;
}
@@ -7304,7 +7304,7 @@ int matchadd_dict_arg(typval_T *tv, const char **conceal_char, win_T **win)
if ((di = tv_dict_find(tv->vval.v_dict, S_LEN("window"))) != NULL) {
*win = find_win_by_nr_or_id(&di->di_tv);
if (*win == NULL) {
- EMSG(_(e_invalwindow));
+ emsg(_(e_invalwindow));
return FAIL;
}
}
@@ -7683,7 +7683,7 @@ bool callback_from_typval(Callback *const callback, typval_T *const arg)
}
if (r == FAIL) {
- EMSG(_("E921: Invalid callback argument"));
+ emsg(_("E921: Invalid callback argument"));
return false;
}
return true;
@@ -7967,7 +7967,7 @@ bool write_list(FileDescriptor *const fp, const list_T *const list, const bool b
}
return true;
write_list_error:
- emsgf(_(e_write2), os_strerror(error));
+ semsg(_(e_write2), os_strerror(error));
return false;
}
@@ -7995,7 +7995,7 @@ bool write_blob(FileDescriptor *const fp, const blob_T *const blob)
}
return true;
write_blob_error:
- EMSG2(_(e_write2), os_strerror(error));
+ semsg(_(e_write2), os_strerror(error));
return false;
}
@@ -8062,7 +8062,7 @@ char *save_tv_as_string(typval_T *tv, ptrdiff_t *const len, bool endnl)
*len += 1;
}
} else {
- EMSGN(_(e_nobufnr), tv->vval.v_number);
+ semsg(_(e_nobufnr), tv->vval.v_number);
*len = -1;
return NULL;
}
@@ -8396,7 +8396,7 @@ int get_name_len(const char **const arg, char **alias, bool evaluate, bool verbo
// Only give an error when there is something, otherwise it will be
// reported at a higher level.
if (len == 0 && verbose && **arg != NUL) {
- EMSG2(_(e_invexpr2), *arg);
+ semsg(_(e_invexpr2), *arg);
}
return len;
@@ -8863,7 +8863,7 @@ int get_var_tv(const char *name, int len, typval_T *rettv, dictitem_T **dip, int
if (tv == NULL) {
if (rettv != NULL && verbose) {
- emsgf(_("E121: Undefined variable: %.*s"), len, name);
+ semsg(_("E121: Undefined variable: %.*s"), len, name);
}
ret = FAIL;
} else if (rettv != NULL) {
@@ -9440,7 +9440,7 @@ static void set_var_const(const char *name, const size_t name_len, typval_T *con
const bool watched = tv_dict_is_watched(dict);
if (ht == NULL || *varname == NUL) {
- EMSG2(_(e_illvar), name);
+ semsg(_(e_illvar), name);
return;
}
v = find_var_in_ht(ht, 0, varname, name_len - (size_t)(varname - name), true);
@@ -9457,7 +9457,7 @@ static void set_var_const(const char *name, const size_t name_len, typval_T *con
typval_T oldtv = TV_INITIAL_VALUE;
if (v != NULL) {
if (is_const) {
- EMSG(_(e_cannot_mod));
+ emsg(_(e_cannot_mod));
return;
}
@@ -9496,7 +9496,7 @@ static void set_var_const(const char *name, const size_t name_len, typval_T *con
}
return;
} else if (v->di_tv.v_type != tv->v_type) {
- EMSG2(_("E963: setting %s to value with wrong type"), name);
+ semsg(_("E963: setting %s to value with wrong type"), name);
return;
}
}
@@ -9508,7 +9508,7 @@ static void set_var_const(const char *name, const size_t name_len, typval_T *con
} else { // Add a new variable.
// Can't add "v:" or "a:" variable.
if (ht == &vimvarht || ht == get_funccal_args_ht()) {
- emsgf(_(e_illvar), name);
+ semsg(_(e_illvar), name);
return;
}
@@ -9596,7 +9596,7 @@ bool var_check_ro(const int flags, const char *name, size_t name_len)
name_len = strlen(name);
}
- emsgf(_(error_message), (int)name_len, name);
+ semsg(_(error_message), (int)name_len, name);
return true;
}
@@ -9629,7 +9629,7 @@ bool var_check_fixed(const int flags, const char *name, size_t name_len)
} else if (name_len == TV_CSTRING) {
name_len = strlen(name);
}
- EMSG3(_("E795: Cannot delete variable %.*s"), (int)name_len, name);
+ semsg(_("E795: Cannot delete variable %.*s"), (int)name_len, name);
return true;
}
return false;
@@ -9651,14 +9651,14 @@ bool var_check_func_name(const char *const name, const bool new_var)
if (!(vim_strchr((char_u *)"wbst", name[0]) != NULL && name[1] == ':')
&& !ASCII_ISUPPER((name[0] != NUL && name[1] == ':') ? name[2]
: name[0])) {
- EMSG2(_("E704: Funcref variable name must start with a capital: %s"), name);
+ semsg(_("E704: Funcref variable name must start with a capital: %s"), name);
return false;
}
// Don't allow hiding a function. When "v" is not NULL we might be
// assigning another function to the same var, the type is checked
// below.
if (new_var && function_exists(name, false)) {
- EMSG2(_("E705: Variable name conflicts with existing function: %s"),
+ semsg(_("E705: Variable name conflicts with existing function: %s"),
name);
return false;
}
@@ -9680,7 +9680,7 @@ bool valid_varname(const char *varname)
if (!eval_isnamec1((int)(uint8_t)(*p))
&& (p == varname || !ascii_isdigit(*p))
&& *p != AUTOLOAD_CHAR) {
- emsgf(_(e_illvar), varname);
+ semsg(_(e_illvar), varname);
return false;
}
}
@@ -9711,7 +9711,7 @@ int var_item_copy(const vimconv_T *const conv, typval_T *const from, typval_T *c
int ret = OK;
if (recurse >= DICT_MAXNEST) {
- EMSG(_("E698: variable nested too deep for making a copy"));
+ emsg(_("E698: variable nested too deep for making a copy"));
return FAIL;
}
++recurse;
@@ -9813,7 +9813,7 @@ void ex_echo(exarg_T *eap)
// exception.
if (!aborting() && did_emsg == did_emsg_before
&& called_emsg == called_emsg_before) {
- EMSG2(_(e_invexpr2), p);
+ semsg(_(e_invexpr2), p);
}
need_clr_eos = false;
break;
@@ -9933,7 +9933,7 @@ void ex_execute(exarg_T *eap)
// We don't want to abort following commands, restore did_emsg.
save_did_emsg = did_emsg;
msg_ext_set_kind("echoerr");
- EMSG((char_u *)ga.ga_data);
+ emsg(ga.ga_data);
if (!force_abort) {
did_emsg = save_did_emsg;
}
@@ -10864,9 +10864,9 @@ Channel *find_job(uint64_t id, bool show_error)
|| process_is_stopped(&data->stream.proc)) {
if (show_error) {
if (data && data->streamtype != kChannelStreamProc) {
- EMSG(_(e_invchanjob));
+ emsg(_(e_invchanjob));
} else {
- EMSG(_(e_invchan));
+ emsg(_(e_invchan));
}
}
return NULL;
@@ -10882,7 +10882,7 @@ void script_host_eval(char *name, typval_T *argvars, typval_T *rettv)
}
if (argvars[0].v_type != VAR_STRING) {
- EMSG(_(e_invarg));
+ emsg(_(e_invarg));
return;
}
@@ -10896,7 +10896,7 @@ void script_host_eval(char *name, typval_T *argvars, typval_T *rettv)
typval_T eval_call_provider(char *provider, char *method, list_T *arguments, bool discard)
{
if (!eval_has_provider(provider)) {
- emsgf("E319: No \"%s\" provider found. Run \":checkhealth provider\"",
+ semsg("E319: No \"%s\" provider found. Run \":checkhealth provider\"",
provider);
return (typval_T){
.v_type = VAR_NUMBER,
@@ -10988,7 +10988,7 @@ bool eval_has_provider(const char *feat)
// Show a hint if Call() is defined but g:loaded_xx_provider is missing.
snprintf(buf, sizeof(buf), "provider#%s#Call", name);
if (!!find_func((char_u *)buf) && p_lpl) {
- emsgf("provider: %s: missing required variable g:loaded_%s_provider",
+ semsg("provider: %s: missing required variable g:loaded_%s_provider",
name, name);
}
return false;
@@ -11003,7 +11003,7 @@ bool eval_has_provider(const char *feat)
// Call() must be defined if provider claims to be working.
snprintf(buf, sizeof(buf), "provider#%s#Call", name);
if (!find_func((char_u *)buf)) {
- emsgf("provider: %s: g:loaded_%s_provider=2 but %s is not defined",
+ semsg("provider: %s: g:loaded_%s_provider=2 but %s is not defined",
name, name, buf);
ok = false;
}
@@ -11033,13 +11033,13 @@ void ex_checkhealth(exarg_T *eap)
if (!found) {
const char *vimruntime_env = os_getenv("VIMRUNTIME");
if (vimruntime_env == NULL) {
- EMSG(_("E5009: $VIMRUNTIME is empty or unset"));
+ emsg(_("E5009: $VIMRUNTIME is empty or unset"));
} else {
bool rtp_ok = NULL != strstr((char *)p_rtp, vimruntime_env);
if (rtp_ok) {
- EMSG2(_("E5009: Invalid $VIMRUNTIME: %s"), vimruntime_env);
+ semsg(_("E5009: Invalid $VIMRUNTIME: %s"), vimruntime_env);
} else {
- EMSG(_("E5009: Invalid 'runtimepath'"));
+ emsg(_("E5009: Invalid 'runtimepath'"));
}
}
return;
@@ -11128,9 +11128,9 @@ int typval_compare(typval_T *typ1, typval_T *typ2, exprtype_T type, bool ic)
} else if (typ1->v_type != typ2->v_type
|| (type != EXPR_EQUAL && type != EXPR_NEQUAL)) {
if (typ1->v_type != typ2->v_type) {
- EMSG(_("E977: Can only compare Blob with Blob"));
+ emsg(_("E977: Can only compare Blob with Blob"));
} else {
- EMSG(_(e_invalblob));
+ emsg(_(e_invalblob));
}
tv_clear(typ1);
return FAIL;
@@ -11151,9 +11151,9 @@ int typval_compare(typval_T *typ1, typval_T *typ2, exprtype_T type, bool ic)
} else if (typ1->v_type != typ2->v_type
|| (type != EXPR_EQUAL && type != EXPR_NEQUAL)) {
if (typ1->v_type != typ2->v_type) {
- EMSG(_("E691: Can only compare List with List"));
+ emsg(_("E691: Can only compare List with List"));
} else {
- EMSG(_("E692: Invalid operation for List"));
+ emsg(_("E692: Invalid operation for List"));
}
tv_clear(typ1);
return FAIL;
@@ -11174,9 +11174,9 @@ int typval_compare(typval_T *typ1, typval_T *typ2, exprtype_T type, bool ic)
} else if (typ1->v_type != typ2->v_type
|| (type != EXPR_EQUAL && type != EXPR_NEQUAL)) {
if (typ1->v_type != typ2->v_type) {
- EMSG(_("E735: Can only compare Dictionary with Dictionary"));
+ emsg(_("E735: Can only compare Dictionary with Dictionary"));
} else {
- EMSG(_("E736: Invalid operation for Dictionary"));
+ emsg(_("E736: Invalid operation for Dictionary"));
}
tv_clear(typ1);
return FAIL;
@@ -11190,7 +11190,7 @@ int typval_compare(typval_T *typ1, typval_T *typ2, exprtype_T type, bool ic)
} else if (tv_is_func(*typ1) || tv_is_func(*typ2)) {
if (type != EXPR_EQUAL && type != EXPR_NEQUAL
&& type != EXPR_IS && type != EXPR_ISNOT) {
- EMSG(_("E694: Invalid operation for Funcrefs"));
+ emsg(_("E694: Invalid operation for Funcrefs"));
tv_clear(typ1);
return FAIL;
}
diff --git a/src/nvim/eval/decode.c b/src/nvim/eval/decode.c
index c8734c9b9c..5008945f09 100644
--- a/src/nvim/eval/decode.c
+++ b/src/nvim/eval/decode.c
@@ -118,7 +118,7 @@ static inline int json_decoder_pop(ValuesStackItem obj, ValuesStack *const stack
if (last_container.container.v_type == VAR_LIST) {
if (tv_list_len(last_container.container.vval.v_list) != 0
&& !obj.didcomma) {
- EMSG2(_("E474: Expected comma before list item: %s"), val_location);
+ semsg(_("E474: Expected comma before list item: %s"), val_location);
tv_clear(&obj.val);
return FAIL;
}
@@ -126,7 +126,7 @@ static inline int json_decoder_pop(ValuesStackItem obj, ValuesStack *const stack
tv_list_append_owned_tv(last_container.container.vval.v_list, obj.val);
} else if (last_container.stack_index == kv_size(*stack) - 2) {
if (!obj.didcolon) {
- EMSG2(_("E474: Expected colon before dictionary value: %s"),
+ semsg(_("E474: Expected colon before dictionary value: %s"),
val_location);
tv_clear(&obj.val);
return FAIL;
@@ -153,13 +153,13 @@ static inline int json_decoder_pop(ValuesStackItem obj, ValuesStack *const stack
} else {
// Object with key only
if (!obj.is_special_string && obj.val.v_type != VAR_STRING) {
- EMSG2(_("E474: Expected string key: %s"), *pp);
+ semsg(_("E474: Expected string key: %s"), *pp);
tv_clear(&obj.val);
return FAIL;
} else if (!obj.didcomma
&& (last_container.special_val == NULL
&& (DICT_LEN(last_container.container.vval.v_dict) != 0))) {
- EMSG2(_("E474: Expected comma before dictionary key: %s"), val_location);
+ semsg(_("E474: Expected comma before dictionary key: %s"), val_location);
tv_clear(&obj.val);
return FAIL;
}
@@ -330,21 +330,21 @@ static inline int parse_json_string(const char *const buf, const size_t buf_len,
if (*p == '\\') {
p++;
if (p == e) {
- emsgf(_("E474: Unfinished escape sequence: %.*s"),
+ semsg(_("E474: Unfinished escape sequence: %.*s"),
(int)buf_len, buf);
goto parse_json_string_fail;
}
switch (*p) {
case 'u':
if (p + 4 >= e) {
- emsgf(_("E474: Unfinished unicode escape sequence: %.*s"),
+ semsg(_("E474: Unfinished unicode escape sequence: %.*s"),
(int)buf_len, buf);
goto parse_json_string_fail;
} else if (!ascii_isxdigit(p[1])
|| !ascii_isxdigit(p[2])
|| !ascii_isxdigit(p[3])
|| !ascii_isxdigit(p[4])) {
- emsgf(_("E474: Expected four hex digits after \\u: %.*s"),
+ semsg(_("E474: Expected four hex digits after \\u: %.*s"),
LENP(p - 1, e));
goto parse_json_string_fail;
}
@@ -365,14 +365,14 @@ static inline int parse_json_string(const char *const buf, const size_t buf_len,
p++;
break;
default:
- emsgf(_("E474: Unknown escape sequence: %.*s"), LENP(p - 1, e));
+ semsg(_("E474: Unknown escape sequence: %.*s"), LENP(p - 1, e));
goto parse_json_string_fail;
}
} else {
uint8_t p_byte = (uint8_t)*p;
// unescaped = %x20-21 / %x23-5B / %x5D-10FFFF
if (p_byte < 0x20) {
- emsgf(_("E474: ASCII control characters cannot be present "
+ semsg(_("E474: ASCII control characters cannot be present "
"inside string: %.*s"), LENP(p, e));
goto parse_json_string_fail;
}
@@ -385,10 +385,10 @@ static inline int parse_json_string(const char *const buf, const size_t buf_len,
// The only exception is U+00C3 which is represented as 0xC3 0x83.
if (ch >= 0x80 && p_byte == ch
&& !(ch == 0xC3 && p + 1 < e && (uint8_t)p[1] == 0x83)) {
- emsgf(_("E474: Only UTF-8 strings allowed: %.*s"), LENP(p, e));
+ semsg(_("E474: Only UTF-8 strings allowed: %.*s"), LENP(p, e));
goto parse_json_string_fail;
} else if (ch > 0x10FFFF) {
- emsgf(_("E474: Only UTF-8 code points up to U+10FFFF "
+ semsg(_("E474: Only UTF-8 code points up to U+10FFFF "
"are allowed to appear unescaped: %.*s"), LENP(p, e));
goto parse_json_string_fail;
}
@@ -399,7 +399,7 @@ static inline int parse_json_string(const char *const buf, const size_t buf_len,
}
}
if (p == e || *p != '"') {
- emsgf(_("E474: Expected string end: %.*s"), (int)buf_len, buf);
+ semsg(_("E474: Expected string end: %.*s"), (int)buf_len, buf);
goto parse_json_string_fail;
}
if (len == 0) {
@@ -546,7 +546,7 @@ static inline int parse_json_number(const char *const buf, const size_t buf_len,
p++;
}
if (p != ints + 1 && *ints == '0') {
- emsgf(_("E474: Leading zeroes are not allowed: %.*s"), LENP(s, e));
+ semsg(_("E474: Leading zeroes are not allowed: %.*s"), LENP(s, e));
goto parse_json_number_fail;
}
if (p >= e || p == ints) {
@@ -575,13 +575,13 @@ static inline int parse_json_number(const char *const buf, const size_t buf_len,
}
parse_json_number_check:
if (p == ints) {
- emsgf(_("E474: Missing number after minus sign: %.*s"), LENP(s, e));
+ semsg(_("E474: Missing number after minus sign: %.*s"), LENP(s, e));
goto parse_json_number_fail;
} else if (p == fracs || (fracs != NULL && exps_s == fracs + 1)) {
- emsgf(_("E474: Missing number after decimal dot: %.*s"), LENP(s, e));
+ semsg(_("E474: Missing number after decimal dot: %.*s"), LENP(s, e));
goto parse_json_number_fail;
} else if (p == exps) {
- emsgf(_("E474: Missing exponent: %.*s"), LENP(s, e));
+ semsg(_("E474: Missing exponent: %.*s"), LENP(s, e));
goto parse_json_number_fail;
}
typval_T tv = {
@@ -593,7 +593,7 @@ parse_json_number_check:
// Convert floating-point number
const size_t num_len = string2float(s, &tv.vval.v_float);
if (exp_num_len != num_len) {
- emsgf(_("E685: internal error: while converting number \"%.*s\" "
+ semsg(_("E685: internal error: while converting number \"%.*s\" "
"to float string2float consumed %zu bytes in place of %zu"),
(int)exp_num_len, s, num_len, exp_num_len);
}
@@ -604,7 +604,7 @@ parse_json_number_check:
int num_len;
vim_str2nr((char_u *)s, NULL, &num_len, 0, &nr, NULL, (int)(p - s), true);
if ((int)exp_num_len != num_len) {
- emsgf(_("E685: internal error: while converting number \"%.*s\" "
+ semsg(_("E685: internal error: while converting number \"%.*s\" "
"to integer vim_str2nr consumed %i bytes in place of %zu"),
(int)exp_num_len, s, num_len, exp_num_len);
}
@@ -656,7 +656,7 @@ int json_decode_string(const char *const buf, const size_t buf_len, typval_T *co
p++;
}
if (p == e) {
- EMSG(_("E474: Attempt to decode a blank string"));
+ emsg(_("E474: Attempt to decode a blank string"));
return FAIL;
}
int ret = OK;
@@ -673,26 +673,26 @@ json_decode_string_cycle_start:
case '}':
case ']': {
if (kv_size(container_stack) == 0) {
- emsgf(_("E474: No container to close: %.*s"), LENP(p, e));
+ semsg(_("E474: No container to close: %.*s"), LENP(p, e));
goto json_decode_string_fail;
}
ContainerStackItem last_container = kv_last(container_stack);
if (*p == '}' && last_container.container.v_type != VAR_DICT) {
- emsgf(_("E474: Closing list with curly bracket: %.*s"), LENP(p, e));
+ semsg(_("E474: Closing list with curly bracket: %.*s"), LENP(p, e));
goto json_decode_string_fail;
} else if (*p == ']' && last_container.container.v_type != VAR_LIST) {
- emsgf(_("E474: Closing dictionary with square bracket: %.*s"),
+ semsg(_("E474: Closing dictionary with square bracket: %.*s"),
LENP(p, e));
goto json_decode_string_fail;
} else if (didcomma) {
- emsgf(_("E474: Trailing comma: %.*s"), LENP(p, e));
+ semsg(_("E474: Trailing comma: %.*s"), LENP(p, e));
goto json_decode_string_fail;
} else if (didcolon) {
- emsgf(_("E474: Expected value after colon: %.*s"), LENP(p, e));
+ semsg(_("E474: Expected value after colon: %.*s"), LENP(p, e));
goto json_decode_string_fail;
} else if (last_container.stack_index != kv_size(stack) - 1) {
assert(last_container.stack_index < kv_size(stack) - 1);
- emsgf(_("E474: Expected value: %.*s"), LENP(p, e));
+ semsg(_("E474: Expected value: %.*s"), LENP(p, e));
goto json_decode_string_fail;
}
if (kv_size(stack) == 1) {
@@ -711,19 +711,19 @@ json_decode_string_cycle_start:
}
case ',': {
if (kv_size(container_stack) == 0) {
- emsgf(_("E474: Comma not inside container: %.*s"), LENP(p, e));
+ semsg(_("E474: Comma not inside container: %.*s"), LENP(p, e));
goto json_decode_string_fail;
}
ContainerStackItem last_container = kv_last(container_stack);
if (didcomma) {
- emsgf(_("E474: Duplicate comma: %.*s"), LENP(p, e));
+ semsg(_("E474: Duplicate comma: %.*s"), LENP(p, e));
goto json_decode_string_fail;
} else if (didcolon) {
- emsgf(_("E474: Comma after colon: %.*s"), LENP(p, e));
+ semsg(_("E474: Comma after colon: %.*s"), LENP(p, e));
goto json_decode_string_fail;
} else if (last_container.container.v_type == VAR_DICT
&& last_container.stack_index != kv_size(stack) - 1) {
- emsgf(_("E474: Using comma in place of colon: %.*s"), LENP(p, e));
+ semsg(_("E474: Using comma in place of colon: %.*s"), LENP(p, e));
goto json_decode_string_fail;
} else if (last_container.special_val == NULL
? (last_container.container.v_type == VAR_DICT
@@ -731,7 +731,7 @@ json_decode_string_cycle_start:
: (tv_list_len(last_container.container.vval.v_list)
== 0))
: (tv_list_len(last_container.special_val) == 0)) {
- emsgf(_("E474: Leading comma: %.*s"), LENP(p, e));
+ semsg(_("E474: Leading comma: %.*s"), LENP(p, e));
goto json_decode_string_fail;
}
didcomma = true;
@@ -739,21 +739,21 @@ json_decode_string_cycle_start:
}
case ':': {
if (kv_size(container_stack) == 0) {
- emsgf(_("E474: Colon not inside container: %.*s"), LENP(p, e));
+ semsg(_("E474: Colon not inside container: %.*s"), LENP(p, e));
goto json_decode_string_fail;
}
ContainerStackItem last_container = kv_last(container_stack);
if (last_container.container.v_type != VAR_DICT) {
- emsgf(_("E474: Using colon not in dictionary: %.*s"), LENP(p, e));
+ semsg(_("E474: Using colon not in dictionary: %.*s"), LENP(p, e));
goto json_decode_string_fail;
} else if (last_container.stack_index != kv_size(stack) - 2) {
- emsgf(_("E474: Unexpected colon: %.*s"), LENP(p, e));
+ semsg(_("E474: Unexpected colon: %.*s"), LENP(p, e));
goto json_decode_string_fail;
} else if (didcomma) {
- emsgf(_("E474: Colon after comma: %.*s"), LENP(p, e));
+ semsg(_("E474: Colon after comma: %.*s"), LENP(p, e));
goto json_decode_string_fail;
} else if (didcolon) {
- emsgf(_("E474: Duplicate colon: %.*s"), LENP(p, e));
+ semsg(_("E474: Duplicate colon: %.*s"), LENP(p, e));
goto json_decode_string_fail;
}
didcolon = true;
@@ -766,7 +766,7 @@ json_decode_string_cycle_start:
continue;
case 'n':
if ((p + 3) >= e || strncmp(p + 1, "ull", 3) != 0) {
- emsgf(_("E474: Expected null: %.*s"), LENP(p, e));
+ semsg(_("E474: Expected null: %.*s"), LENP(p, e));
goto json_decode_string_fail;
}
p += 3;
@@ -778,7 +778,7 @@ json_decode_string_cycle_start:
break;
case 't':
if ((p + 3) >= e || strncmp(p + 1, "rue", 3) != 0) {
- emsgf(_("E474: Expected true: %.*s"), LENP(p, e));
+ semsg(_("E474: Expected true: %.*s"), LENP(p, e));
goto json_decode_string_fail;
}
p += 3;
@@ -790,7 +790,7 @@ json_decode_string_cycle_start:
break;
case 'f':
if ((p + 4) >= e || strncmp(p + 1, "alse", 4) != 0) {
- emsgf(_("E474: Expected false: %.*s"), LENP(p, e));
+ semsg(_("E474: Expected false: %.*s"), LENP(p, e));
goto json_decode_string_fail;
}
p += 4;
@@ -874,7 +874,7 @@ json_decode_string_cycle_start:
break;
}
default:
- emsgf(_("E474: Unidentified byte: %.*s"), LENP(p, e));
+ semsg(_("E474: Unidentified byte: %.*s"), LENP(p, e));
goto json_decode_string_fail;
}
didcomma = false;
@@ -893,7 +893,7 @@ json_decode_string_after_cycle:
case CAR:
break;
default:
- emsgf(_("E474: Trailing characters: %.*s"), LENP(p, e));
+ semsg(_("E474: Trailing characters: %.*s"), LENP(p, e));
goto json_decode_string_fail;
}
}
@@ -901,7 +901,7 @@ json_decode_string_after_cycle:
*rettv = kv_pop(stack).val;
goto json_decode_string_ret;
}
- emsgf(_("E474: Unexpected end of input: %.*s"), (int)buf_len, buf);
+ semsg(_("E474: Unexpected end of input: %.*s"), (int)buf_len, buf);
json_decode_string_fail:
ret = FAIL;
while (kv_size(stack)) {
diff --git a/src/nvim/eval/encode.c b/src/nvim/eval/encode.c
index 627b4465db..b457353838 100644
--- a/src/nvim/eval/encode.c
+++ b/src/nvim/eval/encode.c
@@ -197,7 +197,7 @@ static int conv_error(const char *const msg, const MPConvStack *const mpstack,
}
}
}
- emsgf(msg, _(objname), (kv_size(*mpstack) == 0
+ semsg(msg, _(objname), (kv_size(*mpstack) == 0
? _("itself")
: (char *)msg_ga.ga_data));
ga_clear(&msg_ga);
@@ -448,7 +448,7 @@ int encode_read_from_list(ListReaderState *const state, char *const buf, const s
/* Only give this message once for a recursive call to avoid */ \
/* flooding the user with errors. */ \
did_echo_string_emsg = true; \
- EMSG(_("E724: unable to correctly dump variable " \
+ emsg(_("E724: unable to correctly dump variable " \
"with self-referencing container")); \
} \
char ebuf[NUMBUFLEN + 7]; \
@@ -528,7 +528,7 @@ int encode_read_from_list(ListReaderState *const state, char *const buf, const s
/* Only give this message once for a recursive call to avoid */ \
/* flooding the user with errors. */ \
did_echo_string_emsg = true; \
- EMSG(_("E724: unable to correctly dump variable " \
+ emsg(_("E724: unable to correctly dump variable " \
"with self-referencing container")); \
} \
} while (0)
@@ -558,11 +558,11 @@ int encode_read_from_list(ListReaderState *const state, char *const buf, const s
const float_T flt_ = (flt); \
switch (xfpclassify(flt_)) { \
case FP_NAN: { \
- EMSG(_("E474: Unable to represent NaN value in JSON")); \
+ emsg(_("E474: Unable to represent NaN value in JSON")); \
return FAIL; \
} \
case FP_INFINITE: { \
- EMSG(_("E474: Unable to represent infinity in JSON")); \
+ emsg(_("E474: Unable to represent infinity in JSON")); \
return FAIL; \
} \
default: { \
@@ -630,14 +630,14 @@ static inline int convert_to_json_string(garray_T *const gap, const char *const
break;
default:
if (ch > 0x7F && shift == 1) {
- emsgf(_("E474: String \"%.*s\" contains byte that does not start "
+ semsg(_("E474: String \"%.*s\" contains byte that does not start "
"any UTF-8 character"),
(int)(utf_len - (i - shift)), utf_buf + i - shift);
xfree(tofree);
return FAIL;
} else if ((SURROGATE_HI_START <= ch && ch <= SURROGATE_HI_END)
|| (SURROGATE_LO_START <= ch && ch <= SURROGATE_LO_END)) {
- emsgf(_("E474: UTF-8 string contains code point which belongs "
+ semsg(_("E474: UTF-8 string contains code point which belongs "
"to a surrogate pair: %.*s"),
(int)(utf_len - (i - shift)), utf_buf + i - shift);
xfree(tofree);
@@ -719,7 +719,7 @@ static inline int convert_to_json_string(garray_T *const gap, const char *const
#define TYPVAL_ENCODE_CONV_EXT_STRING(tv, buf, len, type) \
do { \
xfree(buf); \
- EMSG(_("E474: Unable to convert EXT string to JSON")); \
+ emsg(_("E474: Unable to convert EXT string to JSON")); \
return FAIL; \
} while (0)
@@ -792,7 +792,7 @@ bool encode_check_json_key(const typval_T *const tv)
#define TYPVAL_ENCODE_SPECIAL_DICT_KEY_CHECK(label, key) \
do { \
if (!encode_check_json_key(&key)) { \
- EMSG(_("E474: Invalid key in special dictionary")); \
+ emsg(_("E474: Invalid key in special dictionary")); \
goto label; \
} \
} while (0)
diff --git a/src/nvim/eval/executor.c b/src/nvim/eval/executor.c
index 8eceda84cf..ed4f36f4c7 100644
--- a/src/nvim/eval/executor.c
+++ b/src/nvim/eval/executor.c
@@ -144,6 +144,6 @@ int eexe_mod_op(typval_T *const tv1, const typval_T *const tv2, const char *cons
}
}
- EMSG2(_(e_letwrong), op);
+ semsg(_(e_letwrong), op);
return FAIL;
}
diff --git a/src/nvim/eval/funcs.c b/src/nvim/eval/funcs.c
index eb7d62d7a2..44af53b7c0 100644
--- a/src/nvim/eval/funcs.c
+++ b/src/nvim/eval/funcs.c
@@ -278,12 +278,12 @@ static void api_wrapper(typval_T *argvars, typval_T *rettv, FunPtr fptr)
Object result = fn(VIML_INTERNAL_CALL, args, &err);
if (ERROR_SET(&err)) {
- emsgf_multiline((const char *)e_api_error, err.msg);
+ semsg_multiline((const char *)e_api_error, err.msg);
goto end;
}
if (!object_to_vim(result, rettv, &err)) {
- EMSG2(_("Error converting the call result: %s"), err.msg);
+ semsg(_("Error converting the call result: %s"), err.msg);
}
end:
@@ -340,7 +340,7 @@ static void f_add(typval_T *argvars, typval_T *rettv, FunPtr fptr)
}
}
} else {
- EMSG(_(e_listblobreq));
+ emsg(_(e_listblobreq));
}
}
@@ -814,7 +814,7 @@ buf_T *get_buf_arg(typval_T *arg)
buf = tv_get_buf(arg, false);
emsg_off--;
if (buf == NULL) {
- EMSG2(_("E158: Invalid buffer name: %s"), tv_get_string(arg));
+ semsg(_("E158: Invalid buffer name: %s"), tv_get_string(arg));
}
return buf;
}
@@ -876,7 +876,7 @@ static void f_byteidxcomp(typval_T *argvars, typval_T *rettv, FunPtr fptr)
static void f_call(typval_T *argvars, typval_T *rettv, FunPtr fptr)
{
if (argvars[1].v_type != VAR_LIST) {
- EMSG(_(e_listreq));
+ emsg(_(e_listreq));
return;
}
if (argvars[1].vval.v_list == NULL) {
@@ -905,7 +905,7 @@ static void f_call(typval_T *argvars, typval_T *rettv, FunPtr fptr)
if (argvars[2].v_type != VAR_UNKNOWN) {
if (argvars[2].v_type != VAR_DICT) {
- EMSG(_(e_dictreq));
+ emsg(_(e_dictreq));
return;
}
selfdict = argvars[2].vval.v_dict;
@@ -937,7 +937,7 @@ static void f_chanclose(typval_T *argvars, typval_T *rettv, FunPtr fptr)
if (argvars[0].v_type != VAR_NUMBER || (argvars[1].v_type != VAR_STRING
&& argvars[1].v_type != VAR_UNKNOWN)) {
- EMSG(_(e_invarg));
+ emsg(_(e_invarg));
return;
}
@@ -953,14 +953,14 @@ static void f_chanclose(typval_T *argvars, typval_T *rettv, FunPtr fptr)
} else if (!strcmp(stream, "rpc")) {
part = kChannelPartRpc;
} else {
- EMSG2(_("Invalid channel stream \"%s\""), stream);
+ semsg(_("Invalid channel stream \"%s\""), stream);
return;
}
}
const char *error;
rettv->vval.v_number = channel_close(argvars[0].vval.v_number, part, &error);
if (!rettv->vval.v_number) {
- EMSG(error);
+ emsg(error);
}
}
@@ -976,7 +976,7 @@ static void f_chansend(typval_T *argvars, typval_T *rettv, FunPtr fptr)
if (argvars[0].v_type != VAR_NUMBER || argvars[1].v_type == VAR_UNKNOWN) {
// First argument is the channel id and second is the data to write
- EMSG(_(e_invarg));
+ emsg(_(e_invarg));
return;
}
@@ -1001,7 +1001,7 @@ static void f_chansend(typval_T *argvars, typval_T *rettv, FunPtr fptr)
const char *error = NULL;
rettv->vval.v_number = channel_send(id, input, input_len, true, &error);
if (error) {
- EMSG(error);
+ emsg(error);
}
}
@@ -1028,7 +1028,7 @@ static void f_charidx(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|| argvars[1].v_type != VAR_NUMBER
|| (argvars[2].v_type != VAR_UNKNOWN
&& argvars[2].v_type != VAR_NUMBER)) {
- EMSG(_(e_invarg));
+ emsg(_(e_invarg));
return;
}
@@ -1042,7 +1042,7 @@ static void f_charidx(typval_T *argvars, typval_T *rettv, FunPtr fptr)
countcc = (int)tv_get_number(&argvars[2]);
}
if (countcc < 0 || countcc > 1) {
- EMSG(_(e_invarg));
+ emsg(_(e_invarg));
return;
}
@@ -1130,7 +1130,7 @@ static win_T *get_optional_window(typval_T *argvars, int idx)
if (argvars[idx].v_type != VAR_UNKNOWN) {
win = find_win_by_nr_or_id(&argvars[idx]);
if (win == NULL) {
- EMSG(_(e_invalwindow));
+ emsg(_(e_invalwindow));
return NULL;
}
}
@@ -1196,7 +1196,7 @@ static void f_col(typval_T *argvars, typval_T *rettv, FunPtr fptr)
static void f_complete(typval_T *argvars, typval_T *rettv, FunPtr fptr)
{
if ((State & INSERT) == 0) {
- EMSG(_("E785: complete() can only be used in Insert mode"));
+ emsg(_("E785: complete() can only be used in Insert mode"));
return;
}
@@ -1207,7 +1207,7 @@ static void f_complete(typval_T *argvars, typval_T *rettv, FunPtr fptr)
}
if (argvars[1].v_type != VAR_LIST) {
- EMSG(_(e_invarg));
+ emsg(_(e_invarg));
return;
}
@@ -1249,7 +1249,7 @@ static void f_complete_info(typval_T *argvars, typval_T *rettv, FunPtr fptr)
if (argvars[0].v_type != VAR_UNKNOWN) {
if (argvars[0].v_type != VAR_LIST) {
- EMSG(_(e_listreq));
+ emsg(_(e_listreq));
return;
}
what_list = argvars[0].vval.v_list;
@@ -1372,7 +1372,7 @@ static void f_count(typval_T *argvars, typval_T *rettv, FunPtr fptr)
if (!error) {
li = tv_list_find(l, idx);
if (li == NULL) {
- EMSGN(_(e_listidx), idx);
+ semsg(_(e_listidx), (int64_t)idx);
}
}
}
@@ -1395,7 +1395,7 @@ static void f_count(typval_T *argvars, typval_T *rettv, FunPtr fptr)
if ((d = argvars[0].vval.v_dict) != NULL) {
if (argvars[2].v_type != VAR_UNKNOWN) {
if (argvars[3].v_type != VAR_UNKNOWN) {
- EMSG(_(e_invarg));
+ emsg(_(e_invarg));
}
}
@@ -1410,7 +1410,7 @@ static void f_count(typval_T *argvars, typval_T *rettv, FunPtr fptr)
}
}
} else {
- EMSG2(_(e_listdictarg), "count()");
+ semsg(_(e_listdictarg), "count()");
}
rettv->vval.v_number = n;
}
@@ -1447,13 +1447,13 @@ static void f_ctxget(typval_T *argvars, typval_T *rettv, FunPtr fptr)
if (argvars[0].v_type == VAR_NUMBER) {
index = argvars[0].vval.v_number;
} else if (argvars[0].v_type != VAR_UNKNOWN) {
- EMSG2(_(e_invarg2), "expected nothing or a Number as an argument");
+ semsg(_(e_invarg2), "expected nothing or a Number as an argument");
return;
}
Context *ctx = ctx_get(index);
if (ctx == NULL) {
- EMSG3(_(e_invargNval), "index", "out of bounds");
+ semsg(_(e_invargNval), "index", "out of bounds");
return;
}
@@ -1468,7 +1468,7 @@ static void f_ctxget(typval_T *argvars, typval_T *rettv, FunPtr fptr)
static void f_ctxpop(typval_T *argvars, typval_T *rettv, FunPtr fptr)
{
if (!ctx_restore(NULL, kCtxAll)) {
- EMSG(_("Context stack is empty"));
+ emsg(_("Context stack is empty"));
}
}
@@ -1497,7 +1497,7 @@ static void f_ctxpush(typval_T *argvars, typval_T *rettv, FunPtr fptr)
}
});
} else if (argvars[0].v_type != VAR_UNKNOWN) {
- EMSG2(_(e_invarg2), "expected nothing or a List as an argument");
+ semsg(_(e_invarg2), "expected nothing or a List as an argument");
return;
}
ctx_save(NULL, types);
@@ -1507,7 +1507,7 @@ static void f_ctxpush(typval_T *argvars, typval_T *rettv, FunPtr fptr)
static void f_ctxset(typval_T *argvars, typval_T *rettv, FunPtr fptr)
{
if (argvars[0].v_type != VAR_DICT) {
- EMSG2(_(e_invarg2), "expected dictionary as first argument");
+ semsg(_(e_invarg2), "expected dictionary as first argument");
return;
}
@@ -1515,13 +1515,13 @@ static void f_ctxset(typval_T *argvars, typval_T *rettv, FunPtr fptr)
if (argvars[1].v_type == VAR_NUMBER) {
index = argvars[1].vval.v_number;
} else if (argvars[1].v_type != VAR_UNKNOWN) {
- EMSG2(_(e_invarg2), "expected nothing or a Number as second argument");
+ semsg(_(e_invarg2), "expected nothing or a Number as second argument");
return;
}
Context *ctx = ctx_get(index);
if (ctx == NULL) {
- EMSG3(_(e_invargNval), "index", "out of bounds");
+ semsg(_(e_invargNval), "index", "out of bounds");
return;
}
@@ -1568,7 +1568,7 @@ static void f_cursor(typval_T *argvars, typval_T *rettv, FunPtr fptr)
colnr_T curswant = -1;
if (list2fpos(argvars, &pos, NULL, &curswant) == FAIL) {
- EMSG(_(e_invarg));
+ emsg(_(e_invarg));
return;
}
@@ -1615,7 +1615,7 @@ static void f_debugbreak(typval_T *argvars, typval_T *rettv, FunPtr fptr)
rettv->vval.v_number = FAIL;
pid = (int)tv_get_number(&argvars[0]);
if (pid == 0) {
- EMSG(_(e_invarg));
+ emsg(_(e_invarg));
} else {
#ifdef WIN32
HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, 0, pid);
@@ -1640,7 +1640,7 @@ static void f_deepcopy(typval_T *argvars, typval_T *rettv, FunPtr fptr)
noref = tv_get_number_chk(&argvars[1], NULL);
}
if (noref < 0 || noref > 1) {
- EMSG(_(e_invarg));
+ emsg(_(e_invarg));
} else {
var_item_copy(NULL, &argvars[0], rettv, true, (noref == 0
? get_copyID()
@@ -1658,7 +1658,7 @@ static void f_delete(typval_T *argvars, typval_T *rettv, FunPtr fptr)
const char *const name = tv_get_string(&argvars[0]);
if (*name == NUL) {
- EMSG(_(e_invarg));
+ emsg(_(e_invarg));
return;
}
@@ -1680,7 +1680,7 @@ static void f_delete(typval_T *argvars, typval_T *rettv, FunPtr fptr)
// delete a directory recursively
rettv->vval.v_number = delete_recursive(name);
} else {
- emsgf(_(e_invexpr2), flags);
+ semsg(_(e_invexpr2), flags);
}
}
@@ -1692,17 +1692,17 @@ static void f_dictwatcheradd(typval_T *argvars, typval_T *rettv, FunPtr fptr)
}
if (argvars[0].v_type != VAR_DICT) {
- emsgf(_(e_invarg2), "dict");
+ semsg(_(e_invarg2), "dict");
return;
} else if (argvars[0].vval.v_dict == NULL) {
const char *const arg_errmsg = _("dictwatcheradd() argument");
const size_t arg_errmsg_len = strlen(arg_errmsg);
- emsgf(_(e_readonlyvar), (int)arg_errmsg_len, arg_errmsg);
+ semsg(_(e_readonlyvar), (int)arg_errmsg_len, arg_errmsg);
return;
}
if (argvars[1].v_type != VAR_STRING && argvars[1].v_type != VAR_NUMBER) {
- emsgf(_(e_invarg2), "key");
+ semsg(_(e_invarg2), "key");
return;
}
@@ -1714,7 +1714,7 @@ static void f_dictwatcheradd(typval_T *argvars, typval_T *rettv, FunPtr fptr)
Callback callback;
if (!callback_from_typval(&callback, &argvars[2])) {
- emsgf(_(e_invarg2), "funcref");
+ semsg(_(e_invarg2), "funcref");
return;
}
@@ -1730,12 +1730,12 @@ static void f_dictwatcherdel(typval_T *argvars, typval_T *rettv, FunPtr fptr)
}
if (argvars[0].v_type != VAR_DICT) {
- emsgf(_(e_invarg2), "dict");
+ semsg(_(e_invarg2), "dict");
return;
}
if (argvars[2].v_type != VAR_FUNC && argvars[2].v_type != VAR_STRING) {
- emsgf(_(e_invarg2), "funcref");
+ semsg(_(e_invarg2), "funcref");
return;
}
@@ -1751,7 +1751,7 @@ static void f_dictwatcherdel(typval_T *argvars, typval_T *rettv, FunPtr fptr)
if (!tv_dict_watcher_remove(argvars[0].vval.v_dict, key_pattern,
strlen(key_pattern), callback)) {
- EMSG("Couldn't find a watcher matching key and callback");
+ emsg("Couldn't find a watcher matching key and callback");
}
callback_free(&callback);
@@ -2039,13 +2039,13 @@ static void f_eval(typval_T *argvars, typval_T *rettv, FunPtr fptr)
const char *const expr_start = s;
if (s == NULL || eval1((char_u **)&s, rettv, true) == FAIL) {
if (expr_start != NULL && !aborting()) {
- EMSG2(_(e_invexpr2), expr_start);
+ semsg(_(e_invexpr2), expr_start);
}
need_clr_eos = false;
rettv->v_type = VAR_NUMBER;
rettv->vval.v_number = 0;
} else if (*s != NUL) {
- EMSG(_(e_trailing));
+ emsg(_(e_trailing));
}
}
@@ -2263,7 +2263,7 @@ static void f_exists(typval_T *argvars, typval_T *rettv, FunPtr fptr)
static void f_expand(typval_T *argvars, typval_T *rettv, FunPtr fptr)
{
size_t len;
- char_u *errormsg;
+ char *errormsg;
int options = WILD_SILENT|WILD_USE_NL|WILD_LIST_NOTFOUND;
expand_T xpc;
bool error = false;
@@ -2348,7 +2348,7 @@ static void f_menu_get(typval_T *argvars, typval_T *rettv, FunPtr fptr)
// Expand all the special characters in a command string.
static void f_expandcmd(typval_T *argvars, typval_T *rettv, FunPtr fptr)
{
- char_u *errormsg = NULL;
+ char *errormsg = NULL;
rettv->v_type = VAR_STRING;
char_u *cmdstr = (char_u *)xstrdup(tv_get_string(&argvars[0]));
@@ -2364,7 +2364,7 @@ static void f_expandcmd(typval_T *argvars, typval_T *rettv, FunPtr fptr)
expand_filename(&eap, &cmdstr, &errormsg);
if (errormsg != NULL && *errormsg != NUL) {
- EMSG(errormsg);
+ emsg(errormsg);
}
rettv->vval.v_string = cmdstr;
}
@@ -2378,7 +2378,7 @@ static void f_flatten(typval_T *argvars, typval_T *rettv, FunPtr fptr)
bool error = false;
if (argvars[0].v_type != VAR_LIST) {
- EMSG2(_(e_listarg), "flatten()");
+ semsg(_(e_listarg), "flatten()");
return;
}
@@ -2390,7 +2390,7 @@ static void f_flatten(typval_T *argvars, typval_T *rettv, FunPtr fptr)
return;
}
if (maxdepth < 0) {
- EMSG(_("E900: maxdepth must be non-negative number"));
+ emsg(_("E900: maxdepth must be non-negative number"));
return;
}
}
@@ -2432,7 +2432,7 @@ static void f_extend(typval_T *argvars, typval_T *rettv, FunPtr fptr)
} else {
item = tv_list_find(l1, before);
if (item == NULL) {
- EMSGN(_(e_listidx), before);
+ semsg(_(e_listidx), (int64_t)before);
return;
}
}
@@ -2471,7 +2471,7 @@ static void f_extend(typval_T *argvars, typval_T *rettv, FunPtr fptr)
}
}
if (i == 3) {
- EMSG2(_(e_invarg2), action);
+ semsg(_(e_invarg2), action);
return;
}
}
@@ -2481,7 +2481,7 @@ static void f_extend(typval_T *argvars, typval_T *rettv, FunPtr fptr)
tv_copy(&argvars[0], rettv);
}
} else {
- EMSG2(_(e_listdictarg), "extend()");
+ semsg(_(e_listdictarg), "extend()");
}
}
@@ -2928,7 +2928,7 @@ static void f_get(typval_T *argvars, typval_T *rettv, FunPtr fptr)
tv_list_append_tv(rettv->vval.v_list, &pt->pt_argv[i]);
}
} else {
- EMSG2(_(e_invarg2), what);
+ semsg(_(e_invarg2), what);
}
// When {what} == "dict" and pt->pt_dict == NULL, evaluate the
@@ -2938,7 +2938,7 @@ static void f_get(typval_T *argvars, typval_T *rettv, FunPtr fptr)
}
}
} else {
- EMSG2(_(e_listdictblobarg), "get()");
+ semsg(_(e_listdictblobarg), "get()");
}
if (tv == NULL) {
@@ -3364,7 +3364,7 @@ static void f_getcompletion(typval_T *argvars, typval_T *rettv, FunPtr fptr)
| WILD_NO_BEEP | WILD_HOME_REPLACE;
if (argvars[1].v_type != VAR_STRING) {
- EMSG2(_(e_invarg2), "type must be a string");
+ semsg(_(e_invarg2), "type must be a string");
return;
}
const char *const type = tv_get_string(&argvars[1]);
@@ -3383,7 +3383,7 @@ static void f_getcompletion(typval_T *argvars, typval_T *rettv, FunPtr fptr)
}
if (argvars[0].v_type != VAR_STRING) {
- EMSG(_(e_invarg));
+ emsg(_(e_invarg));
return;
}
@@ -3398,7 +3398,7 @@ static void f_getcompletion(typval_T *argvars, typval_T *rettv, FunPtr fptr)
xpc.xp_pattern_len = STRLEN(xpc.xp_pattern);
xpc.xp_context = cmdcomplete_str_to_type(type);
if (xpc.xp_context == EXPAND_NOTHING) {
- EMSG2(_(e_invarg2), type);
+ semsg(_(e_invarg2), type);
return;
}
@@ -3467,13 +3467,13 @@ static void f_getcwd(typval_T *argvars, typval_T *rettv, FunPtr fptr)
break;
}
if (argvars[i].v_type != VAR_NUMBER) {
- EMSG(_(e_invarg));
+ emsg(_(e_invarg));
return;
}
scope_number[i] = argvars[i].vval.v_number;
// It is an error for the scope number to be less than `-1`.
if (scope_number[i] < -1) {
- EMSG(_(e_invarg));
+ emsg(_(e_invarg));
return;
}
// Use the narrowest scope the user requested
@@ -3494,7 +3494,7 @@ static void f_getcwd(typval_T *argvars, typval_T *rettv, FunPtr fptr)
if (scope_number[kCdScopeTabpage] > 0) {
tp = find_tabpage(scope_number[kCdScopeTabpage]);
if (!tp) {
- EMSG(_("E5000: Cannot find tab number."));
+ emsg(_("E5000: Cannot find tab number."));
return;
}
}
@@ -3502,14 +3502,14 @@ static void f_getcwd(typval_T *argvars, typval_T *rettv, FunPtr fptr)
// Find the window in `tp` by number, `NULL` if none.
if (scope_number[kCdScopeWindow] >= 0) {
if (scope_number[kCdScopeTabpage] < 0) {
- EMSG(_("E5001: Higher scope cannot be -1 if lower scope is >= 0."));
+ emsg(_("E5001: Higher scope cannot be -1 if lower scope is >= 0."));
return;
}
if (scope_number[kCdScopeWindow] > 0) {
win = find_win_by_nr(&argvars[0], tp);
if (!win) {
- EMSG(_("E5002: Cannot find window number."));
+ emsg(_("E5002: Cannot find window number."));
return;
}
}
@@ -4150,12 +4150,12 @@ static void f_wait(typval_T *argvars, typval_T *rettv, FunPtr fptr)
rettv->vval.v_number = -1;
if (argvars[0].v_type != VAR_NUMBER) {
- EMSG2(_(e_invargval), "1");
+ semsg(_(e_invargval), "1");
return;
}
if ((argvars[2].v_type != VAR_NUMBER && argvars[2].v_type != VAR_UNKNOWN)
|| (argvars[2].v_type == VAR_NUMBER && argvars[2].vval.v_number <= 0)) {
- EMSG2(_(e_invargval), "3");
+ semsg(_(e_invargval), "3");
return;
}
@@ -4262,7 +4262,7 @@ static void f_win_splitmove(typval_T *argvars, typval_T *rettv, FunPtr fptr)
if (wp == NULL || targetwin == NULL || wp == targetwin
|| !win_valid(wp) || !win_valid(targetwin)
|| win_valid_floating(wp) || win_valid_floating(targetwin)) {
- EMSG(_(e_invalwindow));
+ emsg(_(e_invalwindow));
rettv->vval.v_number = -1;
return;
}
@@ -4272,7 +4272,7 @@ static void f_win_splitmove(typval_T *argvars, typval_T *rettv, FunPtr fptr)
dictitem_T *di;
if (argvars[2].v_type != VAR_DICT || argvars[2].vval.v_dict == NULL) {
- EMSG(_(e_invarg));
+ emsg(_(e_invarg));
return;
}
@@ -4636,7 +4636,7 @@ static bool has_wsl(void)
static void f_has_key(typval_T *argvars, typval_T *rettv, FunPtr fptr)
{
if (argvars[0].v_type != VAR_DICT) {
- EMSG(_(e_dictreq));
+ emsg(_(e_dictreq));
return;
}
if (argvars[0].vval.v_dict == NULL) {
@@ -4683,12 +4683,12 @@ static void f_haslocaldir(typval_T *argvars, typval_T *rettv, FunPtr fptr)
break;
}
if (argvars[i].v_type != VAR_NUMBER) {
- EMSG(_(e_invarg));
+ emsg(_(e_invarg));
return;
}
scope_number[i] = argvars[i].vval.v_number;
if (scope_number[i] < -1) {
- EMSG(_(e_invarg));
+ emsg(_(e_invarg));
return;
}
// Use the narrowest scope the user requested
@@ -4709,7 +4709,7 @@ static void f_haslocaldir(typval_T *argvars, typval_T *rettv, FunPtr fptr)
if (scope_number[kCdScopeTabpage] > 0) {
tp = find_tabpage(scope_number[kCdScopeTabpage]);
if (!tp) {
- EMSG(_("E5000: Cannot find tab number."));
+ emsg(_("E5000: Cannot find tab number."));
return;
}
}
@@ -4717,14 +4717,14 @@ static void f_haslocaldir(typval_T *argvars, typval_T *rettv, FunPtr fptr)
// Find the window in `tp` by number, `NULL` if none.
if (scope_number[kCdScopeWindow] >= 0) {
if (scope_number[kCdScopeTabpage] < 0) {
- EMSG(_("E5001: Higher scope cannot be -1 if lower scope is >= 0."));
+ emsg(_("E5001: Higher scope cannot be -1 if lower scope is >= 0."));
return;
}
if (scope_number[kCdScopeWindow] > 0) {
win = find_win_by_nr(&argvars[0], tp);
if (!win) {
- EMSG(_("E5002: Cannot find window number."));
+ emsg(_("E5002: Cannot find window number."));
return;
}
}
@@ -4973,7 +4973,7 @@ static void f_index(typval_T *argvars, typval_T *rettv, FunPtr fptr)
}
return;
} else if (argvars[0].v_type != VAR_LIST) {
- EMSG(_(e_listblobreq));
+ emsg(_(e_listblobreq));
return;
}
list_T *const l = argvars[0].vval.v_list;
@@ -5035,7 +5035,7 @@ static void f_inputlist(typval_T *argvars, typval_T *rettv, FunPtr fptr)
int mouse_used;
if (argvars[0].v_type != VAR_LIST) {
- EMSG2(_(e_listarg), "inputlist()");
+ semsg(_(e_listarg), "inputlist()");
return;
}
@@ -5120,7 +5120,7 @@ static void f_insert(typval_T *argvars, typval_T *rettv, FunPtr fptr)
return; // type error; errmsg already given
}
if (before < 0 || before > len) {
- EMSG2(_(e_invarg2), tv_get_string(&argvars[2]));
+ semsg(_(e_invarg2), tv_get_string(&argvars[2]));
return;
}
}
@@ -5129,7 +5129,7 @@ static void f_insert(typval_T *argvars, typval_T *rettv, FunPtr fptr)
return;
}
if (val < 0 || val > 255) {
- EMSG2(_(e_invarg2), tv_get_string(&argvars[1]));
+ semsg(_(e_invarg2), tv_get_string(&argvars[1]));
return;
}
@@ -5141,7 +5141,7 @@ static void f_insert(typval_T *argvars, typval_T *rettv, FunPtr fptr)
tv_copy(&argvars[0], rettv);
} else if (argvars[0].v_type != VAR_LIST) {
- EMSG2(_(e_listblobarg), "insert()");
+ semsg(_(e_listblobarg), "insert()");
} else if (!var_check_lock(tv_list_locked((l = argvars[0].vval.v_list)),
N_("insert() argument"), TV_TRANSLATE)) {
long before = 0;
@@ -5157,7 +5157,7 @@ static void f_insert(typval_T *argvars, typval_T *rettv, FunPtr fptr)
if (before != tv_list_len(l)) {
item = tv_list_find(l, before);
if (item == NULL) {
- EMSGN(_(e_listidx), before);
+ semsg(_(e_listidx), (int64_t)before);
l = NULL;
}
}
@@ -5207,7 +5207,7 @@ static void f_islocked(typval_T *argvars, typval_T *rettv, FunPtr fptr)
FNE_CHECK_START);
if (end != NULL && lv.ll_name != NULL) {
if (*end != NUL) {
- EMSG(_(e_trailing));
+ emsg(_(e_trailing));
} else {
if (lv.ll_tv == NULL) {
di = find_var(lv.ll_name, lv.ll_name_len, NULL, true);
@@ -5220,9 +5220,9 @@ static void f_islocked(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|| tv_islocked(&di->di_tv));
}
} else if (lv.ll_range) {
- EMSG(_("E786: Range not allowed"));
+ emsg(_("E786: Range not allowed"));
} else if (lv.ll_newkey != NULL) {
- EMSG2(_(e_dictkey), lv.ll_newkey);
+ semsg(_(e_dictkey), lv.ll_newkey);
} else if (lv.ll_list != NULL) {
// List item.
rettv->vval.v_number = tv_islocked(TV_LIST_ITEM_TV(lv.ll_li));
@@ -5282,7 +5282,7 @@ static void f_jobpid(typval_T *argvars, typval_T *rettv, FunPtr fptr)
}
if (argvars[0].v_type != VAR_NUMBER) {
- EMSG(_(e_invarg));
+ emsg(_(e_invarg));
return;
}
@@ -5308,7 +5308,7 @@ static void f_jobresize(typval_T *argvars, typval_T *rettv, FunPtr fptr)
if (argvars[0].v_type != VAR_NUMBER || argvars[1].v_type != VAR_NUMBER
|| argvars[2].v_type != VAR_NUMBER) {
// job id, width, height
- EMSG(_(e_invarg));
+ emsg(_(e_invarg));
return;
}
@@ -5319,7 +5319,7 @@ static void f_jobresize(typval_T *argvars, typval_T *rettv, FunPtr fptr)
}
if (data->stream.proc.type != kProcessTypePty) {
- EMSG(_(e_channotpty));
+ emsg(_(e_channotpty));
return;
}
@@ -5462,7 +5462,7 @@ static void f_jobstart(typval_T *argvars, typval_T *rettv, FunPtr fptr)
if (argvars[1].v_type != VAR_DICT && argvars[1].v_type != VAR_UNKNOWN) {
// Wrong argument types
- EMSG2(_(e_invarg2), "expected dictionary");
+ semsg(_(e_invarg2), "expected dictionary");
shell_free_argv(argv);
return;
}
@@ -5496,19 +5496,19 @@ static void f_jobstart(typval_T *argvars, typval_T *rettv, FunPtr fptr)
} else if (!strncmp(s, "pipe", NUMBUFLEN)) {
// Nothing to do, default value
} else {
- EMSG3(_(e_invargNval), "stdin", s);
+ semsg(_(e_invargNval), "stdin", s);
}
}
if (pty && rpc) {
- EMSG2(_(e_invarg2), "job cannot have both 'pty' and 'rpc' options set");
+ semsg(_(e_invarg2), "job cannot have both 'pty' and 'rpc' options set");
shell_free_argv(argv);
return;
}
#ifdef WIN32
if (pty && overlapped) {
- EMSG2(_(e_invarg2),
+ semsg(_(e_invarg2),
"job cannot have both 'pty' and 'overlapped' options set");
shell_free_argv(argv);
return;
@@ -5520,7 +5520,7 @@ static void f_jobstart(typval_T *argvars, typval_T *rettv, FunPtr fptr)
cwd = new_cwd;
// The new cwd must be a directory.
if (!os_isdir_executable((const char *)cwd)) {
- EMSG2(_(e_invarg2), "expected valid directory");
+ semsg(_(e_invarg2), "expected valid directory");
shell_free_argv(argv);
return;
}
@@ -5528,7 +5528,7 @@ static void f_jobstart(typval_T *argvars, typval_T *rettv, FunPtr fptr)
job_env = tv_dict_find(job_opts, S_LEN("env"));
if (job_env && job_env->di_tv.v_type != VAR_DICT) {
- EMSG2(_(e_invarg2), "env");
+ semsg(_(e_invarg2), "env");
shell_free_argv(argv);
return;
}
@@ -5575,7 +5575,7 @@ static void f_jobstop(typval_T *argvars, typval_T *rettv, FunPtr fptr)
if (argvars[0].v_type != VAR_NUMBER) {
// Only argument is the job id
- EMSG(_(e_invarg));
+ emsg(_(e_invarg));
return;
}
@@ -5592,7 +5592,7 @@ static void f_jobstop(typval_T *argvars, typval_T *rettv, FunPtr fptr)
process_stop(&data->stream.proc);
rettv->vval.v_number = 1;
if (error) {
- EMSG(error);
+ emsg(error);
}
}
@@ -5607,7 +5607,7 @@ static void f_jobwait(typval_T *argvars, typval_T *rettv, FunPtr fptr)
}
if (argvars[0].v_type != VAR_LIST || (argvars[1].v_type != VAR_NUMBER
&& argvars[1].v_type != VAR_UNKNOWN)) {
- EMSG(_(e_invarg));
+ emsg(_(e_invarg));
return;
}
@@ -5701,7 +5701,7 @@ static void f_jobwait(typval_T *argvars, typval_T *rettv, FunPtr fptr)
static void f_join(typval_T *argvars, typval_T *rettv, FunPtr fptr)
{
if (argvars[0].v_type != VAR_LIST) {
- EMSG(_(e_listreq));
+ emsg(_(e_listreq));
return;
}
const char *const sep = (argvars[1].v_type == VAR_UNKNOWN
@@ -5730,7 +5730,7 @@ static void f_json_decode(typval_T *argvars, typval_T *rettv, FunPtr fptr)
size_t len;
if (argvars[0].v_type == VAR_LIST) {
if (!encode_vim_list_to_buf(argvars[0].vval.v_list, &len, &tofree)) {
- EMSG(_("E474: Failed to convert list to string"));
+ emsg(_("E474: Failed to convert list to string"));
return;
}
s = tofree;
@@ -5747,7 +5747,7 @@ static void f_json_decode(typval_T *argvars, typval_T *rettv, FunPtr fptr)
}
}
if (json_decode_string(s, len, rettv) == FAIL) {
- emsgf(_("E474: Failed to parse %.*s"), (int)len, s);
+ semsg(_("E474: Failed to parse %.*s"), (int)len, s);
rettv->v_type = VAR_NUMBER;
rettv->vval.v_number = 0;
}
@@ -5811,7 +5811,7 @@ static void f_len(typval_T *argvars, typval_T *rettv, FunPtr fptr)
case VAR_FLOAT:
case VAR_PARTIAL:
case VAR_FUNC:
- EMSG(_("E701: Invalid type for len()"));
+ emsg(_("E701: Invalid type for len()"));
break;
}
}
@@ -5852,7 +5852,7 @@ static void libcall_common(typval_T *argvars, typval_T *rettv, int out_type)
str_out, &int_out);
if (!success) {
- EMSG2(_(e_libcall), funcname);
+ semsg(_(e_libcall), funcname);
return;
}
@@ -5950,7 +5950,7 @@ static void f_list2str(typval_T *argvars, typval_T *rettv, FunPtr fptr)
rettv->v_type = VAR_STRING;
rettv->vval.v_string = NULL;
if (argvars[0].v_type != VAR_LIST) {
- EMSG(_(e_invarg));
+ emsg(_(e_invarg));
return;
}
@@ -6338,7 +6338,7 @@ static void f_matchadd(typval_T *argvars, typval_T *rettv, FunPtr fptr)
return;
}
if (id >= 1 && id <= 3) {
- EMSGN(_("E798: ID is reserved for \":match\": %" PRId64), id);
+ semsg(_("E798: ID is reserved for \":match\": %" PRId64), (int64_t)id);
return;
}
@@ -6356,7 +6356,7 @@ static void f_matchaddpos(typval_T *argvars, typval_T *rettv, FunPtr fptr)
}
if (argvars[1].v_type != VAR_LIST) {
- EMSG2(_(e_listarg), "matchaddpos()");
+ semsg(_(e_listarg), "matchaddpos()");
return;
}
@@ -6388,7 +6388,7 @@ static void f_matchaddpos(typval_T *argvars, typval_T *rettv, FunPtr fptr)
// id == 3 is ok because matchaddpos() is supposed to substitute :3match
if (id == 1 || id == 2) {
- EMSGN(_("E798: ID is reserved for \"match\": %" PRId64), id);
+ semsg(_("E798: ID is reserved for \"match\": %" PRId64), (int64_t)id);
return;
}
@@ -6507,7 +6507,7 @@ static void max_min(const typval_T *const tv, typval_T *const rettv, const bool
}
});
} else {
- EMSG2(_(e_listdictarg), domax ? "max()" : "min()");
+ semsg(_(e_listdictarg), domax ? "max()" : "min()");
return;
}
rettv->vval.v_number = n;
@@ -6563,7 +6563,7 @@ static void f_mkdir(typval_T *argvars, typval_T *rettv, FunPtr fptr)
char *failed_dir;
int ret = os_mkdir_recurse(dir, prot, &failed_dir);
if (ret != 0) {
- EMSG3(_(e_mkdir), failed_dir, os_strerror(ret));
+ semsg(_(e_mkdir), failed_dir, os_strerror(ret));
xfree(failed_dir);
rettv->vval.v_number = FAIL;
return;
@@ -6596,7 +6596,7 @@ static void f_msgpackdump(typval_T *argvars, typval_T *rettv, FunPtr fptr)
FUNC_ATTR_NONNULL_ALL
{
if (argvars[0].v_type != VAR_LIST) {
- EMSG2(_(e_listarg), "msgpackdump()");
+ semsg(_(e_listarg), "msgpackdump()");
return;
}
list_T *const list = argvars[0].vval.v_list;
@@ -6629,21 +6629,21 @@ static int msgpackparse_convert_item(const msgpack_object data, const msgpack_un
{
switch (result) {
case MSGPACK_UNPACK_PARSE_ERROR:
- EMSG2(_(e_invarg2), "Failed to parse msgpack string");
+ semsg(_(e_invarg2), "Failed to parse msgpack string");
return FAIL;
case MSGPACK_UNPACK_NOMEM_ERROR:
- EMSG(_(e_outofmem));
+ emsg(_(e_outofmem));
return FAIL;
case MSGPACK_UNPACK_CONTINUE:
if (fail_if_incomplete) {
- EMSG2(_(e_invarg2), "Incomplete msgpack string");
+ semsg(_(e_invarg2), "Incomplete msgpack string");
return FAIL;
}
return NOTDONE;
case MSGPACK_UNPACK_SUCCESS: {
typval_T tv = { .v_type = VAR_UNKNOWN };
if (msgpack_to_vim(data, &tv) == FAIL) {
- EMSG2(_(e_invarg2), "Failed to convert msgpack string");
+ semsg(_(e_invarg2), "Failed to convert msgpack string");
return FAIL;
}
tv_list_append_owned_tv(ret_list, tv);
@@ -6661,27 +6661,27 @@ static void msgpackparse_unpack_list(const list_T *const list, list_T *const ret
return;
}
if (TV_LIST_ITEM_TV(tv_list_first(list))->v_type != VAR_STRING) {
- EMSG2(_(e_invarg2), "List item is not a string");
+ semsg(_(e_invarg2), "List item is not a string");
return;
}
ListReaderState lrstate = encode_init_lrstate(list);
msgpack_unpacker *const unpacker = msgpack_unpacker_new(IOSIZE);
if (unpacker == NULL) {
- EMSG(_(e_outofmem));
+ emsg(_(e_outofmem));
return;
}
msgpack_unpacked unpacked;
msgpack_unpacked_init(&unpacked);
do {
if (!msgpack_unpacker_reserve_buffer(unpacker, IOSIZE)) {
- EMSG(_(e_outofmem));
+ emsg(_(e_outofmem));
goto end;
}
size_t read_bytes;
const int rlret = encode_read_from_list(&lrstate, msgpack_unpacker_buffer(unpacker), IOSIZE,
&read_bytes);
if (rlret == FAIL) {
- EMSG2(_(e_invarg2), "List item is not a string");
+ semsg(_(e_invarg2), "List item is not a string");
goto end;
}
msgpack_unpacker_buffer_consumed(unpacker, read_bytes);
@@ -6735,7 +6735,7 @@ static void f_msgpackparse(typval_T *argvars, typval_T *rettv, FunPtr fptr)
FUNC_ATTR_NONNULL_ALL
{
if (argvars[0].v_type != VAR_LIST && argvars[0].v_type != VAR_BLOB) {
- EMSG2(_(e_listblobarg), "msgpackparse()");
+ semsg(_(e_listblobarg), "msgpackparse()");
return;
}
list_T *const ret_list = tv_list_alloc_ret(rettv, kListLenMayKnow);
@@ -6782,11 +6782,11 @@ static void f_nr2char(typval_T *argvars, typval_T *rettv, FunPtr fptr)
return;
}
if (num < 0) {
- EMSG(_("E5070: Character number must not be less than zero"));
+ emsg(_("E5070: Character number must not be less than zero"));
return;
}
if (num > INT_MAX) {
- emsgf(_("E5071: Character number must not be greater than INT_MAX (%i)"),
+ semsg(_("E5071: Character number must not be greater than INT_MAX (%i)"),
INT_MAX);
return;
}
@@ -7048,9 +7048,9 @@ static void f_range(typval_T *argvars, typval_T *rettv, FunPtr fptr)
return; // Type error; errmsg already given.
}
if (stride == 0) {
- EMSG(_("E726: Stride is zero"));
+ emsg(_("E726: Stride is zero"));
} else if (stride > 0 ? end + 1 < start : end - 1 > start) {
- EMSG(_("E727: Start past end"));
+ emsg(_("E727: Start past end"));
} else {
tv_list_alloc_ret(rettv, (end - start) / stride);
for (i = start; stride > 0 ? i <= end : i >= end; i += stride) {
@@ -7178,18 +7178,18 @@ static void f_readfile(typval_T *argvars, typval_T *rettv, FunPtr fptr)
const char *const fname = tv_get_string(&argvars[0]);
if (os_isdir((const char_u *)fname)) {
- EMSG2(_(e_isadir2), fname);
+ semsg(_(e_isadir2), fname);
return;
}
if (*fname == NUL || (fd = os_fopen(fname, READBIN)) == NULL) {
- EMSG2(_(e_notopen), *fname == NUL ? _("<empty>") : fname);
+ semsg(_(e_notopen), *fname == NUL ? _("<empty>") : fname);
return;
}
if (blob) {
tv_blob_alloc_ret(rettv);
if (!read_blob(fd, rettv->vval.v_blob)) {
- EMSG2(_(e_notread), fname);
+ semsg(_(e_notread), fname);
// An empty blob is returned on error.
tv_blob_free(rettv->vval.v_blob);
rettv->vval.v_blob = NULL;
@@ -7507,14 +7507,14 @@ static void f_remove(typval_T *argvars, typval_T *rettv, FunPtr fptr)
if (argvars[0].v_type == VAR_DICT) {
if (argvars[2].v_type != VAR_UNKNOWN) {
- EMSG2(_(e_toomanyarg), "remove()");
+ semsg(_(e_toomanyarg), "remove()");
} else if ((d = argvars[0].vval.v_dict) != NULL
&& !var_check_lock(d->dv_lock, arg_errmsg, TV_TRANSLATE)) {
const char *key = tv_get_string_chk(&argvars[1]);
if (key != NULL) {
di = tv_dict_find(d, key, -1);
if (di == NULL) {
- EMSG2(_(e_dictkey), key);
+ semsg(_(e_dictkey), key);
} else if (!var_check_fixed(di->di_flags, arg_errmsg, TV_TRANSLATE)
&& !var_check_ro(di->di_flags, arg_errmsg, TV_TRANSLATE)) {
*rettv = di->di_tv;
@@ -7544,7 +7544,7 @@ static void f_remove(typval_T *argvars, typval_T *rettv, FunPtr fptr)
idx = len + idx;
}
if (idx < 0 || idx >= len) {
- EMSGN(_(e_blobidx), idx);
+ semsg(_(e_blobidx), (int64_t)idx);
return;
}
if (argvars[2].v_type == VAR_UNKNOWN) {
@@ -7564,7 +7564,7 @@ static void f_remove(typval_T *argvars, typval_T *rettv, FunPtr fptr)
end = len + end;
}
if (end >= len || idx > end) {
- EMSGN(_(e_blobidx), end);
+ semsg(_(e_blobidx), (int64_t)end);
return;
}
blob_T *const blob = tv_blob_alloc();
@@ -7583,7 +7583,7 @@ static void f_remove(typval_T *argvars, typval_T *rettv, FunPtr fptr)
}
}
} else if (argvars[0].v_type != VAR_LIST) {
- EMSG2(_(e_listdictblobarg), "remove()");
+ semsg(_(e_listdictblobarg), "remove()");
} else if (!var_check_lock(tv_list_locked((l = argvars[0].vval.v_list)),
arg_errmsg, TV_TRANSLATE)) {
bool error = false;
@@ -7592,7 +7592,7 @@ static void f_remove(typval_T *argvars, typval_T *rettv, FunPtr fptr)
if (error) {
// Type error: do nothing, errmsg already given.
} else if ((item = tv_list_find(l, idx)) == NULL) {
- EMSGN(_(e_listidx), idx);
+ semsg(_(e_listidx), (int64_t)idx);
} else {
if (argvars[2].v_type == VAR_UNKNOWN) {
// Remove one item, return its value.
@@ -7605,7 +7605,7 @@ static void f_remove(typval_T *argvars, typval_T *rettv, FunPtr fptr)
if (error) {
// Type error: do nothing.
} else if ((item2 = tv_list_find(l, end)) == NULL) {
- EMSGN(_(e_listidx), end);
+ semsg(_(e_listidx), (int64_t)end);
} else {
int cnt = 0;
@@ -7616,7 +7616,7 @@ static void f_remove(typval_T *argvars, typval_T *rettv, FunPtr fptr)
}
}
if (li == NULL) { // Didn't find "item2" after "item".
- EMSG(_(e_invrange));
+ emsg(_(e_invrange));
} else {
tv_list_move_items(l, item, item2, tv_list_alloc_ret(rettv, cnt),
cnt);
@@ -7738,7 +7738,7 @@ static void f_resolve(typval_T *argvars, typval_T *rettv, FunPtr fptr)
if (limit-- == 0) {
xfree(p);
xfree(remain);
- EMSG(_("E655: Too many symbolic links (cycle?)"));
+ emsg(_("E655: Too many symbolic links (cycle?)"));
rettv->vval.v_string = NULL;
xfree(buf);
return;
@@ -7867,7 +7867,7 @@ static void f_reverse(typval_T *argvars, typval_T *rettv, FunPtr fptr)
}
tv_blob_set_ret(rettv, b);
} else if (argvars[0].v_type != VAR_LIST) {
- EMSG2(_(e_listblobarg), "reverse()");
+ semsg(_(e_listblobarg), "reverse()");
} else {
list_T *const l = argvars[0].vval.v_list;
if (!var_check_lock(tv_list_locked(l), N_("reverse() argument"),
@@ -7934,7 +7934,7 @@ static int get_search_arg(typval_T *varp, int *flagsp)
}
}
if (mask == 0) {
- emsgf(_(e_invarg2), flags);
+ semsg(_(e_invarg2), flags);
dir = 0;
} else {
*flagsp |= mask;
@@ -8006,7 +8006,7 @@ static int search_cmn(typval_T *argvars, pos_T *match_pos, int *flagsp)
*/
if (((flags & (SP_REPEAT | SP_RETCOUNT)) != 0)
|| ((flags & SP_NOMOVE) && (flags & SP_SETPCMARK))) {
- EMSG2(_(e_invarg2), tv_get_string(&argvars[1]));
+ semsg(_(e_invarg2), tv_get_string(&argvars[1]));
goto theend;
}
@@ -8059,12 +8059,12 @@ static void f_rpcnotify(typval_T *argvars, typval_T *rettv, FunPtr fptr)
}
if (argvars[0].v_type != VAR_NUMBER || argvars[0].vval.v_number < 0) {
- EMSG2(_(e_invarg2), "Channel id must be a positive integer");
+ semsg(_(e_invarg2), "Channel id must be a positive integer");
return;
}
if (argvars[1].v_type != VAR_STRING) {
- EMSG2(_(e_invarg2), "Event type must be a string");
+ semsg(_(e_invarg2), "Event type must be a string");
return;
}
@@ -8076,7 +8076,7 @@ static void f_rpcnotify(typval_T *argvars, typval_T *rettv, FunPtr fptr)
if (!rpc_send_event((uint64_t)argvars[0].vval.v_number,
tv_get_string(&argvars[1]), args)) {
- EMSG2(_(e_invarg2), "Channel doesn't exist");
+ semsg(_(e_invarg2), "Channel doesn't exist");
return;
}
@@ -8095,12 +8095,12 @@ static void f_rpcrequest(typval_T *argvars, typval_T *rettv, FunPtr fptr)
}
if (argvars[0].v_type != VAR_NUMBER || argvars[0].vval.v_number <= 0) {
- EMSG2(_(e_invarg2), "Channel id must be a positive integer");
+ semsg(_(e_invarg2), "Channel id must be a positive integer");
return;
}
if (argvars[1].v_type != VAR_STRING) {
- EMSG2(_(e_invarg2), "Method name must be a string");
+ semsg(_(e_invarg2), "Method name must be a string");
return;
}
@@ -8162,10 +8162,10 @@ static void f_rpcrequest(typval_T *argvars, typval_T *rettv, FunPtr fptr)
}
msg_ext_set_kind("rpc_error");
if (name) {
- emsgf_multiline("Error invoking '%s' on channel %" PRIu64 " (%s):\n%s",
+ semsg_multiline("Error invoking '%s' on channel %" PRIu64 " (%s):\n%s",
method, chan_id, name, err.msg);
} else {
- emsgf_multiline("Error invoking '%s' on channel %" PRIu64 ":\n%s",
+ semsg_multiline("Error invoking '%s' on channel %" PRIu64 ":\n%s",
method, chan_id, err.msg);
}
@@ -8173,7 +8173,7 @@ static void f_rpcrequest(typval_T *argvars, typval_T *rettv, FunPtr fptr)
}
if (!object_to_vim(result, rettv, &err)) {
- EMSG2(_("Error converting the call result: %s"), err.msg);
+ semsg(_("Error converting the call result: %s"), err.msg);
}
end:
@@ -8194,7 +8194,7 @@ static void f_rpcstart(typval_T *argvars, typval_T *rettv, FunPtr fptr)
if (argvars[0].v_type != VAR_STRING
|| (argvars[1].v_type != VAR_LIST && argvars[1].v_type != VAR_UNKNOWN)) {
// Wrong argument types
- EMSG(_(e_invarg));
+ emsg(_(e_invarg));
return;
}
@@ -8207,7 +8207,7 @@ static void f_rpcstart(typval_T *argvars, typval_T *rettv, FunPtr fptr)
int i = 0;
TV_LIST_ITER_CONST(args, arg, {
if (TV_LIST_ITEM_TV(arg)->v_type != VAR_STRING) {
- emsgf(_("E5010: List item %d of the second argument is not a string"),
+ semsg(_("E5010: List item %d of the second argument is not a string"),
i);
return;
}
@@ -8216,7 +8216,7 @@ static void f_rpcstart(typval_T *argvars, typval_T *rettv, FunPtr fptr)
}
if (argvars[0].vval.v_string == NULL || argvars[0].vval.v_string[0] == NUL) {
- EMSG(_(e_api_spawn_failed));
+ emsg(_(e_api_spawn_failed));
return;
}
@@ -8260,7 +8260,7 @@ static void f_rpcstop(typval_T *argvars, typval_T *rettv, FunPtr fptr)
if (argvars[0].v_type != VAR_NUMBER) {
// Wrong argument types
- EMSG(_(e_invarg));
+ emsg(_(e_invarg));
return;
}
@@ -8273,7 +8273,7 @@ static void f_rpcstop(typval_T *argvars, typval_T *rettv, FunPtr fptr)
rettv->vval.v_number = channel_close(argvars[0].vval.v_number,
kChannelPartRpc, &error);
if (!rettv->vval.v_number) {
- EMSG(error);
+ emsg(error);
}
}
}
@@ -8460,7 +8460,7 @@ static int searchpair_cmn(typval_T *argvars, pos_T *match_pos)
// Only one of the SP_NOMOVE or SP_SETPCMARK flags can be set.
if ((flags & (SP_END | SP_SUBPAT)) != 0
|| ((flags & SP_NOMOVE) && (flags & SP_SETPCMARK))) {
- EMSG2(_(e_invarg2), tv_get_string(&argvars[3]));
+ semsg(_(e_invarg2), tv_get_string(&argvars[3]));
goto theend;
}
@@ -8479,19 +8479,19 @@ static int searchpair_cmn(typval_T *argvars, pos_T *match_pos)
if (skip->v_type != VAR_FUNC
&& skip->v_type != VAR_PARTIAL
&& skip->v_type != VAR_STRING) {
- emsgf(_(e_invarg2), tv_get_string(&argvars[4]));
+ semsg(_(e_invarg2), tv_get_string(&argvars[4]));
goto theend; // Type error.
}
if (argvars[5].v_type != VAR_UNKNOWN) {
lnum_stop = tv_get_number_chk(&argvars[5], NULL);
if (lnum_stop < 0) {
- emsgf(_(e_invarg2), tv_get_string(&argvars[5]));
+ semsg(_(e_invarg2), tv_get_string(&argvars[5]));
goto theend;
}
if (argvars[6].v_type != VAR_UNKNOWN) {
time_limit = tv_get_number_chk(&argvars[6], NULL);
if (time_limit < 0) {
- emsgf(_(e_invarg2), tv_get_string(&argvars[6]));
+ semsg(_(e_invarg2), tv_get_string(&argvars[6]));
goto theend;
}
}
@@ -8756,7 +8756,7 @@ static void f_serverstart(typval_T *argvars, typval_T *rettv, FunPtr fptr)
// If the user supplied an address, use it, otherwise use a temp.
if (argvars[0].v_type != VAR_UNKNOWN) {
if (argvars[0].v_type != VAR_STRING) {
- EMSG(_(e_invarg));
+ emsg(_(e_invarg));
return;
} else {
address = xstrdup(tv_get_string(argvars));
@@ -8769,7 +8769,7 @@ static void f_serverstart(typval_T *argvars, typval_T *rettv, FunPtr fptr)
xfree(address);
if (result != 0) {
- EMSG2("Failed to start server: %s",
+ semsg("Failed to start server: %s",
result > 0 ? "Unknown system error" : uv_strerror(result));
return;
}
@@ -8795,7 +8795,7 @@ static void f_serverstop(typval_T *argvars, typval_T *rettv, FunPtr fptr)
}
if (argvars[0].v_type != VAR_STRING) {
- EMSG(_(e_invarg));
+ emsg(_(e_invarg));
return;
}
@@ -8874,7 +8874,7 @@ static void f_setcharsearch(typval_T *argvars, typval_T *rettv, FunPtr fptr)
dictitem_T *di;
if (argvars[0].v_type != VAR_DICT) {
- EMSG(_(e_dictreq));
+ emsg(_(e_dictreq));
return;
}
@@ -8941,7 +8941,7 @@ static void f_setfperm(typval_T *argvars, typval_T *rettv, FunPtr fptr)
return;
}
if (strlen(mode_str) != 9) {
- EMSG2(_(e_invarg2), mode_str);
+ semsg(_(e_invarg2), mode_str);
return;
}
@@ -8992,10 +8992,10 @@ static void set_qf_ll_list(win_T *wp, typval_T *args, typval_T *rettv)
typval_T *list_arg = &args[0];
if (list_arg->v_type != VAR_LIST) {
- EMSG(_(e_listreq));
+ emsg(_(e_listreq));
return;
} else if (recursive != 0) {
- EMSG(_(e_au_recursive));
+ emsg(_(e_au_recursive));
return;
}
@@ -9004,7 +9004,7 @@ static void set_qf_ll_list(win_T *wp, typval_T *args, typval_T *rettv)
// Option argument was not given.
goto skip_args;
} else if (action_arg->v_type != VAR_STRING) {
- EMSG(_(e_stringreq));
+ emsg(_(e_stringreq));
return;
}
const char *const act = tv_get_string_chk(action_arg);
@@ -9012,7 +9012,7 @@ static void set_qf_ll_list(win_T *wp, typval_T *args, typval_T *rettv)
&& act[1] == NUL) {
action = *act;
} else {
- EMSG2(_(e_invact), act);
+ semsg(_(e_invact), act);
return;
}
@@ -9029,7 +9029,7 @@ static void set_qf_ll_list(win_T *wp, typval_T *args, typval_T *rettv)
} else if (what_arg->v_type == VAR_DICT && what_arg->vval.v_dict != NULL) {
what = what_arg->vval.v_dict;
} else {
- EMSG(_(e_dictreq));
+ emsg(_(e_dictreq));
return;
}
@@ -9072,7 +9072,7 @@ static void f_setmatches(typval_T *argvars, typval_T *rettv, FunPtr fptr)
rettv->vval.v_number = -1;
if (argvars[0].v_type != VAR_LIST) {
- EMSG(_(e_listreq));
+ emsg(_(e_listreq));
return;
}
if (win == NULL) {
@@ -9086,7 +9086,7 @@ static void f_setmatches(typval_T *argvars, typval_T *rettv, FunPtr fptr)
TV_LIST_ITER_CONST(l, li, {
if (TV_LIST_ITEM_TV(li)->v_type != VAR_DICT
|| (d = TV_LIST_ITEM_TV(li)->vval.v_dict) == NULL) {
- emsgf(_("E474: List item %d is either not a dictionary "
+ semsg(_("E474: List item %d is either not a dictionary "
"or an empty one"), li_idx);
return;
}
@@ -9095,7 +9095,7 @@ static void f_setmatches(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|| tv_dict_find(d, S_LEN("pos1")) != NULL)
&& tv_dict_find(d, S_LEN("priority")) != NULL
&& tv_dict_find(d, S_LEN("id")) != NULL)) {
- emsgf(_("E474: List item %d is missing one of the required keys"),
+ semsg(_("E474: List item %d is missing one of the required keys"),
li_idx);
return;
}
@@ -9197,7 +9197,7 @@ static void f_setpos(typval_T *argvars, typval_T *rettv, FunPtr fptr)
rettv->vval.v_number = 0;
}
} else {
- EMSG(_(e_invarg));
+ emsg(_(e_invarg));
}
}
}
@@ -9287,7 +9287,7 @@ static void f_setreg(typval_T *argvars, typval_T *rettv, FunPtr fptr)
const int ret = get_yank_type((char_u **)&stropt, &yank_type, &block_len);
if (ret == FAIL || *(++stropt) != NUL) {
- EMSG2(_(e_invargval), "value");
+ semsg(_(e_invargval), "value");
return;
}
}
@@ -9308,7 +9308,7 @@ static void f_setreg(typval_T *argvars, typval_T *rettv, FunPtr fptr)
bool set_unnamed = false;
if (argvars[2].v_type != VAR_UNKNOWN) {
if (yank_type != kMTUnknown) {
- EMSG2(_(e_toomanyarg), "setreg");
+ semsg(_(e_toomanyarg), "setreg");
return;
}
@@ -9448,7 +9448,7 @@ static void f_settagstack(typval_T *argvars, typval_T *rettv, FunPtr fptr)
// second argument: dict with items to set in the tag stack
if (argvars[1].v_type != VAR_DICT) {
- EMSG(_(e_dictreq));
+ emsg(_(e_dictreq));
return;
}
d = argvars[1].vval.v_dict;
@@ -9470,11 +9470,11 @@ static void f_settagstack(typval_T *argvars, typval_T *rettv, FunPtr fptr)
&& actstr[1] == NUL) {
action = *actstr;
} else {
- EMSG2(_(e_invact2), actstr);
+ semsg(_(e_invact2), actstr);
return;
}
} else {
- EMSG(_(e_stringreq));
+ emsg(_(e_stringreq));
return;
}
@@ -9557,7 +9557,7 @@ static void f_sign_define(typval_T *argvars, typval_T *rettv, FunPtr fptr)
}
if (argvars[1].v_type != VAR_UNKNOWN && argvars[1].v_type != VAR_DICT) {
- EMSG(_(e_dictreq));
+ emsg(_(e_dictreq));
return;
}
@@ -9603,7 +9603,7 @@ static void f_sign_getplaced(typval_T *argvars, typval_T *rettv, FunPtr fptr)
if (argvars[1].v_type != VAR_UNKNOWN) {
if (argvars[1].v_type != VAR_DICT
|| ((dict = argvars[1].vval.v_dict) == NULL)) {
- EMSG(_(e_dictreq));
+ emsg(_(e_dictreq));
return;
}
if ((di = tv_dict_find(dict, "lnum", -1)) != NULL) {
@@ -9654,7 +9654,7 @@ static void f_sign_jump(typval_T *argvars, typval_T *rettv, FunPtr fptr)
return;
}
if (sign_id <= 0) {
- EMSG(_(e_invarg));
+ emsg(_(e_invarg));
return;
}
@@ -9691,7 +9691,7 @@ static void f_sign_place(typval_T *argvars, typval_T *rettv, FunPtr fptr)
if (argvars[4].v_type != VAR_UNKNOWN
&& (argvars[4].v_type != VAR_DICT
|| ((dict = argvars[4].vval.v_dict) == NULL))) {
- EMSG(_(e_dictreq));
+ emsg(_(e_dictreq));
return;
}
@@ -9707,7 +9707,7 @@ static void f_sign_placelist(typval_T *argvars, typval_T *rettv, FunPtr fptr)
tv_list_alloc_ret(rettv, kListLenMayKnow);
if (argvars[0].v_type != VAR_LIST) {
- EMSG(_(e_listreq));
+ emsg(_(e_listreq));
return;
}
@@ -9717,7 +9717,7 @@ static void f_sign_placelist(typval_T *argvars, typval_T *rettv, FunPtr fptr)
if (TV_LIST_ITEM_TV(li)->v_type == VAR_DICT) {
sign_id = sign_place_from_dict(NULL, NULL, NULL, NULL, TV_LIST_ITEM_TV(li)->vval.v_dict);
} else {
- EMSG(_(e_dictreq));
+ emsg(_(e_dictreq));
}
tv_list_append_number(rettv->vval.v_list, sign_id);
});
@@ -9763,13 +9763,13 @@ static void f_sign_unplace(typval_T *argvars, typval_T *rettv, FunPtr fptr)
rettv->vval.v_number = -1;
if (argvars[0].v_type != VAR_STRING) {
- EMSG(_(e_invarg));
+ emsg(_(e_invarg));
return;
}
if (argvars[1].v_type != VAR_UNKNOWN) {
if (argvars[1].v_type != VAR_DICT) {
- EMSG(_(e_dictreq));
+ emsg(_(e_dictreq));
return;
}
dict = argvars[1].vval.v_dict;
@@ -9786,7 +9786,7 @@ static void f_sign_unplacelist(typval_T *argvars, typval_T *rettv, FunPtr fptr)
tv_list_alloc_ret(rettv, kListLenMayKnow);
if (argvars[0].v_type != VAR_LIST) {
- EMSG(_(e_listreq));
+ emsg(_(e_listreq));
return;
}
@@ -9795,7 +9795,7 @@ static void f_sign_unplacelist(typval_T *argvars, typval_T *rettv, FunPtr fptr)
if (TV_LIST_ITEM_TV(li)->v_type == VAR_DICT) {
retval = sign_unplace_from_dict(NULL, TV_LIST_ITEM_TV(li)->vval.v_dict);
} else {
- EMSG(_(e_dictreq));
+ emsg(_(e_dictreq));
}
tv_list_append_number(rettv->vval.v_list, retval);
});
@@ -9816,12 +9816,12 @@ static void f_simplify(typval_T *argvars, typval_T *rettv, FunPtr fptr)
static void f_sockconnect(typval_T *argvars, typval_T *rettv, FunPtr fptr)
{
if (argvars[0].v_type != VAR_STRING || argvars[1].v_type != VAR_STRING) {
- EMSG(_(e_invarg));
+ emsg(_(e_invarg));
return;
}
if (argvars[2].v_type != VAR_DICT && argvars[2].v_type != VAR_UNKNOWN) {
// Wrong argument types
- EMSG2(_(e_invarg2), "expected dictionary");
+ semsg(_(e_invarg2), "expected dictionary");
return;
}
@@ -9834,7 +9834,7 @@ static void f_sockconnect(typval_T *argvars, typval_T *rettv, FunPtr fptr)
} else if (strcmp(mode, "pipe") == 0) {
tcp = false;
} else {
- EMSG2(_(e_invarg2), "invalid mode");
+ semsg(_(e_invarg2), "invalid mode");
return;
}
@@ -9857,7 +9857,7 @@ static void f_sockconnect(typval_T *argvars, typval_T *rettv, FunPtr fptr)
uint64_t id = channel_connect(tcp, address, rpc, on_data, 50, &error);
if (error) {
- EMSG2(_("connection failed: %s"), error);
+ semsg(_("connection failed: %s"), error);
}
rettv->vval.v_number = (varnumber_T)id;
@@ -10066,7 +10066,7 @@ static void do_sort_uniq(typval_T *argvars, typval_T *rettv, bool sort)
: N_("uniq() argument"));
if (argvars[0].v_type != VAR_LIST) {
- EMSG2(_(e_listarg), sort ? "sort()" : "uniq()");
+ semsg(_(e_listarg), sort ? "sort()" : "uniq()");
} else {
list_T *const l = argvars[0].vval.v_list;
if (var_check_lock(tv_list_locked(l), arg_errmsg, TV_TRANSLATE)) {
@@ -10106,7 +10106,7 @@ static void do_sort_uniq(typval_T *argvars, typval_T *rettv, bool sort)
} else if (argvars[1].v_type != VAR_NUMBER) {
info.item_compare_func = tv_get_string(&argvars[1]);
} else if (i != 0) {
- EMSG(_(e_invarg));
+ emsg(_(e_invarg));
goto theend;
}
if (info.item_compare_func != NULL) {
@@ -10135,7 +10135,7 @@ static void do_sort_uniq(typval_T *argvars, typval_T *rettv, bool sort)
if (argvars[2].v_type != VAR_UNKNOWN) {
// optional third argument: {dict}
if (argvars[2].v_type != VAR_DICT) {
- EMSG(_(e_dictreq));
+ emsg(_(e_dictreq));
goto theend;
}
info.item_compare_selfdict = argvars[2].vval.v_dict;
@@ -10154,7 +10154,7 @@ static void do_sort_uniq(typval_T *argvars, typval_T *rettv, bool sort)
: item_compare2_not_keeping_zero),
&info.item_compare_func_err);
if (info.item_compare_func_err) {
- EMSG(_("E702: Sort compare function failed"));
+ emsg(_("E702: Sort compare function failed"));
}
} else {
ListSorter item_compare_func_ptr;
@@ -10174,7 +10174,7 @@ static void do_sort_uniq(typval_T *argvars, typval_T *rettv, bool sort)
listitem_T *const prev_li = TV_LIST_ITEM_PREV(l, li);
if (item_compare_func_ptr(&prev_li, &li) == 0) {
if (info.item_compare_func_err) { // -V547
- EMSG(_("E882: Uniq compare function failed"));
+ emsg(_("E882: Uniq compare function failed"));
break;
}
li = tv_list_item_remove(l, li);
@@ -10202,7 +10202,7 @@ static void f_sort(typval_T *argvars, typval_T *rettv, FunPtr fptr)
static void f_stdioopen(typval_T *argvars, typval_T *rettv, FunPtr fptr)
{
if (argvars[0].v_type != VAR_DICT) {
- EMSG(_(e_invarg));
+ emsg(_(e_invarg));
return;
}
@@ -10223,7 +10223,7 @@ static void f_stdioopen(typval_T *argvars, typval_T *rettv, FunPtr fptr)
const char *error;
uint64_t id = channel_from_stdio(rpc, on_stdin, &error);
if (!id) {
- EMSG2(e_stdiochan2, error);
+ semsg(e_stdiochan2, error);
}
@@ -10276,7 +10276,7 @@ static void f_spellbadword(typval_T *argvars, typval_T *rettv, FunPtr fptr)
}
if (*curwin->w_s->b_p_spl == NUL) {
- EMSG(_(e_no_spell));
+ emsg(_(e_no_spell));
curwin->w_p_spell = wo_spell_save;
return;
}
@@ -10338,7 +10338,7 @@ static void f_spellsuggest(typval_T *argvars, typval_T *rettv, FunPtr fptr)
}
if (*curwin->w_s->b_p_spl == NUL) {
- EMSG(_(e_no_spell));
+ emsg(_(e_no_spell));
curwin->w_p_spell = wo_spell_save;
return;
}
@@ -10474,7 +10474,7 @@ static void f_stdpath(typval_T *argvars, typval_T *rettv, FunPtr fptr)
} else if (strequal(p, "data_dirs")) {
get_xdg_var_list(kXDGDataDirs, rettv);
} else {
- EMSG2(_("E6100: \"%s\" is not a valid stdpath"), p);
+ semsg(_("E6100: \"%s\" is not a valid stdpath"), p);
}
}
@@ -10517,7 +10517,7 @@ static void f_str2nr(typval_T *argvars, typval_T *rettv, FunPtr fptr)
if (argvars[1].v_type != VAR_UNKNOWN) {
base = tv_get_number(&argvars[1]);
if (base != 2 && base != 8 && base != 10 && base != 16) {
- EMSG(_(e_invarg));
+ emsg(_(e_invarg));
return;
}
if (argvars[2].v_type != VAR_UNKNOWN && tv_get_number(&argvars[2])) {
@@ -10697,7 +10697,7 @@ static void f_strchars(typval_T *argvars, typval_T *rettv, FunPtr fptr)
skipcc = tv_get_number_chk(&argvars[1], NULL);
}
if (skipcc < 0 || skipcc > 1) {
- EMSG(_(e_invarg));
+ emsg(_(e_invarg));
} else {
func_mb_ptr2char_adv = skipcc ? mb_ptr2char_adv : mb_cptr2char_adv;
while (*s != NUL) {
@@ -10933,7 +10933,7 @@ static void f_submatch(typval_T *argvars, typval_T *rettv, FunPtr fptr)
}
if (no < 0 || no >= NSUBEXP) {
- emsgf(_("E935: invalid submatch number: %d"), no);
+ semsg(_("E935: invalid submatch number: %d"), no);
return;
}
int retList = 0;
@@ -11235,7 +11235,7 @@ static void f_tabpagenr(typval_T *argvars, typval_T *rettv, FunPtr fptr)
? tabpage_index(lastused_tabpage)
: nr;
} else {
- EMSG2(_(e_invexpr2), arg);
+ semsg(_(e_invexpr2), arg);
}
}
} else {
@@ -11293,7 +11293,7 @@ static int get_winnr(tabpage_T *tp, typval_T *argvar)
}
if (invalid_arg) {
- EMSG2(_(e_invexpr2), arg);
+ semsg(_(e_invexpr2), arg);
nr = 0;
}
}
@@ -11385,7 +11385,7 @@ static void f_termopen(typval_T *argvars, typval_T *rettv, FunPtr fptr)
}
if (curbuf->b_changed) {
- EMSG(_("Can only call this function in an unmodified buffer"));
+ emsg(_("Can only call this function in an unmodified buffer"));
return;
}
@@ -11399,7 +11399,7 @@ static void f_termopen(typval_T *argvars, typval_T *rettv, FunPtr fptr)
if (argvars[1].v_type != VAR_DICT && argvars[1].v_type != VAR_UNKNOWN) {
// Wrong argument type
- EMSG2(_(e_invarg2), "expected dictionary");
+ semsg(_(e_invarg2), "expected dictionary");
shell_free_argv(argv);
return;
}
@@ -11422,7 +11422,7 @@ static void f_termopen(typval_T *argvars, typval_T *rettv, FunPtr fptr)
cwd = new_cwd;
// The new cwd must be a directory.
if (!os_isdir_executable(cwd)) {
- EMSG2(_(e_invarg2), "expected valid directory");
+ semsg(_(e_invarg2), "expected valid directory");
shell_free_argv(argv);
return;
}
@@ -11430,7 +11430,7 @@ static void f_termopen(typval_T *argvars, typval_T *rettv, FunPtr fptr)
job_env = tv_dict_find(job_opts, S_LEN("env"));
if (job_env && job_env->di_tv.v_type != VAR_DICT) {
- EMSG2(_(e_invarg2), "env");
+ semsg(_(e_invarg2), "env");
shell_free_argv(argv);
return;
}
@@ -11513,7 +11513,7 @@ static void f_timer_info(typval_T *argvars, typval_T *rettv, FunPtr fptr)
{
if (argvars[0].v_type != VAR_UNKNOWN) {
if (argvars[0].v_type != VAR_NUMBER) {
- EMSG(_(e_number_exp));
+ emsg(_(e_number_exp));
return;
}
tv_list_alloc_ret(rettv, 1);
@@ -11530,7 +11530,7 @@ static void f_timer_info(typval_T *argvars, typval_T *rettv, FunPtr fptr)
static void f_timer_pause(typval_T *argvars, typval_T *unused, FunPtr fptr)
{
if (argvars[0].v_type != VAR_NUMBER) {
- EMSG(_(e_number_exp));
+ emsg(_(e_number_exp));
return;
}
int paused = (bool)tv_get_number(&argvars[1]);
@@ -11557,7 +11557,7 @@ static void f_timer_start(typval_T *argvars, typval_T *rettv, FunPtr fptr)
if (argvars[2].v_type != VAR_UNKNOWN) {
if (argvars[2].v_type != VAR_DICT
|| (dict = argvars[2].vval.v_dict) == NULL) {
- EMSG2(_(e_invarg2), tv_get_string(&argvars[2]));
+ semsg(_(e_invarg2), tv_get_string(&argvars[2]));
return;
}
dictitem_T *const di = tv_dict_find(dict, S_LEN("repeat"));
@@ -11582,7 +11582,7 @@ static void f_timer_start(typval_T *argvars, typval_T *rettv, FunPtr fptr)
static void f_timer_stop(typval_T *argvars, typval_T *rettv, FunPtr fptr)
{
if (argvars[0].v_type != VAR_NUMBER) {
- EMSG(_(e_number_exp));
+ emsg(_(e_number_exp));
return;
}
@@ -11696,7 +11696,7 @@ static void f_tr(typval_T *argvars, typval_T *rettv, FunPtr fptr)
rettv->vval.v_string = ga.ga_data;
return;
error:
- EMSG2(_(e_invarg2), fromstr);
+ semsg(_(e_invarg2), fromstr);
ga_clear(&ga);
return;
}
@@ -11730,7 +11730,7 @@ static void f_trim(typval_T *argvars, typval_T *rettv, FunPtr fptr)
return;
}
if (dir < 0 || dir > 2) {
- emsgf(_(e_invarg2), tv_get_string(&argvars[2]));
+ semsg(_(e_invarg2), tv_get_string(&argvars[2]));
return;
}
}
@@ -12090,7 +12090,7 @@ static void f_winrestview(typval_T *argvars, typval_T *rettv, FunPtr fptr)
if (argvars[0].v_type != VAR_DICT
|| (dict = argvars[0].vval.v_dict) == NULL) {
- EMSG(_(e_invarg));
+ emsg(_(e_invarg));
} else {
dictitem_T *di;
if ((di = tv_dict_find(dict, S_LEN("lnum"))) != NULL) {
@@ -12197,7 +12197,7 @@ static void f_writefile(typval_T *argvars, typval_T *rettv, FunPtr fptr)
}
});
} else if (argvars[0].v_type != VAR_BLOB) {
- EMSG2(_(e_invarg2),
+ semsg(_(e_invarg2),
_("writefile() first argument must be a List or a Blob"));
return;
}
@@ -12222,7 +12222,7 @@ static void f_writefile(typval_T *argvars, typval_T *rettv, FunPtr fptr)
do_fsync = false; break;
default:
// Using %s, p and not %c, *p to preserve multibyte characters
- emsgf(_("E5060: Unknown flag: %s"), p);
+ semsg(_("E5060: Unknown flag: %s"), p);
return;
}
}
@@ -12236,11 +12236,11 @@ static void f_writefile(typval_T *argvars, typval_T *rettv, FunPtr fptr)
FileDescriptor fp;
int error;
if (*fname == NUL) {
- EMSG(_("E482: Can't open file with an empty name"));
+ emsg(_("E482: Can't open file with an empty name"));
} else if ((error = file_open(&fp, fname,
((append ? kFileAppend : kFileTruncate)
| kFileCreate), 0666)) != 0) {
- emsgf(_("E482: Can't open file %s for writing: %s"),
+ semsg(_("E482: Can't open file %s for writing: %s"),
fname, os_strerror(error));
} else {
bool write_ok;
@@ -12253,7 +12253,7 @@ static void f_writefile(typval_T *argvars, typval_T *rettv, FunPtr fptr)
rettv->vval.v_number = 0;
}
if ((error = file_close(&fp, do_fsync)) != 0) {
- emsgf(_("E80: Error when closing file %s: %s"),
+ semsg(_("E80: Error when closing file %s: %s"),
fname, os_strerror(error));
}
}
diff --git a/src/nvim/eval/typval.c b/src/nvim/eval/typval.c
index 811a1d40dd..3e37e8cbb6 100644
--- a/src/nvim/eval/typval.c
+++ b/src/nvim/eval/typval.c
@@ -63,7 +63,7 @@ void list_write_log(const char *const fname)
FileDescriptor fp;
const int fo_ret = file_open(&fp, fname, kFileCreate|kFileAppend, 0600);
if (fo_ret != 0) {
- emsgf(_("E5142: Failed to open file %s: %s"), fname, os_strerror(fo_ret));
+ semsg(_("E5142: Failed to open file %s: %s"), fname, os_strerror(fo_ret));
return;
}
for (ListLog *chunk = list_log_first; chunk != NULL;) {
@@ -85,7 +85,7 @@ void list_write_log(const char *const fname)
sizeof(chunk->entries[0]) * (chunk->size - i));
chunk->size -= i;
}
- emsgf(_("E5143: Failed to write to file %s: %s"),
+ semsg(_("E5143: Failed to write to file %s: %s"),
fname, os_strerror((int)fw_ret));
return;
}
@@ -96,7 +96,7 @@ void list_write_log(const char *const fname)
}
const int fc_ret = file_close(&fp, true);
if (fc_ret != 0) {
- emsgf(_("E5144: Failed to close file %s: %s"), fname, os_strerror(fc_ret));
+ semsg(_("E5144: Failed to close file %s: %s"), fname, os_strerror(fc_ret));
}
}
@@ -1041,7 +1041,7 @@ const char *tv_list_find_str(list_T *const l, const int n)
{
const listitem_T *const li = tv_list_find(l, n);
if (li == NULL) {
- EMSG2(_(e_listidx), (int64_t)n);
+ semsg(_(e_listidx), (int64_t)n);
return NULL;
}
return tv_get_string(TV_LIST_ITEM_TV(li));
@@ -1399,7 +1399,7 @@ void tv_dict_item_remove(dict_T *const dict, dictitem_T *const item)
{
hashitem_T *const hi = hash_find(&dict->dv_hashtab, item->di_key);
if (HASHITEM_EMPTY(hi)) {
- emsgf(_(e_intern2), "tv_dict_item_remove()");
+ semsg(_(e_intern2), "tv_dict_item_remove()");
} else {
hash_remove(&dict->dv_hashtab, hi);
}
@@ -1687,7 +1687,7 @@ bool tv_dict_get_callback(dict_T *const d, const char *const key, const ptrdiff_
}
if (!tv_is_func(di->di_tv) && di->di_tv.v_type != VAR_STRING) {
- EMSG(_("E6000: Argument is not a function or function name"));
+ emsg(_("E6000: Argument is not a function or function name"));
return false;
}
@@ -1961,7 +1961,7 @@ void tv_dict_extend(dict_T *const d1, dict_T *const d2, const char *const action
NULL);
}
} else if (*action == 'e') {
- emsgf(_("E737: Key already exists: %s"), di2->di_key);
+ semsg(_("E737: Key already exists: %s"), di2->di_key);
break;
} else if (*action == 'f' && di2 != di1) {
typval_T oldtv;
@@ -2599,7 +2599,7 @@ void tv_copy(const typval_T *const from, typval_T *const to)
}
break;
case VAR_UNKNOWN:
- emsgf(_(e_intern2), "tv_copy(UNKNOWN)");
+ semsg(_(e_intern2), "tv_copy(UNKNOWN)");
break;
}
}
@@ -2620,7 +2620,7 @@ void tv_item_lock(typval_T *const tv, const int deep, const bool lock, const boo
static int recurse = 0;
if (recurse >= DICT_MAXNEST) {
- EMSG(_("E743: variable nested too deep for (un)lock"));
+ emsg(_("E743: variable nested too deep for (un)lock"));
return;
}
if (deep == 0) {
@@ -2778,7 +2778,7 @@ bool var_check_lock(VarLockStatus lock, const char *name, size_t name_len)
name_len = strlen(name);
}
- emsgf(_(error_message), (int)name_len, name);
+ semsg(_(error_message), (int)name_len, name);
return true;
}
@@ -2896,29 +2896,29 @@ bool tv_check_str_or_nr(const typval_T *const tv)
case VAR_STRING:
return true;
case VAR_FLOAT:
- EMSG(_("E805: Expected a Number or a String, Float found"));
+ emsg(_("E805: Expected a Number or a String, Float found"));
return false;
case VAR_PARTIAL:
case VAR_FUNC:
- EMSG(_("E703: Expected a Number or a String, Funcref found"));
+ emsg(_("E703: Expected a Number or a String, Funcref found"));
return false;
case VAR_LIST:
- EMSG(_("E745: Expected a Number or a String, List found"));
+ emsg(_("E745: Expected a Number or a String, List found"));
return false;
case VAR_DICT:
- EMSG(_("E728: Expected a Number or a String, Dictionary found"));
+ emsg(_("E728: Expected a Number or a String, Dictionary found"));
return false;
case VAR_BLOB:
- EMSG(_("E974: Expected a Number or a String, Blob found"));
+ emsg(_("E974: Expected a Number or a String, Blob found"));
return false;
case VAR_BOOL:
- EMSG(_("E5299: Expected a Number or a String, Boolean found"));
+ emsg(_("E5299: Expected a Number or a String, Boolean found"));
return false;
case VAR_SPECIAL:
- EMSG(_("E5300: Expected a Number or a String"));
+ emsg(_("E5300: Expected a Number or a String"));
return false;
case VAR_UNKNOWN:
- EMSG2(_(e_intern2), "tv_check_str_or_nr(UNKNOWN)");
+ semsg(_(e_intern2), "tv_check_str_or_nr(UNKNOWN)");
return false;
}
abort();
@@ -2963,7 +2963,7 @@ bool tv_check_num(const typval_T *const tv)
case VAR_FLOAT:
case VAR_BLOB:
case VAR_UNKNOWN:
- EMSG(_(num_errors[tv->v_type]));
+ emsg(_(num_errors[tv->v_type]));
return false;
}
abort();
@@ -3008,7 +3008,7 @@ bool tv_check_str(const typval_T *const tv)
case VAR_FLOAT:
case VAR_BLOB:
case VAR_UNKNOWN:
- EMSG(_(str_errors[tv->v_type]));
+ emsg(_(str_errors[tv->v_type]));
return false;
}
abort();
@@ -3055,7 +3055,7 @@ varnumber_T tv_get_number_chk(const typval_T *const tv, bool *const ret_error)
case VAR_DICT:
case VAR_BLOB:
case VAR_FLOAT:
- EMSG(_(num_errors[tv->v_type]));
+ emsg(_(num_errors[tv->v_type]));
break;
case VAR_NUMBER:
return tv->vval.v_number;
@@ -3072,7 +3072,7 @@ varnumber_T tv_get_number_chk(const typval_T *const tv, bool *const ret_error)
case VAR_SPECIAL:
return 0;
case VAR_UNKNOWN:
- emsgf(_(e_intern2), "tv_get_number(UNKNOWN)");
+ semsg(_(e_intern2), "tv_get_number(UNKNOWN)");
break;
}
if (ret_error != NULL) {
@@ -3119,28 +3119,28 @@ float_T tv_get_float(const typval_T *const tv)
return tv->vval.v_float;
case VAR_PARTIAL:
case VAR_FUNC:
- EMSG(_("E891: Using a Funcref as a Float"));
+ emsg(_("E891: Using a Funcref as a Float"));
break;
case VAR_STRING:
- EMSG(_("E892: Using a String as a Float"));
+ emsg(_("E892: Using a String as a Float"));
break;
case VAR_LIST:
- EMSG(_("E893: Using a List as a Float"));
+ emsg(_("E893: Using a List as a Float"));
break;
case VAR_DICT:
- EMSG(_("E894: Using a Dictionary as a Float"));
+ emsg(_("E894: Using a Dictionary as a Float"));
break;
case VAR_BOOL:
- EMSG(_("E362: Using a boolean value as a Float"));
+ emsg(_("E362: Using a boolean value as a Float"));
break;
case VAR_SPECIAL:
- EMSG(_("E907: Using a special value as a Float"));
+ emsg(_("E907: Using a special value as a Float"));
break;
case VAR_BLOB:
- EMSG(_("E975: Using a Blob as a Float"));
+ emsg(_("E975: Using a Blob as a Float"));
break;
case VAR_UNKNOWN:
- emsgf(_(e_intern2), "tv_get_float(UNKNOWN)");
+ semsg(_(e_intern2), "tv_get_float(UNKNOWN)");
break;
}
return 0;
@@ -3151,7 +3151,7 @@ int tv_check_for_string(const typval_T *const tv)
FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_PURE
{
if (tv->v_type != VAR_STRING) {
- EMSG(_(e_stringreq));
+ emsg(_(e_stringreq));
return FAIL;
}
return OK;
@@ -3165,7 +3165,7 @@ int tv_check_for_nonempty_string(const typval_T *const tv)
return FAIL;
}
if (tv->vval.v_string == NULL || *tv->vval.v_string == NUL) {
- EMSG(_(e_non_empty_string_required));
+ emsg(_(e_non_empty_string_required));
return FAIL;
}
return OK;
@@ -3207,7 +3207,7 @@ const char *tv_get_string_buf_chk(const typval_T *const tv, char *const buf)
case VAR_FLOAT:
case VAR_BLOB:
case VAR_UNKNOWN:
- EMSG(_(str_errors[tv->v_type]));
+ emsg(_(str_errors[tv->v_type]));
return false;
}
return NULL;
diff --git a/src/nvim/eval/typval.h b/src/nvim/eval/typval.h
index 843f879ed0..69732f1a7d 100644
--- a/src/nvim/eval/typval.h
+++ b/src/nvim/eval/typval.h
@@ -893,7 +893,7 @@ static inline bool tv_get_float_chk(const typval_T *const tv,
REAL_FATTR_NONNULL_ALL REAL_FATTR_WARN_UNUSED_RESULT;
// FIXME circular dependency, cannot import message.h.
-bool emsgf(const char *const fmt, ...);
+bool semsg(const char *const fmt, ...);
/// Get the float value
///
@@ -913,7 +913,7 @@ static inline bool tv_get_float_chk(const typval_T *const tv, float_T *const ret
*ret_f = (float_T)tv->vval.v_number;
return true;
}
- emsgf("%s", _("E808: Number or Float required"));
+ semsg("%s", _("E808: Number or Float required"));
return false;
}
diff --git a/src/nvim/eval/userfunc.c b/src/nvim/eval/userfunc.c
index 6a01cbba5c..c8a8e074b8 100644
--- a/src/nvim/eval/userfunc.c
+++ b/src/nvim/eval/userfunc.c
@@ -103,7 +103,7 @@ static int get_function_args(char_u **argp, char_u endchar, garray_T *newargs, i
|| (p - arg == 9 && STRNCMP(arg, "firstline", 9) == 0)
|| (p - arg == 8 && STRNCMP(arg, "lastline", 8) == 0)) {
if (!skip) {
- EMSG2(_("E125: Illegal argument: %s"), arg);
+ semsg(_("E125: Illegal argument: %s"), arg);
}
break;
}
@@ -116,7 +116,7 @@ static int get_function_args(char_u **argp, char_u endchar, garray_T *newargs, i
// Check for duplicate argument name.
for (i = 0; i < newargs->ga_len; i++) {
if (STRCMP(((char_u **)(newargs->ga_data))[i], arg) == 0) {
- EMSG2(_("E853: Duplicate argument name: %s"), arg);
+ semsg(_("E853: Duplicate argument name: %s"), arg);
xfree(arg);
goto err_ret;
}
@@ -151,7 +151,7 @@ static int get_function_args(char_u **argp, char_u endchar, garray_T *newargs, i
mustend = true;
}
} else if (any_default) {
- EMSG(_("E989: Non-default argument follows default argument"));
+ emsg(_("E989: Non-default argument follows default argument"));
mustend = true;
}
if (*p == ',') {
@@ -163,7 +163,7 @@ static int get_function_args(char_u **argp, char_u endchar, garray_T *newargs, i
p = skipwhite(p);
if (mustend && *p != endchar) {
if (!skip) {
- EMSG2(_(e_invarg2), *argp);
+ semsg(_(e_invarg2), *argp);
}
break;
}
@@ -395,7 +395,7 @@ void emsg_funcname(char *ermsg, const char_u *name)
p = (char_u *)name;
}
- EMSG2(_(ermsg), p);
+ semsg(_(ermsg), p);
if (p != name) {
xfree(p);
@@ -829,7 +829,7 @@ void call_user_func(ufunc_T *fp, int argcount, typval_T *argvars, typval_T *rett
// If depth of calling is getting too high, don't execute the function
if (depth >= p_mfd) {
- EMSG(_("E132: Function call depth is higher than 'maxfuncdepth'"));
+ emsg(_("E132: Function call depth is higher than 'maxfuncdepth'"));
rettv->v_type = VAR_NUMBER;
rettv->vval.v_number = -1;
return;
@@ -1244,7 +1244,7 @@ void save_funccal(funccal_entry_T *entry)
void restore_funccal(void)
{
if (funccal_stack == NULL) {
- IEMSG("INTERNAL: restore_funccal()");
+ iemsg("INTERNAL: restore_funccal()");
} else {
current_funccal = funccal_stack->top_funccal;
funccal_stack = funccal_stack->next;
@@ -1360,7 +1360,7 @@ int func_call(char_u *name, typval_T *args, partial_T *partial, dict_T *selfdict
TV_LIST_ITER(args->vval.v_list, item, {
if (argc == MAX_FUNC_ARGS - (partial == NULL ? 0 : partial->pt_argc)) {
- EMSG(_("E699: Too many arguments"));
+ emsg(_("E699: Too many arguments"));
goto func_call_skip_call;
}
// Make a copy of each argument. This is needed to be able to set
@@ -1732,7 +1732,7 @@ char_u *trans_function_name(char_u **pp, bool skip, int flags, funcdict_T *fdp,
lead > 2 ? 0 : FNE_CHECK_START);
if (end == start) {
if (!skip) {
- EMSG(_("E129: Function name required"));
+ emsg(_("E129: Function name required"));
}
goto theend;
}
@@ -1744,7 +1744,7 @@ char_u *trans_function_name(char_u **pp, bool skip, int flags, funcdict_T *fdp,
*/
if (!aborting()) {
if (end != NULL) {
- emsgf(_(e_invarg2), start);
+ semsg(_(e_invarg2), start);
}
} else {
*pp = (char_u *)find_name_end(start, NULL, NULL, FNE_INCL_BR);
@@ -1767,7 +1767,7 @@ char_u *trans_function_name(char_u **pp, bool skip, int flags, funcdict_T *fdp,
if (is_luafunc(lv.ll_tv->vval.v_partial) && *end == '.') {
len = check_luafunc_name((const char *)end+1, true);
if (len == 0) {
- EMSG2(e_invexpr2, "v:lua");
+ semsg(e_invexpr2, "v:lua");
goto theend;
}
name = xmallocz(len);
@@ -1784,7 +1784,7 @@ char_u *trans_function_name(char_u **pp, bool skip, int flags, funcdict_T *fdp,
if (!skip && !(flags & TFN_QUIET) && (fdp == NULL
|| lv.ll_dict == NULL
|| fdp->fd_newkey == NULL)) {
- EMSG(_(e_funcref));
+ emsg(_(e_funcref));
} else {
*pp = (char_u *)end;
}
@@ -1862,7 +1862,7 @@ char_u *trans_function_name(char_u **pp, bool skip, int flags, funcdict_T *fdp,
|| eval_fname_sid((const char *)(*pp))) {
// It's "s:" or "<SID>".
if (current_sctx.sc_sid <= 0) {
- EMSG(_(e_usingsid));
+ emsg(_(e_usingsid));
goto theend;
}
sid_buf_len = snprintf(sid_buf, sizeof(sid_buf),
@@ -1871,7 +1871,7 @@ char_u *trans_function_name(char_u **pp, bool skip, int flags, funcdict_T *fdp,
}
} else if (!(flags & TFN_INT)
&& builtin_function(lv.ll_name, lv.ll_name_len)) {
- EMSG2(_("E128: Function name must start with a capital or \"s:\": %s"),
+ semsg(_("E128: Function name must start with a capital or \"s:\": %s"),
start);
goto theend;
}
@@ -1880,7 +1880,7 @@ char_u *trans_function_name(char_u **pp, bool skip, int flags, funcdict_T *fdp,
char_u *cp = xmemrchr(lv.ll_name, ':', lv.ll_name_len);
if (cp != NULL && cp < end) {
- EMSG2(_("E884: Function name cannot contain a colon: %s"), start);
+ semsg(_("E884: Function name cannot contain a colon: %s"), start);
goto theend;
}
}
@@ -2025,7 +2025,7 @@ void ex_function(exarg_T *eap)
*/
if (!aborting()) {
if (fudi.fd_newkey != NULL) {
- EMSG2(_(e_dictkey), fudi.fd_newkey);
+ semsg(_(e_dictkey), fudi.fd_newkey);
}
xfree(fudi.fd_newkey);
return;
@@ -2047,7 +2047,7 @@ void ex_function(exarg_T *eap)
//
if (!paren) {
if (!ends_excmd(*skipwhite(p))) {
- EMSG(_(e_trailing));
+ emsg(_(e_trailing));
goto ret_free;
}
eap->nextcmd = check_nextcmd(p);
@@ -2093,7 +2093,7 @@ void ex_function(exarg_T *eap)
p = skipwhite(p);
if (*p != '(') {
if (!eap->skip) {
- EMSG2(_("E124: Missing '(': %s"), eap->arg);
+ semsg(_("E124: Missing '(': %s"), eap->arg);
goto ret_free;
}
// attempt to continue by skipping some text
@@ -2126,7 +2126,7 @@ void ex_function(exarg_T *eap)
}
// Disallow using the g: dict.
if (fudi.fd_dict != NULL && fudi.fd_dict->dv_scope == VAR_DEF_SCOPE) {
- EMSG(_("E862: Cannot use g: here"));
+ emsg(_("E862: Cannot use g: here"));
}
}
@@ -2171,7 +2171,7 @@ void ex_function(exarg_T *eap)
if (*p == '\n') {
line_arg = p + 1;
} else if (*p != NUL && *p != '"' && !eap->skip && !did_emsg) {
- EMSG(_(e_trailing));
+ emsg(_(e_trailing));
}
/*
@@ -2183,7 +2183,7 @@ void ex_function(exarg_T *eap)
// need to skip the body to be able to find what follows.
if (!eap->skip && !eap->forceit) {
if (fudi.fd_dict != NULL && fudi.fd_newkey == NULL) {
- EMSG(_(e_funcdict));
+ emsg(_(e_funcdict));
} else if (name != NULL && find_func(name) != NULL) {
emsg_funcname(e_funcexts, name);
}
@@ -2234,7 +2234,7 @@ void ex_function(exarg_T *eap)
lines_left = Rows - 1;
}
if (theline == NULL) {
- EMSG(_("E126: Missing :endfunction"));
+ emsg(_("E126: Missing :endfunction"));
goto erret;
}
if (show_block) {
@@ -2475,7 +2475,7 @@ void ex_function(exarg_T *eap)
fp = NULL;
if (fudi.fd_newkey == NULL && !eap->forceit) {
- EMSG(_(e_funcdict));
+ emsg(_(e_funcdict));
goto erret;
}
if (fudi.fd_di == NULL) {
@@ -2516,7 +2516,7 @@ void ex_function(exarg_T *eap)
xfree(scriptname);
}
if (j == FAIL) {
- EMSG2(_("E746: Function name does not match script file name: %s"),
+ semsg(_("E746: Function name does not match script file name: %s"),
name);
goto erret;
}
@@ -2709,13 +2709,13 @@ void ex_delfunction(exarg_T *eap)
xfree(fudi.fd_newkey);
if (name == NULL) {
if (fudi.fd_dict != NULL && !eap->skip) {
- EMSG(_(e_funcref));
+ emsg(_(e_funcref));
}
return;
}
if (!ends_excmd(*skipwhite(p))) {
xfree(name);
- EMSG(_(e_trailing));
+ emsg(_(e_trailing));
return;
}
eap->nextcmd = check_nextcmd(p);
@@ -2731,18 +2731,18 @@ void ex_delfunction(exarg_T *eap)
if (!eap->skip) {
if (fp == NULL) {
if (!eap->forceit) {
- EMSG2(_(e_nofunc), eap->arg);
+ semsg(_(e_nofunc), eap->arg);
}
return;
}
if (fp->uf_calls > 0) {
- EMSG2(_("E131: Cannot delete function %s: It is in use"), eap->arg);
+ semsg(_("E131: Cannot delete function %s: It is in use"), eap->arg);
return;
}
// check `uf_refcount > 2` because deleting a function should also reduce
// the reference count, and 1 is the initial refcount.
if (fp->uf_refcount > 2) {
- EMSG2(_("Cannot delete function %s: It is being used internally"),
+ semsg(_("Cannot delete function %s: It is being used internally"),
eap->arg);
return;
}
@@ -2878,7 +2878,7 @@ void ex_return(exarg_T *eap)
int returning = FALSE;
if (current_funccal == NULL) {
- EMSG(_("E133: :return not inside a function"));
+ emsg(_("E133: :return not inside a function"));
return;
}
@@ -2953,7 +2953,7 @@ void ex_call(exarg_T *eap)
tofree = trans_function_name(&arg, false, TFN_INT, &fudi, &partial);
if (fudi.fd_newkey != NULL) {
// Still need to give an error message for missing key.
- EMSG2(_(e_dictkey), fudi.fd_newkey);
+ semsg(_(e_dictkey), fudi.fd_newkey);
xfree(fudi.fd_newkey);
}
if (tofree == NULL) {
@@ -2979,7 +2979,7 @@ void ex_call(exarg_T *eap)
rettv.v_type = VAR_UNKNOWN; // tv_clear() uses this.
if (*startarg != '(') {
- EMSG2(_(e_missingparen), eap->arg);
+ semsg(_(e_missingparen), eap->arg);
goto end;
}
@@ -2989,7 +2989,7 @@ void ex_call(exarg_T *eap)
if (lnum > curbuf->b_ml.ml_line_count) {
// If the function deleted lines or switched to another buffer
// the line number may become invalid.
- EMSG(_(e_invrange));
+ emsg(_(e_invrange));
break;
}
curwin->w_cursor.lnum = lnum;
@@ -3038,7 +3038,7 @@ void ex_call(exarg_T *eap)
if (!ends_excmd(*arg)) {
if (!failed) {
emsg_severe = true;
- EMSG(_(e_trailing));
+ emsg(_(e_trailing));
}
} else {
eap->nextcmd = check_nextcmd(arg);
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c
index b5a3a5fad7..1a81d0a206 100644
--- a/src/nvim/ex_cmds.c
+++ b/src/nvim/ex_cmds.c
@@ -523,14 +523,14 @@ void ex_sort(exarg_T *eap)
} else if (!ASCII_ISALPHA(*p) && regmatch.regprog == NULL) {
s = skip_regexp(p + 1, *p, true, NULL);
if (*s != *p) {
- EMSG(_(e_invalpat));
+ emsg(_(e_invalpat));
goto sortend;
}
*s = NUL;
// Use last search pattern if sort pattern is empty.
if (s == p + 1) {
if (last_search_pat() == NULL) {
- EMSG(_(e_noprevre));
+ emsg(_(e_noprevre));
goto sortend;
}
regmatch.regprog = vim_regcomp(last_search_pat(), RE_MAGIC);
@@ -543,14 +543,14 @@ void ex_sort(exarg_T *eap)
p = s; // continue after the regexp
regmatch.rm_ic = p_ic;
} else {
- EMSG2(_(e_invarg2), p);
+ semsg(_(e_invarg2), p);
goto sortend;
}
}
// Can only have one of 'n', 'b', 'o' and 'x'.
if (format_found > 1) {
- EMSG(_(e_invarg));
+ emsg(_(e_invarg));
goto sortend;
}
@@ -720,7 +720,7 @@ sortend:
xfree(sortbuf2);
vim_regfree(regmatch.regprog);
if (got_int) {
- EMSG(_(e_interr));
+ emsg(_(e_interr));
}
}
@@ -856,7 +856,7 @@ void ex_retab(exarg_T *eap)
line_breakcheck();
}
if (got_int) {
- EMSG(_(e_interr));
+ emsg(_(e_interr));
}
// If a single value was given then it can be considered equal to
@@ -914,7 +914,7 @@ int do_move(linenr_T line1, linenr_T line2, linenr_T dest)
linenr_T last_line; // Last line in file after adding new text
if (dest >= line1 && dest < line2) {
- EMSG(_("E134: Cannot move a range of lines into itself"));
+ emsg(_("E134: Cannot move a range of lines into itself"));
return FAIL;
}
@@ -1160,7 +1160,7 @@ void do_bang(int addr_count, exarg_T *eap, bool forceit, bool do_in, bool do_out
}
if (ins_prevcmd) {
if (prevcmd == NULL) {
- EMSG(_(e_noprev));
+ emsg(_(e_noprev));
xfree(newcmd);
return;
}
@@ -1319,7 +1319,7 @@ static void do_filter(linenr_T line1, linenr_T line2, exarg_T *eap, char_u *cmd,
curwin->w_cursor.lnum = line2;
} else if ((do_in && (itmp = vim_tempname()) == NULL)
|| (do_out && (otmp = vim_tempname()) == NULL)) {
- EMSG(_(e_notmp));
+ emsg(_(e_notmp));
goto filterend;
}
@@ -1333,7 +1333,7 @@ static void do_filter(linenr_T line1, linenr_T line2, exarg_T *eap, char_u *cmd,
msg_putchar('\n'); // Keep message from buf_write().
no_wait_return--;
if (!aborting()) {
- EMSG2(_("E482: Can't create file %s"), itmp); // Will call wait_return.
+ semsg(_("E482: Can't create file %s"), itmp); // Will call wait_return.
}
goto filterend;
}
@@ -1377,7 +1377,7 @@ static void do_filter(linenr_T line1, linenr_T line2, exarg_T *eap, char_u *cmd,
READ_FILTER) != OK) {
if (!aborting()) {
msg_putchar('\n');
- EMSG2(_(e_notread), otmp);
+ semsg(_(e_notread), otmp);
}
goto error;
}
@@ -1458,7 +1458,7 @@ filterend:
if (curbuf != old_curbuf) {
--no_wait_return;
- EMSG(_("E135: *Filter* Autocommands must not change current buffer"));
+ emsg(_("E135: *Filter* Autocommands must not change current buffer"));
}
if (itmp != NULL) {
os_remove((char *)itmp);
@@ -1736,7 +1736,7 @@ void ex_file(exarg_T *eap)
&& (*eap->arg != NUL
|| eap->line2 > 0
|| eap->addr_count > 1)) {
- EMSG(_(e_invarg));
+ emsg(_(e_invarg));
return;
}
@@ -1806,7 +1806,7 @@ int do_write(exarg_T *eap)
ffname = eap->arg;
if (*ffname == NUL) {
if (eap->cmdidx == CMD_saveas) {
- EMSG(_(e_argreq));
+ emsg(_(e_argreq));
goto theend;
}
other = FALSE;
@@ -1836,7 +1836,7 @@ int do_write(exarg_T *eap)
if (alt_buf != NULL && alt_buf->b_ml.ml_mfp != NULL) {
// Overwriting a file that is loaded in another buffer is not a
// good idea.
- EMSG(_(e_bufloaded));
+ emsg(_(e_bufloaded));
goto theend;
}
}
@@ -1868,7 +1868,7 @@ int do_write(exarg_T *eap)
}
eap->forceit = TRUE;
} else {
- EMSG(_("E140: Use ! to write partial buffer"));
+ emsg(_("E140: Use ! to write partial buffer"));
goto theend;
}
}
@@ -1976,7 +1976,7 @@ int check_overwrite(exarg_T *eap, buf_T *buf, char_u *fname, char_u *ffname, int
#ifdef UNIX
// It is possible to open a directory on Unix.
if (os_isdir(ffname)) {
- EMSG2(_(e_isadir2), ffname);
+ semsg(_(e_isadir2), ffname);
return FAIL;
}
#endif
@@ -1989,7 +1989,7 @@ int check_overwrite(exarg_T *eap, buf_T *buf, char_u *fname, char_u *ffname, int
}
eap->forceit = TRUE;
} else {
- EMSG(_(e_exists));
+ emsg(_(e_exists));
return FAIL;
}
}
@@ -2029,7 +2029,7 @@ int check_overwrite(exarg_T *eap, buf_T *buf, char_u *fname, char_u *ffname, int
}
eap->forceit = TRUE;
} else {
- EMSG2(_("E768: Swap file exists: %s (:silent! overrides)"),
+ semsg(_("E768: Swap file exists: %s (:silent! overrides)"),
swapname);
xfree(swapname);
return FAIL;
@@ -2093,7 +2093,7 @@ void do_wqall(exarg_T *eap)
break;
}
if (buf->b_ffname == NULL) {
- EMSGN(_("E141: No file name for buffer %" PRId64), buf->b_fnum);
+ semsg(_("E141: No file name for buffer %" PRId64), (int64_t)buf->b_fnum);
++error;
} else if (check_readonly(&eap->forceit, buf)
|| check_overwrite(eap, buf, buf->b_fname, buf->b_ffname,
@@ -2129,7 +2129,7 @@ int not_writing(void)
if (p_write) {
return FALSE;
}
- EMSG(_("E142: File not written: Writing is disabled by 'write' option"));
+ emsg(_("E142: File not written: Writing is disabled by 'write' option"));
return TRUE;
}
@@ -2167,9 +2167,9 @@ static int check_readonly(int *forceit, buf_T *buf)
return TRUE;
}
} else if (buf->b_p_ro) {
- EMSG(_(e_readonly));
+ emsg(_(e_readonly));
} else {
- EMSG2(_("E505: \"%s\" is read-only (add ! to override)"),
+ semsg(_("E505: \"%s\" is read-only (add ! to override)"),
buf->b_fname);
}
return TRUE;
@@ -2898,7 +2898,7 @@ theend:
static void delbuf_msg(char_u *name)
{
- EMSG2(_("E143: Autocommands unexpectedly deleted new buffer %s"),
+ semsg(_("E143: Autocommands unexpectedly deleted new buffer %s"),
name == NULL ? (char_u *)"" : name);
xfree(name);
au_new_curbuf.br_buf = NULL;
@@ -3113,7 +3113,7 @@ void ex_z(exarg_T *eap)
if (*x != 0) {
if (!ascii_isdigit(*x)) {
- EMSG(_("E144: non-numeric argument to :z"));
+ emsg(_("E144: non-numeric argument to :z"));
return;
}
bigness = atol((char *)x);
@@ -3223,14 +3223,14 @@ int check_secure(void)
{
if (secure) {
secure = 2;
- EMSG(_(e_curdir));
+ emsg(_(e_curdir));
return TRUE;
}
// In the sandbox more things are not allowed, including the things
// disallowed in secure mode.
if (sandbox != 0) {
- EMSG(_(e_sandbox));
+ emsg(_(e_sandbox));
return TRUE;
}
return FALSE;
@@ -3426,7 +3426,7 @@ static int check_regexp_delim(int c)
FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
{
if (isalpha(c)) {
- EMSG(_("E146: Regular expressions can't be delimited by letters"));
+ emsg(_("E146: Regular expressions can't be delimited by letters"));
return FAIL;
}
return OK;
@@ -3505,7 +3505,7 @@ static buf_T *do_sub(exarg_T *eap, proftime_T timeout, bool do_buf_event, handle
if (*cmd == '\\') {
++cmd;
if (vim_strchr((char_u *)"/?&", *cmd) == NULL) {
- EMSG(_(e_backslash));
+ emsg(_(e_backslash));
return NULL;
}
if (*cmd != '&') {
@@ -3551,7 +3551,7 @@ static buf_T *do_sub(exarg_T *eap, proftime_T timeout, bool do_buf_event, handle
}
} else if (!eap->skip) { // use previous pattern and substitution
if (old_sub.sub == NULL) { // there is no previous command
- EMSG(_(e_nopresub));
+ emsg(_(e_nopresub));
return NULL;
}
pat = NULL; // search_regcomp() will use previous pattern
@@ -3576,7 +3576,7 @@ static buf_T *do_sub(exarg_T *eap, proftime_T timeout, bool do_buf_event, handle
if (ascii_isdigit(*cmd)) {
i = getdigits_long(&cmd, true, 0);
if (i <= 0 && !eap->skip && subflags.do_error) {
- EMSG(_(e_zerocount));
+ emsg(_(e_zerocount));
return NULL;
}
eap->line1 = eap->line2;
@@ -3593,7 +3593,7 @@ static buf_T *do_sub(exarg_T *eap, proftime_T timeout, bool do_buf_event, handle
if (*cmd && *cmd != '"') { // if not end-of-line or comment
eap->nextcmd = check_nextcmd(cmd);
if (eap->nextcmd == NULL) {
- EMSG(_(e_trailing));
+ emsg(_(e_trailing));
return NULL;
}
}
@@ -3604,14 +3604,14 @@ static buf_T *do_sub(exarg_T *eap, proftime_T timeout, bool do_buf_event, handle
if (!subflags.do_count && !MODIFIABLE(curbuf)) {
// Substitution is not allowed in non-'modifiable' buffer
- EMSG(_(e_modifiable));
+ emsg(_(e_modifiable));
return NULL;
}
if (search_regcomp(pat, RE_SUBST, which_pat, (preview ? 0 : SEARCH_HIS),
&regmatch) == FAIL) {
if (subflags.do_error) {
- EMSG(_(e_invcmd));
+ emsg(_(e_invcmd));
}
return NULL;
}
@@ -4377,13 +4377,13 @@ skip:
} else if (!global_busy) {
if (got_int) {
// interrupted
- EMSG(_(e_interr));
+ emsg(_(e_interr));
} else if (got_match) {
// did find something but nothing substituted
MSG("");
} else if (subflags.do_error) {
// nothing found
- EMSG2(_(e_patnotf2), get_search_pat());
+ semsg(_(e_patnotf2), get_search_pat());
}
}
@@ -4473,7 +4473,7 @@ bool do_sub_msg(bool count_only)
return true;
}
if (got_int) {
- EMSG(_(e_interr));
+ emsg(_(e_interr));
return true;
}
return false;
@@ -4524,7 +4524,7 @@ void ex_global(exarg_T *eap)
if (global_busy && (eap->line1 != 1
|| eap->line2 != curbuf->b_ml.ml_line_count)) {
// will increment global_busy to break out of the loop
- EMSG(_("E147: Cannot do :global recursive with a range"));
+ emsg(_("E147: Cannot do :global recursive with a range"));
return;
}
@@ -4544,7 +4544,7 @@ void ex_global(exarg_T *eap)
if (*cmd == '\\') {
++cmd;
if (vim_strchr((char_u *)"/?&", *cmd) == NULL) {
- EMSG(_(e_backslash));
+ emsg(_(e_backslash));
return;
}
if (*cmd == '&') {
@@ -4555,7 +4555,7 @@ void ex_global(exarg_T *eap)
++cmd;
pat = (char_u *)"";
} else if (*cmd == NUL) {
- EMSG(_("E148: Regular expression missing from global"));
+ emsg(_("E148: Regular expression missing from global"));
return;
} else if (check_regexp_delim(*cmd) == FAIL) {
return;
@@ -4572,7 +4572,7 @@ void ex_global(exarg_T *eap)
}
if (search_regcomp(pat, RE_BOTH, which_pat, SEARCH_HIS, &regmatch) == FAIL) {
- EMSG(_(e_invcmd));
+ emsg(_(e_invcmd));
return;
}
@@ -4755,7 +4755,7 @@ void ex_help(exarg_T *eap)
arg = eap->arg;
if (eap->forceit && *arg == NUL && !curbuf->b_help) {
- EMSG(_("E478: Don't panic!"));
+ emsg(_("E478: Don't panic!"));
return;
}
@@ -4799,9 +4799,9 @@ void ex_help(exarg_T *eap)
}
if (i >= num_matches || n == FAIL) {
if (lang != NULL) {
- EMSG3(_("E661: Sorry, no '%s' help for %s"), lang, arg);
+ semsg(_("E661: Sorry, no '%s' help for %s"), lang, arg);
} else {
- EMSG2(_("E149: Sorry, no help for %s"), arg);
+ semsg(_("E149: Sorry, no help for %s"), arg);
}
if (n != FAIL) {
FreeWild(num_matches, matches);
@@ -5343,7 +5343,7 @@ void fix_help_buffer(void)
if (!add_pathsep((char *)NameBuff)
|| STRLCAT(NameBuff, "doc/*.??[tx]",
sizeof(NameBuff)) >= MAXPATHL) {
- EMSG(_(e_fnametoolong));
+ emsg(_(e_fnametoolong));
continue;
}
@@ -5504,7 +5504,7 @@ static void helptags_one(char_u *dir, const char_u *ext, const char_u *tagfname,
if (dirlen >= MAXPATHL
|| STRLCAT(NameBuff, "/**/*", sizeof(NameBuff)) >= MAXPATHL // NOLINT
|| STRLCAT(NameBuff, ext, sizeof(NameBuff)) >= MAXPATHL) {
- EMSG(_(e_fnametoolong));
+ emsg(_(e_fnametoolong));
return;
}
@@ -5515,7 +5515,7 @@ static void helptags_one(char_u *dir, const char_u *ext, const char_u *tagfname,
EW_FILE|EW_SILENT) == FAIL
|| filecount == 0) {
if (!got_int) {
- EMSG2(_("E151: No match: %s"), NameBuff);
+ semsg(_("E151: No match: %s"), NameBuff);
}
return;
}
@@ -5527,14 +5527,14 @@ static void helptags_one(char_u *dir, const char_u *ext, const char_u *tagfname,
memcpy(NameBuff, dir, dirlen + 1);
if (!add_pathsep((char *)NameBuff)
|| STRLCAT(NameBuff, tagfname, sizeof(NameBuff)) >= MAXPATHL) {
- EMSG(_(e_fnametoolong));
+ emsg(_(e_fnametoolong));
return;
}
FILE *const fd_tags = os_fopen((char *)NameBuff, "w");
if (fd_tags == NULL) {
if (!ignore_writeerr) {
- EMSG2(_("E152: Cannot open %s for writing"), NameBuff);
+ semsg(_("E152: Cannot open %s for writing"), NameBuff);
}
FreeWild(filecount, files);
return;
@@ -5556,7 +5556,7 @@ static void helptags_one(char_u *dir, const char_u *ext, const char_u *tagfname,
for (int fi = 0; fi < filecount && !got_int; fi++) {
FILE *const fd = os_fopen((char *)files[fi], "r");
if (fd == NULL) {
- EMSG2(_("E153: Unable to open %s for reading"), files[fi]);
+ semsg(_("E153: Unable to open %s for reading"), files[fi]);
continue;
}
const char_u *const fname = files[fi] + dirlen + 1;
@@ -5584,7 +5584,7 @@ static void helptags_one(char_u *dir, const char_u *ext, const char_u *tagfname,
if (utf8 == kNone) { // first file
utf8 = this_utf8;
} else if (utf8 != this_utf8) {
- EMSG2(_("E670: Mix of help file encodings within a language: %s"),
+ semsg(_("E670: Mix of help file encodings within a language: %s"),
files[fi]);
mix = !got_int;
got_int = TRUE;
@@ -5643,7 +5643,7 @@ static void helptags_one(char_u *dir, const char_u *ext, const char_u *tagfname,
vim_snprintf((char *)NameBuff, MAXPATHL,
_("E154: Duplicate tag \"%s\" in file %s/%s"),
((char_u **)ga.ga_data)[i], dir, p2 + 1);
- EMSG(NameBuff);
+ emsg((char *)NameBuff);
*p2 = '\t';
break;
}
@@ -5699,7 +5699,7 @@ static void do_helptags(char_u *dirname, bool add_help_tags, bool ignore_writeer
STRLCPY(NameBuff, dirname, sizeof(NameBuff));
if (!add_pathsep((char *)NameBuff)
|| STRLCAT(NameBuff, "**", sizeof(NameBuff)) >= MAXPATHL) {
- EMSG(_(e_fnametoolong));
+ emsg(_(e_fnametoolong));
return;
}
@@ -5709,7 +5709,7 @@ static void do_helptags(char_u *dirname, bool add_help_tags, bool ignore_writeer
if (gen_expand_wildcards(1, buff_list, &filecount, &files,
EW_FILE|EW_SILENT) == FAIL
|| filecount == 0) {
- EMSG2(_("E151: No match: %s"), NameBuff);
+ semsg(_("E151: No match: %s"), NameBuff);
return;
}
@@ -5804,7 +5804,7 @@ void ex_helptags(exarg_T *eap)
dirname = ExpandOne(&xpc, eap->arg, NULL,
WILD_LIST_NOTFOUND|WILD_SILENT, WILD_EXPAND_FREE);
if (dirname == NULL || !os_isdir(dirname)) {
- EMSG2(_("E150: Not a directory: %s"), eap->arg);
+ semsg(_("E150: Not a directory: %s"), eap->arg);
} else {
do_helptags(dirname, add_help_tags, false);
}
diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c
index 1dd37c0471..8cb4a3924c 100644
--- a/src/nvim/ex_cmds2.c
+++ b/src/nvim/ex_cmds2.c
@@ -110,7 +110,7 @@ void ex_profile(exarg_T *eap)
profile_set_wait(profile_zero());
set_vim_var_nr(VV_PROFILING, 1L);
} else if (do_profiling == PROF_NONE) {
- EMSG(_("E750: First use \":profile start {fname}\""));
+ emsg(_("E750: First use \":profile start {fname}\""));
} else if (STRCMP(eap->arg, "stop") == 0) {
profile_dump();
do_profiling = PROF_NONE;
@@ -256,7 +256,7 @@ void profile_dump(void)
if (profile_fname != NULL) {
fd = os_fopen((char *)profile_fname, "w");
if (fd == NULL) {
- EMSG2(_(e_notopen), profile_fname);
+ semsg(_(e_notopen), profile_fname);
} else {
script_dump_profile(fd);
func_dump_profile(fd);
@@ -748,8 +748,8 @@ bool check_changed_any(bool hidden, bool unload)
msg_didout = false;
}
if ((buf->terminal && channel_job_running((uint64_t)buf->b_p_channel))
- ? EMSG2(_("E947: Job still running in buffer \"%s\""), buf->b_fname)
- : EMSG2(_("E162: No write since last change for buffer \"%s\""),
+ ? semsg(_("E947: Job still running in buffer \"%s\""), buf->b_fname)
+ : semsg(_("E162: No write since last change for buffer \"%s\""),
buf_spname(buf) != NULL ? buf_spname(buf) : buf->b_fname)) {
save = no_wait_return;
no_wait_return = false;
@@ -790,7 +790,7 @@ theend:
int check_fname(void)
{
if (curbuf->b_ffname == NULL) {
- EMSG(_(e_noname));
+ emsg(_(e_noname));
return FAIL;
}
return OK;
@@ -964,7 +964,7 @@ static int do_arglist(char_u *str, int what, int after, bool will_edit)
vim_regfree(regmatch.regprog);
xfree(p);
if (!didone) {
- EMSG2(_(e_nomatch2), ((char_u **)new_ga.ga_data)[i]);
+ semsg(_(e_nomatch2), ((char_u **)new_ga.ga_data)[i]);
}
}
ga_clear(&new_ga);
@@ -974,7 +974,7 @@ static int do_arglist(char_u *str, int what, int after, bool will_edit)
EW_DIR|EW_FILE|EW_ADDSLASH|EW_NOTFOUND);
ga_clear(&new_ga);
if (i == FAIL || exp_count == 0) {
- EMSG(_(e_nomatch));
+ emsg(_(e_nomatch));
return FAIL;
}
@@ -1135,11 +1135,11 @@ void do_argfile(exarg_T *eap, int argn)
if (argn < 0 || argn >= ARGCOUNT) {
if (ARGCOUNT <= 1) {
- EMSG(_("E163: There is only one file to edit"));
+ emsg(_("E163: There is only one file to edit"));
} else if (argn < 0) {
- EMSG(_("E164: Cannot go before first file"));
+ emsg(_("E164: Cannot go before first file"));
} else {
- EMSG(_("E165: Cannot go beyond last file"));
+ emsg(_("E165: Cannot go beyond last file"));
}
} else {
setpcmark();
@@ -1252,7 +1252,7 @@ void ex_argdelete(exarg_T *eap)
// ":argdel" works like ":.argdel"
if (eap->addr_count == 0) {
if (curwin->w_arg_idx >= ARGCOUNT) {
- EMSG(_("E610: No argument to delete"));
+ emsg(_("E610: No argument to delete"));
return;
}
eap->line1 = eap->line2 = curwin->w_arg_idx + 1;
@@ -1263,11 +1263,11 @@ void ex_argdelete(exarg_T *eap)
linenr_T n = eap->line2 - eap->line1 + 1;
if (*eap->arg != NUL) {
// Can't have both a range and an argument.
- EMSG(_(e_invarg));
+ emsg(_(e_invarg));
} else if (n <= 0) {
// Don't give an error for ":%argdel" if the list is empty.
if (eap->line1 != 1 || eap->line2 != 0) {
- EMSG(_(e_invrange));
+ emsg(_(e_invrange));
}
} else {
for (linenr_T i = eap->line1; i <= eap->line2; i++) {
@@ -1617,7 +1617,7 @@ void ex_compiler(exarg_T *eap)
// Try lua compiler
snprintf((char *)buf, bufsize, "compiler/%s.lua", eap->arg);
if (source_runtime((char *)buf, DIP_ALL) == FAIL) {
- EMSG2(_("E666: compiler not supported: %s"), eap->arg);
+ semsg(_("E666: compiler not supported: %s"), eap->arg);
}
}
xfree(buf);
@@ -1797,7 +1797,7 @@ static void cmd_source(char_u *fname, exarg_T *eap)
// ":source" read ex commands
} else if (do_source((char *)fname, false, DOSO_NONE) == FAIL) {
- EMSG2(_(e_notopen), fname);
+ semsg(_(e_notopen), fname);
}
}
@@ -2251,7 +2251,7 @@ int do_source(char *fname, int check_other, int is_vimrc)
}
if (got_int) {
- EMSG(_(e_interr));
+ emsg(_(e_interr));
}
sourcing_name = save_sourcing_name;
sourcing_lnum = save_sourcing_lnum;
@@ -2307,7 +2307,7 @@ void ex_scriptnames(exarg_T *eap)
if (eap->addr_count > 0) {
// :script {scriptId}: edit the script
if (eap->line2 < 1 || eap->line2 > script_items.ga_len) {
- EMSG(_(e_invarg));
+ emsg(_(e_invarg));
} else {
eap->arg = SCRIPT_ITEM(eap->line2).sn_name;
do_exedit(eap, NULL);
@@ -2553,7 +2553,7 @@ retry:
} else { // lines like ":map xx yy^M" will have failed
if (!sp->error) {
msg_source(HL_ATTR(HLF_W));
- EMSG(_("W15: Warning: Wrong line separator, ^M may be missing"));
+ emsg(_("W15: Warning: Wrong line separator, ^M may be missing"));
}
sp->error = true;
sp->fileformat = EOL_UNIX;
@@ -2667,7 +2667,7 @@ void ex_scriptencoding(exarg_T *eap)
char_u *name;
if (!getline_equal(eap->getline, eap->cookie, getsourceline)) {
- EMSG(_("E167: :scriptencoding used outside of a sourced file"));
+ emsg(_("E167: :scriptencoding used outside of a sourced file"));
return;
}
@@ -2692,7 +2692,7 @@ void ex_finish(exarg_T *eap)
if (getline_equal(eap->getline, eap->cookie, getsourceline)) {
do_finish(eap, false);
} else {
- EMSG(_("E168: :finish used outside of a sourced file"));
+ emsg(_("E168: :finish used outside of a sourced file"));
}
}
@@ -2939,7 +2939,7 @@ void ex_language(exarg_T *eap)
}
# endif
if (loc == NULL) {
- EMSG2(_("E197: Cannot set language to \"%s\""), name);
+ semsg(_("E197: Cannot set language to \"%s\""), name);
} else {
# ifdef HAVE_NL_MSG_CAT_CNTR
// Need to do this for GNU gettext, otherwise cached translations
diff --git a/src/nvim/ex_cmds_defs.h b/src/nvim/ex_cmds_defs.h
index 3d6d17aee1..6e5dd144ad 100644
--- a/src/nvim/ex_cmds_defs.h
+++ b/src/nvim/ex_cmds_defs.h
@@ -168,7 +168,7 @@ struct exarg {
int force_enc; ///< ++enc= argument (index in cmd[])
int bad_char; ///< BAD_KEEP, BAD_DROP or replacement byte
int useridx; ///< user command index
- char_u *errmsg; ///< returned error message
+ char *errmsg; ///< returned error message
LineGetter getline; ///< Function used to get the next line
void *cookie; ///< argument for getline()
cstack_T *cstack; ///< condition stack for ":if" etc.
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c
index 9412bff2e6..b0d44651fc 100644
--- a/src/nvim/ex_docmd.c
+++ b/src/nvim/ex_docmd.c
@@ -228,7 +228,7 @@ void do_exmode(void)
if ((prev_line != curwin->w_cursor.lnum
|| changedtick != buf_get_changedtick(curbuf)) && !ex_no_reprint) {
if (curbuf->b_ml.ml_flags & ML_EMPTY) {
- EMSG(_(e_emptybuf));
+ emsg(_(e_emptybuf));
} else {
if (ex_pressedreturn) {
// go up one line, to overwrite the ":<CR>" line, so the
@@ -244,9 +244,9 @@ void do_exmode(void)
}
} else if (ex_pressedreturn && !ex_no_reprint) { // must be at EOF
if (curbuf->b_ml.ml_flags & ML_EMPTY) {
- EMSG(_(e_emptybuf));
+ emsg(_(e_emptybuf));
} else {
- EMSG(_("E501: At end-of-file"));
+ emsg(_("E501: At end-of-file"));
}
}
}
@@ -354,7 +354,7 @@ int do_cmdline(char_u *cmdline, LineGetter fgetline, void *cookie, int flags)
// here. The value of 200 allows nested function calls, ":source", etc.
// Allow 200 or 'maxfuncdepth', whatever is larger.
if (call_depth >= 200 && call_depth >= p_mfd) {
- EMSG(_("E169: Command too recursive"));
+ emsg(_("E169: Command too recursive"));
// When converting to an exception, we do not include the command name
// since this is not an error of the specific command.
do_errthrow((cstack_T *)NULL, (char_u *)NULL);
@@ -777,13 +777,13 @@ int do_cmdline(char_u *cmdline, LineGetter fgetline, void *cookie, int flags)
|| (getline_equal(fgetline, cookie, get_func_line)
&& !func_has_ended(real_cookie)))) {
if (cstack.cs_flags[cstack.cs_idx] & CSF_TRY) {
- EMSG(_(e_endtry));
+ emsg(_(e_endtry));
} else if (cstack.cs_flags[cstack.cs_idx] & CSF_WHILE) {
- EMSG(_(e_endwhile));
+ emsg(_(e_endwhile));
} else if (cstack.cs_flags[cstack.cs_idx] & CSF_FOR) {
- EMSG(_(e_endfor));
+ emsg(_(e_endfor));
} else {
- EMSG(_(e_endif));
+ emsg(_(e_endif));
}
}
@@ -1256,7 +1256,7 @@ static char_u *do_one_cmd(char_u **cmdlinep, int flags, cstack_T *cstack, LineGe
char_u *p;
linenr_T lnum;
long n;
- char_u *errormsg = NULL; // error message
+ char *errormsg = NULL; // error message
char_u *after_modifier = NULL;
exarg_T ea;
const int save_msg_scroll = msg_scroll;
@@ -1435,7 +1435,7 @@ static char_u *do_one_cmd(char_u **cmdlinep, int flags, cstack_T *cstack, LineGe
}
if (ea.line2 < 0) {
- errormsg = (char_u *)_(e_invrange);
+ errormsg = _(e_invrange);
} else {
if (ea.line2 == 0) {
curwin->w_cursor.lnum = 1;
@@ -1467,7 +1467,7 @@ static char_u *do_one_cmd(char_u **cmdlinep, int flags, cstack_T *cstack, LineGe
if (p == NULL) {
if (!ea.skip) {
- errormsg = (char_u *)_("E464: Ambiguous use of user-defined command");
+ errormsg = _("E464: Ambiguous use of user-defined command");
}
goto doend;
}
@@ -1481,7 +1481,7 @@ static char_u *do_one_cmd(char_u **cmdlinep, int flags, cstack_T *cstack, LineGe
if (!(flags & DOCMD_VERBOSE)) {
append_command(cmdname);
}
- errormsg = IObuff;
+ errormsg = (char *)IObuff;
did_emsg_syntax = true;
verify_command(cmdname);
}
@@ -1511,21 +1511,21 @@ static char_u *do_one_cmd(char_u **cmdlinep, int flags, cstack_T *cstack, LineGe
if (!ea.skip) {
if (sandbox != 0 && !(ea.argt & EX_SBOXOK)) {
// Command not allowed in sandbox.
- errormsg = (char_u *)_(e_sandbox);
+ errormsg = _(e_sandbox);
goto doend;
}
if (!MODIFIABLE(curbuf) && (ea.argt & EX_MODIFY)
// allow :put in terminals
&& (!curbuf->terminal || ea.cmdidx != CMD_put)) {
// Command not allowed in non-'modifiable' buffer
- errormsg = (char_u *)_(e_modifiable);
+ errormsg = _(e_modifiable);
goto doend;
}
if (text_locked() && !(ea.argt & EX_CMDWIN)
&& !IS_USER_CMDIDX(ea.cmdidx)) {
// Command not allowed when editing the command line.
- errormsg = (char_u *)_(get_text_locked_msg());
+ errormsg = _(get_text_locked_msg());
goto doend;
}
@@ -1544,13 +1544,13 @@ static char_u *do_one_cmd(char_u **cmdlinep, int flags, cstack_T *cstack, LineGe
if (!ni && !(ea.argt & EX_RANGE) && ea.addr_count > 0) {
// no range allowed
- errormsg = (char_u *)_(e_norange);
+ errormsg = _(e_norange);
goto doend;
}
}
if (!ni && !(ea.argt & EX_BANG) && ea.forceit) { // no <!> allowed
- errormsg = (char_u *)_(e_nobang);
+ errormsg = _(e_nobang);
goto doend;
}
@@ -1565,7 +1565,7 @@ static char_u *do_one_cmd(char_u **cmdlinep, int flags, cstack_T *cstack, LineGe
if (!global_busy && ea.line1 > ea.line2) {
if (msg_silent == 0) {
if ((flags & DOCMD_VERBOSE) || exmode_active) {
- errormsg = (char_u *)_("E493: Backwards range given");
+ errormsg = _("E493: Backwards range given");
goto doend;
}
if (ask_yesno(_("Backwards range given, OK to swap"), false) != 'y') {
@@ -1627,7 +1627,7 @@ static char_u *do_one_cmd(char_u **cmdlinep, int flags, cstack_T *cstack, LineGe
if (ea.argt & EX_ARGOPT) {
while (ea.arg[0] == '+' && ea.arg[1] == '+') {
if (getargopt(&ea) == FAIL && !ni) {
- errormsg = (char_u *)_(e_invarg);
+ errormsg = _(e_invarg);
goto doend;
}
}
@@ -1636,7 +1636,7 @@ static char_u *do_one_cmd(char_u **cmdlinep, int flags, cstack_T *cstack, LineGe
if (ea.cmdidx == CMD_write || ea.cmdidx == CMD_update) {
if (*ea.arg == '>') { // append
if (*++ea.arg != '>') { // typed wrong
- errormsg = (char_u *)_("E494: Use w or w>>");
+ errormsg = _("E494: Use w or w>>");
goto doend;
}
ea.arg = skipwhite(ea.arg + 1);
@@ -1755,7 +1755,7 @@ static char_u *do_one_cmd(char_u **cmdlinep, int flags, cstack_T *cstack, LineGe
case ADDR_NONE:
case ADDR_UNSIGNED:
case ADDR_QUICKFIX:
- IEMSG(_("INTERNAL: Cannot use EX_DFLALL "
+ iemsg(_("INTERNAL: Cannot use EX_DFLALL "
"with ADDR_NONE, ADDR_UNSIGNED or ADDR_QUICKFIX"));
break;
}
@@ -1789,7 +1789,7 @@ static char_u *do_one_cmd(char_u **cmdlinep, int flags, cstack_T *cstack, LineGe
n = getdigits_long(&ea.arg, false, -1);
ea.arg = skipwhite(ea.arg);
if (n <= 0 && !ni && (ea.argt & EX_ZEROR) == 0) {
- errormsg = (char_u *)_(e_zerocount);
+ errormsg = _(e_zerocount);
goto doend;
}
if (ea.addr_type != ADDR_LINES) { // e.g. :buffer 2, :sleep 3
@@ -1817,12 +1817,12 @@ static char_u *do_one_cmd(char_u **cmdlinep, int flags, cstack_T *cstack, LineGe
if (!ni && !(ea.argt & EX_EXTRA) && *ea.arg != NUL
&& *ea.arg != '"' && (*ea.arg != '|' || (ea.argt & EX_TRLBAR) == 0)) {
// no arguments allowed but there is something
- errormsg = (char_u *)_(e_trailing);
+ errormsg = _(e_trailing);
goto doend;
}
if (!ni && (ea.argt & EX_NEEDARG) && *ea.arg == NUL) {
- errormsg = (char_u *)_(e_argreq);
+ errormsg = _(e_argreq);
goto doend;
}
@@ -1982,7 +1982,7 @@ static char_u *do_one_cmd(char_u **cmdlinep, int flags, cstack_T *cstack, LineGe
ea.errmsg = NULL;
(cmdnames[ea.cmdidx].cmd_func)(&ea);
if (ea.errmsg != NULL) {
- errormsg = (char_u *)_(ea.errmsg);
+ errormsg = _(ea.errmsg);
}
}
@@ -2014,9 +2014,9 @@ doend:
if (errormsg != NULL && *errormsg != NUL && !did_emsg) {
if (flags & DOCMD_VERBOSE) {
- if (errormsg != IObuff) {
+ if (errormsg != (char *)IObuff) {
STRCPY(IObuff, errormsg);
- errormsg = IObuff;
+ errormsg = (char *)IObuff;
}
append_command(*cmdlinep);
}
@@ -2056,7 +2056,7 @@ doend:
// "cmdmod".
// Return FAIL when the command is not to be executed.
// May set "errormsg" to an error message.
-int parse_command_modifiers(exarg_T *eap, char_u **errormsg, bool skip_only)
+int parse_command_modifiers(exarg_T *eap, char **errormsg, bool skip_only)
{
char_u *p;
@@ -2260,7 +2260,7 @@ int parse_command_modifiers(exarg_T *eap, char_u **errormsg, bool skip_only)
cmdmod.tab = tabpage_index(curtab) + 1;
} else {
if (tabnr < 0 || tabnr > LAST_TAB_NR) {
- *errormsg = (char_u *)_(e_invrange);
+ *errormsg = _(e_invrange);
return false;
}
cmdmod.tab = tabnr + 1;
@@ -2356,7 +2356,7 @@ static void undo_cmdmod(const exarg_T *eap, int save_msg_scroll)
// Parse the address range, if any, in "eap".
// May set the last search pattern, unless "silent" is true.
// Return FAIL and set "errormsg" or return OK.
-int parse_cmd_address(exarg_T *eap, char_u **errormsg, bool silent)
+int parse_cmd_address(exarg_T *eap, char **errormsg, bool silent)
FUNC_ATTR_NONNULL_ALL
{
int address_count = 1;
@@ -2443,14 +2443,14 @@ int parse_cmd_address(exarg_T *eap, char_u **errormsg, bool silent)
} else {
// there is no Vim command which uses '%' and
// ADDR_WINDOWS or ADDR_TABS
- *errormsg = (char_u *)_(e_invrange);
+ *errormsg = _(e_invrange);
return FAIL;
}
break;
case ADDR_TABS_RELATIVE:
case ADDR_UNSIGNED:
case ADDR_QUICKFIX:
- *errormsg = (char_u *)_(e_invrange);
+ *errormsg = _(e_invrange);
return FAIL;
case ADDR_ARGUMENTS:
if (ARGCOUNT == 0) {
@@ -2475,7 +2475,7 @@ int parse_cmd_address(exarg_T *eap, char_u **errormsg, bool silent)
} else if (*eap->cmd == '*') {
// '*' - visual area
if (eap->addr_type != ADDR_LINES) {
- *errormsg = (char_u *)_(e_invrange);
+ *errormsg = _(e_invrange);
return FAIL;
}
@@ -3829,9 +3829,9 @@ char_u *skip_range(const char_u *cmd, int *ctx)
static void addr_error(cmd_addr_T addr_type)
{
if (addr_type == ADDR_NONE) {
- EMSG(_(e_norange));
+ emsg(_(e_norange));
} else {
- EMSG(_(e_invrange));
+ emsg(_(e_invrange));
}
}
@@ -4042,7 +4042,7 @@ static linenr_T get_address(exarg_T *eap, char_u **ptr, cmd_addr_T addr_type, in
} else if (*cmd == '?' || *cmd == '/') {
i = RE_SEARCH;
} else {
- EMSG(_(e_backslash));
+ emsg(_(e_backslash));
cmd = NULL;
goto error;
}
@@ -4125,7 +4125,7 @@ static linenr_T get_address(exarg_T *eap, char_u **ptr, cmd_addr_T addr_type, in
}
if (addr_type == ADDR_TABS_RELATIVE) {
- EMSG(_(e_invrange));
+ emsg(_(e_invrange));
cmd = NULL;
goto error;
} else if (addr_type == ADDR_LOADED_BUFFERS || addr_type == ADDR_BUFFERS) {
@@ -4172,7 +4172,7 @@ static void get_flags(exarg_T *eap)
void ex_ni(exarg_T *eap)
{
if (!eap->skip) {
- eap->errmsg = (char_u *)N_("E319: The command is not available in this version");
+ eap->errmsg = N_("E319: The command is not available in this version");
}
}
@@ -4192,11 +4192,11 @@ static void ex_script_ni(exarg_T *eap)
* Check range in Ex command for validity.
* Return NULL when valid, error message when invalid.
*/
-static char_u *invalid_range(exarg_T *eap)
+static char *invalid_range(exarg_T *eap)
{
buf_T *buf;
if (eap->line1 < 0 || eap->line2 < 0 || eap->line1 > eap->line2) {
- return (char_u *)_(e_invrange);
+ return _(e_invrange);
}
if (eap->argt & EX_RANGE) {
@@ -4204,51 +4204,51 @@ static char_u *invalid_range(exarg_T *eap)
case ADDR_LINES:
if (eap->line2 > (curbuf->b_ml.ml_line_count
+ (eap->cmdidx == CMD_diffget))) {
- return (char_u *)_(e_invrange);
+ return _(e_invrange);
}
break;
case ADDR_ARGUMENTS:
// add 1 if ARGCOUNT is 0
if (eap->line2 > ARGCOUNT + (!ARGCOUNT)) {
- return (char_u *)_(e_invrange);
+ return _(e_invrange);
}
break;
case ADDR_BUFFERS:
if (eap->line1 < firstbuf->b_fnum
|| eap->line2 > lastbuf->b_fnum) {
- return (char_u *)_(e_invrange);
+ return _(e_invrange);
}
break;
case ADDR_LOADED_BUFFERS:
buf = firstbuf;
while (buf->b_ml.ml_mfp == NULL) {
if (buf->b_next == NULL) {
- return (char_u *)_(e_invrange);
+ return _(e_invrange);
}
buf = buf->b_next;
}
if (eap->line1 < buf->b_fnum) {
- return (char_u *)_(e_invrange);
+ return _(e_invrange);
}
buf = lastbuf;
while (buf->b_ml.ml_mfp == NULL) {
if (buf->b_prev == NULL) {
- return (char_u *)_(e_invrange);
+ return _(e_invrange);
}
buf = buf->b_prev;
}
if (eap->line2 > buf->b_fnum) {
- return (char_u *)_(e_invrange);
+ return _(e_invrange);
}
break;
case ADDR_WINDOWS:
if (eap->line2 > LAST_WIN_NR) {
- return (char_u *)_(e_invrange);
+ return _(e_invrange);
}
break;
case ADDR_TABS:
if (eap->line2 > LAST_TAB_NR) {
- return (char_u *)_(e_invrange);
+ return _(e_invrange);
}
break;
case ADDR_TABS_RELATIVE:
@@ -4259,13 +4259,13 @@ static char_u *invalid_range(exarg_T *eap)
assert(eap->line2 >= 0);
// No error for value that is too big, will use the last entry.
if (eap->line2 <= 0) {
- return (char_u *)_(e_invrange);
+ return _(e_invrange);
}
break;
case ADDR_QUICKFIX_VALID:
if ((eap->line2 != 1 && (size_t)eap->line2 > qf_get_valid_size(eap))
|| eap->line2 < 0) {
- return (char_u *)_(e_invrange);
+ return _(e_invrange);
}
break;
case ADDR_UNSIGNED:
@@ -4387,7 +4387,7 @@ static char_u *replace_makeprg(exarg_T *eap, char_u *p, char_u **cmdlinep)
// Expand file name in Ex command argument.
// When an error is detected, "errormsgp" is set to a non-NULL pointer.
// Return FAIL for failure, OK otherwise.
-int expand_filename(exarg_T *eap, char_u **cmdlinep, char_u **errormsgp)
+int expand_filename(exarg_T *eap, char_u **cmdlinep, char **errormsgp)
{
int has_wildcards; // need to expand wildcards
char_u *repl;
@@ -5124,8 +5124,8 @@ static int check_more(int message, bool forceit)
}
return FAIL;
}
- EMSGN(NGETTEXT("E173: %d more file to edit",
- "E173: %d more files to edit", (unsigned long)n), n);
+ semsg(NGETTEXT("E173: %" PRId64 " more file to edit",
+ "E173: %" PRId64 " more files to edit", (unsigned long)n), (int64_t)n);
quitmore = 2; // next try to quit is allowed
}
return FAIL;
@@ -5192,7 +5192,7 @@ static int uc_add_command(char_u *name, size_t name_len, char_u *rep, uint32_t a
if (!force
&& (cmd->uc_script_ctx.sc_sid != current_sctx.sc_sid
|| cmd->uc_script_ctx.sc_seq == current_sctx.sc_seq)) {
- EMSG2(_("E174: Command already exists: add ! to replace it: %s"),
+ semsg(_("E174: Command already exists: add ! to replace it: %s"),
name);
goto fail;
}
@@ -5486,7 +5486,7 @@ static int uc_scan_attr(char_u *attr, size_t len, uint32_t *argt, long *def, int
char_u *p;
if (len == 0) {
- EMSG(_("E175: No attribute specified"));
+ emsg(_("E175: No attribute specified"));
return FAIL;
}
@@ -5532,7 +5532,7 @@ static int uc_scan_attr(char_u *attr, size_t len, uint32_t *argt, long *def, int
}
} else {
wrong_nargs:
- EMSG(_("E176: Invalid number of arguments"));
+ emsg(_("E176: Invalid number of arguments"));
return FAIL;
}
} else if (STRNICMP(attr, "range", attrlen) == 0) {
@@ -5543,7 +5543,7 @@ wrong_nargs:
p = val;
if (*def >= 0) {
two_count:
- EMSG(_("E177: Count cannot be specified twice"));
+ emsg(_("E177: Count cannot be specified twice"));
return FAIL;
}
@@ -5552,7 +5552,7 @@ two_count:
if (p != val + vallen || vallen == 0) {
invalid_count:
- EMSG(_("E178: Invalid default value for count"));
+ emsg(_("E178: Invalid default value for count"));
return FAIL;
}
}
@@ -5585,7 +5585,7 @@ invalid_count:
}
} else if (STRNICMP(attr, "complete", attrlen) == 0) {
if (val == NULL) {
- EMSG(_("E179: argument required for -complete"));
+ emsg(_("E179: argument required for -complete"));
return FAIL;
}
@@ -5596,7 +5596,7 @@ invalid_count:
} else if (STRNICMP(attr, "addr", attrlen) == 0) {
*argt |= EX_RANGE;
if (val == NULL) {
- EMSG(_("E179: argument required for -addr"));
+ emsg(_("E179: argument required for -addr"));
return FAIL;
}
if (parse_addr_type_arg(val, (int)vallen, addr_type_arg) == FAIL) {
@@ -5608,7 +5608,7 @@ invalid_count:
} else {
char_u ch = attr[len];
attr[len] = '\0';
- EMSG2(_("E181: Invalid attribute: %s"), attr);
+ semsg(_("E181: Invalid attribute: %s"), attr);
attr[len] = ch;
return FAIL;
}
@@ -5657,7 +5657,7 @@ static void ex_command(exarg_T *eap)
}
}
if (!ends_excmd(*p) && !ascii_iswhite(*p)) {
- EMSG(_("E182: Invalid command name"));
+ emsg(_("E182: Invalid command name"));
return;
}
end = p;
@@ -5669,11 +5669,11 @@ static void ex_command(exarg_T *eap)
if (!has_attr && ends_excmd(*p)) {
uc_list(name, end - name);
} else if (!ASCII_ISUPPER(*name)) {
- EMSG(_("E183: User defined commands must start with an uppercase letter"));
+ emsg(_("E183: User defined commands must start with an uppercase letter"));
} else if (name_len <= 4 && STRNCMP(name, "Next", name_len) == 0) {
- EMSG(_("E841: Reserved name, cannot be used for user defined command"));
+ emsg(_("E841: Reserved name, cannot be used for user defined command"));
} else if (compl > 0 && (argt & EX_EXTRA) == 0) {
- EMSG(_(e_complete_used_without_nargs));
+ emsg(_(e_complete_used_without_nargs));
} else {
uc_add_command(name, end - name, p, argt, def, flags, compl, compl_arg,
addr_type_arg, eap->forceit);
@@ -5728,7 +5728,7 @@ static void ex_delcommand(exarg_T *eap)
}
if (cmp != 0) {
- EMSG2(_("E184: No such user-defined command: %s"), eap->arg);
+ semsg(_("E184: No such user-defined command: %s"), eap->arg);
return;
}
@@ -6333,7 +6333,7 @@ int parse_addr_type_arg(char_u *value, int vallen, cmd_addr_T *addr_type_arg)
for (i = 0; err[i] != NUL && !ascii_iswhite(err[i]); i++) {}
err[i] = NUL;
- EMSG2(_("E180: Invalid address type value: %s"), err);
+ semsg(_("E180: Invalid address type value: %s"), err);
return FAIL;
}
@@ -6383,19 +6383,19 @@ int parse_compl_arg(const char_u *value, int vallen, int *complp, uint32_t *argt
}
if (i == (int)ARRAY_SIZE(command_complete)) {
- EMSG2(_("E180: Invalid complete value: %s"), value);
+ semsg(_("E180: Invalid complete value: %s"), value);
return FAIL;
}
if (*complp != EXPAND_USER_DEFINED && *complp != EXPAND_USER_LIST
&& arg != NULL) {
- EMSG(_("E468: Completion argument only allowed for custom completion"));
+ emsg(_("E468: Completion argument only allowed for custom completion"));
return FAIL;
}
if ((*complp == EXPAND_USER_DEFINED || *complp == EXPAND_USER_LIST)
&& arg == NULL) {
- EMSG(_("E467: Custom completion requires a function argument"));
+ emsg(_("E467: Custom completion requires a function argument"));
return FAIL;
}
@@ -6438,7 +6438,7 @@ static void ex_colorscheme(exarg_T *eap)
MSG("default");
}
} else if (load_colors(eap->arg) == FAIL) {
- EMSG2(_("E185: Cannot find color scheme '%s'"), eap->arg);
+ semsg(_("E185: Cannot find color scheme '%s'"), eap->arg);
}
}
@@ -6642,7 +6642,7 @@ void ex_win_close(int forceit, win_T *win, tabpage_T *tp)
// Never close the autocommand window.
if (win == aucmd_win) {
- EMSG(_(e_autocmd_close));
+ emsg(_(e_autocmd_close));
return;
}
@@ -6682,7 +6682,7 @@ static void ex_tabclose(exarg_T *eap)
if (cmdwin_type != 0) {
cmdwin_result = K_IGNORE;
} else if (first_tabpage->tp_next == NULL) {
- EMSG(_("E784: Cannot close last tab page"));
+ emsg(_("E784: Cannot close last tab page"));
} else {
int tab_number = get_tabpage_arg(eap);
if (eap->errmsg == NULL) {
@@ -6912,7 +6912,7 @@ static void ex_exit(exarg_T *eap)
static void ex_print(exarg_T *eap)
{
if (curbuf->b_ml.ml_flags & ML_EMPTY) {
- EMSG(_(e_emptybuf));
+ emsg(_(e_emptybuf));
} else {
for (; !got_int; os_breakcheck()) {
print_line(eap->line1,
@@ -7026,7 +7026,7 @@ void alist_set(alist_T *al, int count, char_u **files, int use_curbuf, int *fnum
static int recursive = 0;
if (recursive) {
- EMSG(_(e_au_recursive));
+ emsg(_(e_au_recursive));
return;
}
recursive++;
@@ -7346,7 +7346,7 @@ static void ex_mode(exarg_T *eap)
must_redraw = CLEAR;
ex_redraw(eap);
} else {
- EMSG(_(e_screenmode));
+ emsg(_(e_screenmode));
}
}
@@ -7550,7 +7550,7 @@ void do_exedit(exarg_T *eap, win_T *old_curwin)
/// ":gui" and ":gvim" when there is no GUI.
static void ex_nogui(exarg_T *eap)
{
- eap->errmsg = (char_u *)N_("E25: Nvim does not have a built-in GUI");
+ eap->errmsg = N_("E25: Nvim does not have a built-in GUI");
}
@@ -7662,7 +7662,7 @@ static void ex_read(exarg_T *eap)
}
if (i != OK) {
if (!aborting()) {
- EMSG2(_(e_notopen), eap->arg);
+ semsg(_(e_notopen), eap->arg);
}
} else {
if (empty && exmode_active) {
@@ -7778,7 +7778,7 @@ bool changedir_func(char_u *new_dir, CdScope scope)
if (STRCMP(new_dir, "-") == 0) {
pdir = get_prevdir(scope);
if (pdir == NULL) {
- EMSG(_("E186: No previous directory"));
+ emsg(_("E186: No previous directory"));
return false;
}
new_dir = pdir;
@@ -7818,7 +7818,7 @@ bool changedir_func(char_u *new_dir, CdScope scope)
post_chdir(scope, dir_differs);
retval = true;
} else {
- EMSG(_(e_failed));
+ emsg(_(e_failed));
}
xfree(tofree);
@@ -7880,7 +7880,7 @@ static void ex_pwd(exarg_T *eap)
msg(NameBuff);
}
} else {
- EMSG(_("E187: Unknown"));
+ emsg(_("E187: Unknown"));
}
}
@@ -7912,7 +7912,7 @@ static void ex_sleep(exarg_T *eap)
case NUL:
len *= 1000L; break;
default:
- EMSG2(_(e_invarg2), eap->arg); return;
+ semsg(_(e_invarg2), eap->arg); return;
}
do_sleep(len);
}
@@ -7947,10 +7947,10 @@ static void do_exmap(exarg_T *eap, int isabbrev)
switch (do_map((*cmdp == 'n') ? 2 : (*cmdp == 'u'),
eap->arg, mode, isabbrev)) {
case 1:
- EMSG(_(e_invarg));
+ emsg(_(e_invarg));
break;
case 2:
- EMSG(isabbrev ? _(e_noabbr) : _(e_nomap));
+ emsg(isabbrev ? _(e_noabbr) : _(e_nomap));
break;
}
}
@@ -7963,7 +7963,7 @@ static void ex_winsize(exarg_T *eap)
char_u *arg = eap->arg;
if (!ascii_isdigit(*arg)) {
- EMSG2(_(e_invarg2), arg);
+ semsg(_(e_invarg2), arg);
return;
}
int w = getdigits_int(&arg, false, 10);
@@ -7973,7 +7973,7 @@ static void ex_winsize(exarg_T *eap)
if (*p != NUL && *arg == NUL) {
screen_resize(w, h);
} else {
- EMSG(_("E465: :winsize requires two number arguments"));
+ emsg(_("E465: :winsize requires two number arguments"));
}
}
@@ -7985,7 +7985,7 @@ static void ex_wincmd(exarg_T *eap)
if (*eap->arg == 'g' || *eap->arg == Ctrl_G) {
// CTRL-W g and CTRL-W CTRL-G have an extra command character
if (eap->arg[1] == NUL) {
- EMSG(_(e_invarg));
+ emsg(_(e_invarg));
return;
}
xchar = eap->arg[1];
@@ -7997,7 +7997,7 @@ static void ex_wincmd(exarg_T *eap)
eap->nextcmd = check_nextcmd(p);
p = skipwhite(p);
if (*p != NUL && *p != '"' && eap->nextcmd == NULL) {
- EMSG(_(e_invarg));
+ emsg(_(e_invarg));
} else if (!eap->skip) {
// Pass flags on for ":vertical wincmd ]".
postponed_split_flags = cmdmod.split;
@@ -8088,7 +8088,7 @@ static void ex_copymove(exarg_T *eap)
* move or copy lines from 'eap->line1'-'eap->line2' to below line 'n'
*/
if (n == MAXLNUM || n < 0 || n > curbuf->b_ml.ml_line_count) {
- EMSG(_(e_invrange));
+ emsg(_(e_invrange));
return;
}
@@ -8254,7 +8254,7 @@ static void ex_later(exarg_T *eap)
}
if (*p != NUL) {
- EMSG2(_(e_invarg2), eap->arg);
+ semsg(_(e_invarg2), eap->arg);
} else {
undo_time(eap->cmdidx == CMD_earlier ? -count : count,
sec, file, false);
@@ -8315,7 +8315,7 @@ static void ex_redir(exarg_T *eap)
}
if (*arg != NUL) {
redir_reg = 0;
- EMSG2(_(e_invarg2), eap->arg);
+ semsg(_(e_invarg2), eap->arg);
}
} else if (*arg == '=' && arg[1] == '>') {
int append;
@@ -8337,7 +8337,7 @@ static void ex_redir(exarg_T *eap)
}
// TODO: redirect to a buffer
else {
- EMSG2(_(e_invarg2), eap->arg);
+ semsg(_(e_invarg2), eap->arg);
}
}
@@ -8446,7 +8446,7 @@ int vim_mkdir_emsg(const char *const name, const int prot)
{
int ret;
if ((ret = os_mkdir(name, prot)) != 0) {
- EMSG3(_(e_mkdir), name, os_strerror(ret));
+ semsg(_(e_mkdir), name, os_strerror(ret));
return FAIL;
}
return OK;
@@ -8464,17 +8464,17 @@ FILE *open_exfile(char_u *fname, int forceit, char *mode)
#ifdef UNIX
// with Unix it is possible to open a directory
if (os_isdir(fname)) {
- EMSG2(_(e_isadir2), fname);
+ semsg(_(e_isadir2), fname);
return NULL;
}
#endif
if (!forceit && *mode != 'a' && os_path_exists(fname)) {
- EMSG2(_("E189: \"%s\" exists (add ! to override)"), fname);
+ semsg(_("E189: \"%s\" exists (add ! to override)"), fname);
return NULL;
}
if ((fd = os_fopen((char *)fname, mode)) == NULL) {
- EMSG2(_("E190: Cannot open \"%s\" for writing"), fname);
+ semsg(_("E190: Cannot open \"%s\" for writing"), fname);
}
return fd;
@@ -8488,15 +8488,15 @@ static void ex_mark(exarg_T *eap)
pos_T pos;
if (*eap->arg == NUL) { // No argument?
- EMSG(_(e_argreq));
+ emsg(_(e_argreq));
} else if (eap->arg[1] != NUL) { // more than one character?
- EMSG(_(e_trailing));
+ emsg(_(e_trailing));
} else {
pos = curwin->w_cursor; // save curwin->w_cursor
curwin->w_cursor.lnum = eap->line2;
beginline(BL_WHITE | BL_FIX);
if (setmark(*eap->arg) == FAIL) { // set mark
- EMSG(_("E191: Argument must be a letter or forward/backward quote"));
+ emsg(_("E191: Argument must be a letter or forward/backward quote"));
}
curwin->w_cursor = pos; // restore curwin->w_cursor
}
@@ -8574,7 +8574,7 @@ void restore_current_state(save_state_T *sst)
static void ex_normal(exarg_T *eap)
{
if (curbuf->terminal && State & TERM_FOCUS) {
- EMSG("Can't re-enter normal mode from terminal mode");
+ emsg("Can't re-enter normal mode from terminal mode");
return;
}
save_state_T save_state;
@@ -8583,11 +8583,11 @@ static void ex_normal(exarg_T *eap)
char_u *p;
if (ex_normal_lock > 0) {
- EMSG(_(e_secure));
+ emsg(_(e_secure));
return;
}
if (ex_normal_busy >= p_mmd) {
- EMSG(_("E192: Recursive use of :normal too deep"));
+ emsg(_("E192: Recursive use of :normal too deep"));
return;
}
@@ -8984,7 +8984,7 @@ ssize_t find_cmdline_var(const char_u *src, size_t *usedlen)
/// Returns NULL if no match was found. "usedlen" then still contains the
/// number of characters to skip.
char_u *eval_vars(char_u *src, char_u *srcstart, size_t *usedlen, linenr_T *lnump,
- char_u **errormsg, int *escaped)
+ char **errormsg, int *escaped)
{
int i;
char_u *s;
@@ -9034,7 +9034,7 @@ char_u *eval_vars(char_u *src, char_u *srcstart, size_t *usedlen, linenr_T *lnum
? (FIND_IDENT | FIND_STRING | FIND_EVAL)
: FIND_STRING));
if (resultlen == 0) {
- *errormsg = (char_u *)"";
+ *errormsg = "";
return NULL;
}
//
@@ -9087,7 +9087,7 @@ char_u *eval_vars(char_u *src, char_u *srcstart, size_t *usedlen, linenr_T *lnum
result = (char_u *)tv_list_find_str(get_vim_var_list(VV_OLDFILES),
i - 1);
if (result == NULL) {
- *errormsg = (char_u *)"";
+ *errormsg = "";
return NULL;
}
} else {
@@ -9096,7 +9096,7 @@ char_u *eval_vars(char_u *src, char_u *srcstart, size_t *usedlen, linenr_T *lnum
}
buf = buflist_findnr(i);
if (buf == NULL) {
- *errormsg = (char_u *)_("E194: No alternate file name to substitute for '#'");
+ *errormsg = _("E194: No alternate file name to substitute for '#'");
return NULL;
}
if (lnump != NULL) {
@@ -9115,7 +9115,7 @@ char_u *eval_vars(char_u *src, char_u *srcstart, size_t *usedlen, linenr_T *lnum
case SPEC_CFILE: // file name under cursor
result = file_name_at_cursor(FNAME_MESS|FNAME_HYP, 1L, NULL);
if (result == NULL) {
- *errormsg = (char_u *)"";
+ *errormsg = "";
return NULL;
}
resultbuf = result; // remember allocated string
@@ -9135,7 +9135,7 @@ char_u *eval_vars(char_u *src, char_u *srcstart, size_t *usedlen, linenr_T *lnum
}
result = autocmd_fname;
if (result == NULL) {
- *errormsg = (char_u *)_("E495: no autocommand file name to substitute for \"<afile>\"");
+ *errormsg = _("E495: no autocommand file name to substitute for \"<afile>\"");
return NULL;
}
result = path_try_shorten_fname(result);
@@ -9143,7 +9143,7 @@ char_u *eval_vars(char_u *src, char_u *srcstart, size_t *usedlen, linenr_T *lnum
case SPEC_ABUF: // buffer number for autocommand
if (autocmd_bufnr <= 0) {
- *errormsg = (char_u *)_("E496: no autocommand buffer number to substitute for \"<abuf>\"");
+ *errormsg = _("E496: no autocommand buffer number to substitute for \"<abuf>\"");
return NULL;
}
snprintf(strbuf, sizeof(strbuf), "%d", autocmd_bufnr);
@@ -9153,7 +9153,7 @@ char_u *eval_vars(char_u *src, char_u *srcstart, size_t *usedlen, linenr_T *lnum
case SPEC_AMATCH: // match name for autocommand
result = autocmd_match;
if (result == NULL) {
- *errormsg = (char_u *)_("E497: no autocommand match name to substitute for \"<amatch>\"");
+ *errormsg = _("E497: no autocommand match name to substitute for \"<amatch>\"");
return NULL;
}
break;
@@ -9161,14 +9161,14 @@ char_u *eval_vars(char_u *src, char_u *srcstart, size_t *usedlen, linenr_T *lnum
case SPEC_SFILE: // file name for ":so" command
result = sourcing_name;
if (result == NULL) {
- *errormsg = (char_u *)_("E498: no :source file name to substitute for \"<sfile>\"");
+ *errormsg = _("E498: no :source file name to substitute for \"<sfile>\"");
return NULL;
}
break;
case SPEC_SLNUM: // line in file for ":so" command
if (sourcing_name == NULL || sourcing_lnum == 0) {
- *errormsg = (char_u *)_("E842: no line number to use for \"<slnum>\"");
+ *errormsg = _("E842: no line number to use for \"<slnum>\"");
return NULL;
}
snprintf(strbuf, sizeof(strbuf), "%" PRIdLINENR, sourcing_lnum);
@@ -9177,7 +9177,7 @@ char_u *eval_vars(char_u *src, char_u *srcstart, size_t *usedlen, linenr_T *lnum
case SPEC_SFLNUM: // line in script file
if (current_sctx.sc_lnum + sourcing_lnum == 0) {
- *errormsg = (char_u *)_("E961: no line number to use for \"<sflnum>\"");
+ *errormsg = _("E961: no line number to use for \"<sflnum>\"");
return NULL;
}
snprintf((char *)strbuf, sizeof(strbuf), "%" PRIdLINENR,
@@ -9187,7 +9187,7 @@ char_u *eval_vars(char_u *src, char_u *srcstart, size_t *usedlen, linenr_T *lnum
case SPEC_SID:
if (current_sctx.sc_sid <= 0) {
- *errormsg = (char_u *)_(e_usingsid);
+ *errormsg = _(e_usingsid);
return NULL;
}
snprintf(strbuf, sizeof(strbuf), "<SNR>%" PRIdSCID "_",
@@ -9197,7 +9197,7 @@ char_u *eval_vars(char_u *src, char_u *srcstart, size_t *usedlen, linenr_T *lnum
default:
// should not happen
- *errormsg = (char_u *)"";
+ *errormsg = "";
result = (char_u *)""; // avoid gcc warning
break;
}
@@ -9214,7 +9214,7 @@ char_u *eval_vars(char_u *src, char_u *srcstart, size_t *usedlen, linenr_T *lnum
valid |= modify_fname(src, tilde_file, usedlen, &result,
&resultbuf, &resultlen);
if (result == NULL) {
- *errormsg = (char_u *)"";
+ *errormsg = "";
return NULL;
}
}
@@ -9223,9 +9223,9 @@ char_u *eval_vars(char_u *src, char_u *srcstart, size_t *usedlen, linenr_T *lnum
if (resultlen == 0 || valid != VALID_HEAD + VALID_PATH) {
if (valid != VALID_HEAD + VALID_PATH) {
// xgettext:no-c-format
- *errormsg = (char_u *)_("E499: Empty file name for '%' or '#', only works with \":p:h\"");
+ *errormsg = _("E499: Empty file name for '%' or '#', only works with \":p:h\"");
} else {
- *errormsg = (char_u *)_("E500: Evaluates to an empty string");
+ *errormsg = _("E500: Evaluates to an empty string");
}
result = NULL;
} else {
@@ -9305,7 +9305,7 @@ static char_u *arg_all(void)
*/
char_u *expand_sfile(char_u *arg)
{
- char_u *errormsg;
+ char *errormsg;
size_t len;
char_u *result;
char_u *newres;
@@ -9395,7 +9395,7 @@ static void ex_behave(exarg_T *eap)
set_option_value("mousemodel", 0L, "extend", 0);
set_option_value("keymodel", 0L, "", 0);
} else {
- EMSG2(_(e_invarg2), eap->arg);
+ semsg(_(e_invarg2), eap->arg);
}
}
@@ -9506,7 +9506,7 @@ static void ex_filetype(exarg_T *eap)
filetype_detect = kFalse;
}
} else {
- EMSG2(_(e_invarg2), arg);
+ semsg(_(e_invarg2), arg);
}
}
@@ -9594,7 +9594,7 @@ static void ex_match(exarg_T *eap)
if (eap->line2 <= 3) {
id = eap->line2;
} else {
- EMSG(e_invcmd);
+ emsg(e_invcmd);
return;
}
@@ -9617,7 +9617,7 @@ static void ex_match(exarg_T *eap)
if (*p == NUL) {
// There must be two arguments.
xfree(g);
- EMSG2(_(e_invarg2), eap->arg);
+ semsg(_(e_invarg2), eap->arg);
return;
}
end = skip_regexp(p + 1, *p, true, NULL);
@@ -9629,7 +9629,7 @@ static void ex_match(exarg_T *eap)
}
if (*end != *p) {
xfree(g);
- EMSG2(_(e_invarg2), p);
+ semsg(_(e_invarg2), p);
return;
}
@@ -9707,7 +9707,7 @@ static void ex_terminal(exarg_T *eap)
xfree(name);
} else { // No {cmd}: run the job with tokenized 'shell'.
if (*p_sh == NUL) {
- EMSG(_(e_shellempty));
+ emsg(_(e_shellempty));
return;
}
diff --git a/src/nvim/ex_eval.c b/src/nvim/ex_eval.c
index e0ea62dd11..cfc8eb7316 100644
--- a/src/nvim/ex_eval.c
+++ b/src/nvim/ex_eval.c
@@ -254,12 +254,12 @@ bool cause_errthrow(const char_u *mesg, bool severe, bool *ignore)
}
elem = xmalloc(sizeof(struct msglist));
- elem->msg = vim_strsave(mesg);
+ elem->msg = (char *)vim_strsave(mesg);
elem->next = NULL;
elem->throw_msg = NULL;
*plist = elem;
if (plist == msg_list || severe) {
- char_u *tmsg;
+ char *tmsg;
// Skip the extra "Vim " prefix for message "E458".
tmsg = elem->msg;
@@ -387,22 +387,22 @@ int do_intthrow(cstack_T *cstack)
}
// Get an exception message that is to be stored in current_exception->value.
-char_u *get_exception_string(void *value, except_type_T type, char_u *cmdname, int *should_free)
+char *get_exception_string(void *value, except_type_T type, char_u *cmdname, int *should_free)
{
- char_u *ret, *mesg;
- char_u *p, *val;
+ char *ret, *mesg;
+ char *p, *val;
if (type == ET_ERROR) {
*should_free = true;
mesg = ((struct msglist *)value)->throw_msg;
if (cmdname != NULL && *cmdname != NUL) {
size_t cmdlen = STRLEN(cmdname);
- ret = vim_strnsave((char_u *)"Vim(", 4 + cmdlen + 2 + STRLEN(mesg));
+ ret = (char *)vim_strnsave((char_u *)"Vim(", 4 + cmdlen + 2 + STRLEN(mesg));
STRCPY(&ret[4], cmdname);
STRCPY(&ret[4 + cmdlen], "):");
val = ret + 4 + cmdlen + 2;
} else {
- ret = vim_strnsave((char_u *)"Vim:", 4 + STRLEN(mesg));
+ ret = (char *)vim_strnsave((char_u *)"Vim:", 4 + STRLEN(mesg));
val = ret + 4;
}
@@ -438,7 +438,7 @@ char_u *get_exception_string(void *value, except_type_T type, char_u *cmdname, i
}
} else {
*should_free = FALSE;
- ret = (char_u *)value;
+ ret = value;
}
return ret;
@@ -463,7 +463,7 @@ static int throw_exception(void *value, except_type_T type, char_u *cmdname)
if (STRNCMP((char_u *)value, "Vim", 3) == 0
&& (((char_u *)value)[3] == NUL || ((char_u *)value)[3] == ':'
|| ((char_u *)value)[3] == '(')) {
- EMSG(_("E608: Cannot :throw exceptions with 'Vim' prefix"));
+ emsg(_("E608: Cannot :throw exceptions with 'Vim' prefix"));
goto fail;
}
}
@@ -518,7 +518,7 @@ static int throw_exception(void *value, except_type_T type, char_u *cmdname)
nomem:
xfree(excp);
suppress_errthrow = true;
- EMSG(_(e_outofmem));
+ emsg(_(e_outofmem));
fail:
current_exception = NULL;
return FAIL;
@@ -835,7 +835,7 @@ void ex_if(exarg_T *eap)
cstack_T *const cstack = eap->cstack;
if (cstack->cs_idx == CSTACK_LEN - 1) {
- eap->errmsg = (char_u *)N_("E579: :if nesting too deep");
+ eap->errmsg = N_("E579: :if nesting too deep");
} else {
++cstack->cs_idx;
cstack->cs_flags[cstack->cs_idx] = 0;
@@ -865,7 +865,7 @@ void ex_endif(exarg_T *eap)
if (eap->cstack->cs_idx < 0
|| (eap->cstack->cs_flags[eap->cstack->cs_idx]
& (CSF_WHILE | CSF_FOR | CSF_TRY))) {
- eap->errmsg = (char_u *)N_("E580: :endif without :if");
+ eap->errmsg = N_("E580: :endif without :if");
} else {
// When debugging or a breakpoint was encountered, display the debug
// prompt (if not already done). This shows the user that an ":endif"
@@ -898,17 +898,17 @@ void ex_else(exarg_T *eap)
|| (cstack->cs_flags[cstack->cs_idx]
& (CSF_WHILE | CSF_FOR | CSF_TRY))) {
if (eap->cmdidx == CMD_else) {
- eap->errmsg = (char_u *)N_("E581: :else without :if");
+ eap->errmsg = N_("E581: :else without :if");
return;
}
- eap->errmsg = (char_u *)N_("E582: :elseif without :if");
+ eap->errmsg = N_("E582: :elseif without :if");
skip = TRUE;
} else if (cstack->cs_flags[cstack->cs_idx] & CSF_ELSE) {
if (eap->cmdidx == CMD_else) {
- eap->errmsg = (char_u *)N_("E583: multiple :else");
+ eap->errmsg = N_("E583: multiple :else");
return;
}
- eap->errmsg = (char_u *)N_("E584: :elseif after :else");
+ eap->errmsg = N_("E584: :elseif after :else");
skip = TRUE;
}
@@ -970,7 +970,7 @@ void ex_while(exarg_T *eap)
cstack_T *const cstack = eap->cstack;
if (cstack->cs_idx == CSTACK_LEN - 1) {
- eap->errmsg = (char_u *)N_("E585: :while/:for nesting too deep");
+ eap->errmsg = N_("E585: :while/:for nesting too deep");
} else {
/*
* The loop flag is set when we have jumped back from the matching
@@ -1051,7 +1051,7 @@ void ex_continue(exarg_T *eap)
cstack_T *const cstack = eap->cstack;
if (cstack->cs_looplevel <= 0 || cstack->cs_idx < 0) {
- eap->errmsg = (char_u *)N_("E586: :continue without :while or :for");
+ eap->errmsg = N_("E586: :continue without :while or :for");
} else {
// Try to find the matching ":while". This might stop at a try
// conditional not in its finally clause (which is then to be executed
@@ -1085,7 +1085,7 @@ void ex_break(exarg_T *eap)
cstack_T *const cstack = eap->cstack;
if (cstack->cs_looplevel <= 0 || cstack->cs_idx < 0) {
- eap->errmsg = (char_u *)N_("E587: :break without :while or :for");
+ eap->errmsg = N_("E587: :break without :while or :for");
} else {
// Deactivate conditionals until the matching ":while" or a try
// conditional not in its finally clause (which is then to be
@@ -1106,7 +1106,7 @@ void ex_endwhile(exarg_T *eap)
{
cstack_T *const cstack = eap->cstack;
int idx;
- char_u *err;
+ char *err;
int csf;
int fl;
@@ -1126,9 +1126,9 @@ void ex_endwhile(exarg_T *eap)
// If we are in a ":while" or ":for" but used the wrong endloop
// command, do not rewind to the next enclosing ":for"/":while".
if (fl & CSF_WHILE) {
- eap->errmsg = (char_u *)_("E732: Using :endfor with :while");
+ eap->errmsg = _("E732: Using :endfor with :while");
} else if (fl & CSF_FOR) {
- eap->errmsg = (char_u *)_("E733: Using :endwhile with :for");
+ eap->errmsg = _("E733: Using :endwhile with :for");
}
}
if (!(fl & (CSF_WHILE | CSF_FOR))) {
@@ -1188,7 +1188,7 @@ void ex_throw(exarg_T *eap)
value = eval_to_string_skip(arg, (const char **)&eap->nextcmd,
(bool)eap->skip);
} else {
- EMSG(_(e_argreq));
+ emsg(_(e_argreq));
value = NULL;
}
@@ -1273,7 +1273,7 @@ void ex_try(exarg_T *eap)
cstack_T *const cstack = eap->cstack;
if (cstack->cs_idx == CSTACK_LEN - 1) {
- eap->errmsg = (char_u *)N_("E601: :try nesting too deep");
+ eap->errmsg = N_("E601: :try nesting too deep");
} else {
++cstack->cs_idx;
++cstack->cs_trylevel;
@@ -1334,7 +1334,7 @@ void ex_catch(exarg_T *eap)
char_u *pat;
if (cstack->cs_trylevel <= 0 || cstack->cs_idx < 0) {
- eap->errmsg = (char_u *)N_("E603: :catch without :try");
+ eap->errmsg = N_("E603: :catch without :try");
give_up = TRUE;
} else {
if (!(cstack->cs_flags[cstack->cs_idx] & CSF_TRY)) {
@@ -1351,7 +1351,7 @@ void ex_catch(exarg_T *eap)
if (cstack->cs_flags[idx] & CSF_FINALLY) {
// Give up for a ":catch" after ":finally" and ignore it.
// Just parse.
- eap->errmsg = (char_u *)N_("E604: :catch after :finally");
+ eap->errmsg = N_("E604: :catch after :finally");
give_up = TRUE;
} else {
rewind_conditionals(cstack, idx, CSF_WHILE | CSF_FOR,
@@ -1386,7 +1386,7 @@ void ex_catch(exarg_T *eap)
if (!skip && (cstack->cs_flags[idx] & CSF_THROWN)
&& !(cstack->cs_flags[idx] & CSF_CAUGHT)) {
if (end != NULL && *end != NUL && !ends_excmd(*skipwhite(end + 1))) {
- EMSG(_(e_trailing));
+ emsg(_(e_trailing));
return;
}
@@ -1417,7 +1417,7 @@ void ex_catch(exarg_T *eap)
}
p_cpo = save_cpo;
if (regmatch.regprog == NULL) {
- EMSG2(_(e_invarg2), pat);
+ semsg(_(e_invarg2), pat);
} else {
//
// Save the value of got_int and reset it. We don't want
@@ -1426,7 +1426,7 @@ void ex_catch(exarg_T *eap)
//
prev_got_int = got_int;
got_int = FALSE;
- caught = vim_regexec_nl(&regmatch, current_exception->value,
+ caught = vim_regexec_nl(&regmatch, (char_u *)current_exception->value,
(colnr_T)0);
got_int |= prev_got_int;
vim_regfree(regmatch.regprog);
@@ -1483,7 +1483,7 @@ void ex_finally(exarg_T *eap)
cstack_T *const cstack = eap->cstack;
if (cstack->cs_trylevel <= 0 || cstack->cs_idx < 0) {
- eap->errmsg = (char_u *)N_("E606: :finally without :try");
+ eap->errmsg = N_("E606: :finally without :try");
} else {
if (!(cstack->cs_flags[cstack->cs_idx] & CSF_TRY)) {
eap->errmsg = get_end_emsg(cstack);
@@ -1502,7 +1502,7 @@ void ex_finally(exarg_T *eap)
if (cstack->cs_flags[idx] & CSF_FINALLY) {
// Give up for a multiple ":finally" and ignore it.
- eap->errmsg = (char_u *)N_("E607: multiple :finally");
+ eap->errmsg = N_("E607: multiple :finally");
return;
}
rewind_conditionals(cstack, idx, CSF_WHILE | CSF_FOR,
@@ -1609,7 +1609,7 @@ void ex_endtry(exarg_T *eap)
cstack_T *const cstack = eap->cstack;
if (cstack->cs_trylevel <= 0 || cstack->cs_idx < 0) {
- eap->errmsg = (char_u *)N_("E602: :endtry without :try");
+ eap->errmsg = N_("E602: :endtry without :try");
} else {
// Don't do something after an error, interrupt or throw in the try
// block, catch clause, or finally clause preceding this ":endtry" or
@@ -2043,7 +2043,7 @@ int cleanup_conditionals(cstack_T *cstack, int searched_cond, int inclusive)
/*
* Return an appropriate error message for a missing endwhile/endfor/endif.
*/
-static char_u *get_end_emsg(cstack_T *cstack)
+static char *get_end_emsg(cstack_T *cstack)
{
if (cstack->cs_flags[cstack->cs_idx] & CSF_WHILE) {
return e_endwhile;
@@ -2080,7 +2080,7 @@ void rewind_conditionals(cstack_T *cstack, int idx, int cond_type, int *cond_lev
*/
void ex_endfunction(exarg_T *eap)
{
- EMSG(_("E193: :endfunction not inside a function"));
+ emsg(_("E193: :endfunction not inside a function"));
}
/*
diff --git a/src/nvim/ex_eval.h b/src/nvim/ex_eval.h
index d3ba43a469..25b30b2805 100644
--- a/src/nvim/ex_eval.h
+++ b/src/nvim/ex_eval.h
@@ -40,8 +40,8 @@
* message in the list. See cause_errthrow() below.
*/
struct msglist {
- char_u *msg; // original message
- char_u *throw_msg; // msg to throw: usually original one
+ char *msg; // original message
+ char *throw_msg; // msg to throw: usually original one
struct msglist *next; // next of several messages in a row
};
@@ -60,7 +60,7 @@ typedef enum
typedef struct vim_exception except_T;
struct vim_exception {
except_type_T type; // exception type
- char_u *value; // exception value
+ char *value; // exception value
struct msglist *messages; // message(s) causing error exception
char_u *throw_name; // name of the throw point
linenr_T throw_lnum; // line number of the throw point
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c
index 8e5b12b8be..9c976d0cd2 100644
--- a/src/nvim/ex_getln.c
+++ b/src/nvim/ex_getln.c
@@ -362,7 +362,7 @@ static bool do_incsearch_highlighting(int firstc, int *search_delim, incsearch_s
bool delim_optional = false;
int delim;
char_u *end;
- char_u *dummy;
+ char *dummy;
exarg_T ea;
pos_T save_cursor;
bool use_last_pat;
@@ -2475,10 +2475,10 @@ int text_locked(void)
*/
void text_locked_msg(void)
{
- EMSG(_(get_text_locked_msg()));
+ emsg(_(get_text_locked_msg()));
}
-char_u *get_text_locked_msg(void)
+char *get_text_locked_msg(void)
{
if (cmdwin_type != 0) {
return e_cmdwin;
@@ -2492,7 +2492,7 @@ char_u *get_text_locked_msg(void)
int curbuf_locked(void)
{
if (curbuf->b_ro_locked > 0) {
- EMSG(_("E788: Not allowed to edit another buffer now"));
+ emsg(_("E788: Not allowed to edit another buffer now"));
return TRUE;
}
return allbuf_locked();
@@ -2505,7 +2505,7 @@ int curbuf_locked(void)
int allbuf_locked(void)
{
if (allbuf_lock > 0) {
- EMSG(_("E811: Not allowed to change buffer information now"));
+ emsg(_("E811: Not allowed to change buffer information now"));
return TRUE;
}
return FALSE;
@@ -3969,12 +3969,12 @@ char_u *ExpandOne(expand_T *xp, char_u *str, char_u *orig, int options, int mode
* causing the pattern to be added, which has illegal characters.
*/
if (!(options & WILD_SILENT) && (options & WILD_LIST_NOTFOUND)) {
- EMSG2(_(e_nomatch2), str);
+ semsg(_(e_nomatch2), str);
}
#endif
} else if (xp->xp_numfiles == 0) {
if (!(options & WILD_SILENT)) {
- EMSG2(_(e_nomatch2), str);
+ semsg(_(e_nomatch2), str);
}
} else {
// Escape the matches for use on the command line.
@@ -4012,7 +4012,7 @@ char_u *ExpandOne(expand_T *xp, char_u *str, char_u *orig, int options, int mode
* (and possibly have to hit return to continue!).
*/
if (!(options & WILD_SILENT)) {
- EMSG(_(e_toomany));
+ emsg(_(e_toomany));
} else if (!(options & WILD_NO_BEEP)) {
beep_flush();
}
@@ -6238,7 +6238,7 @@ void ex_history(exarg_T *eap)
histype1 = 0;
histype2 = HIST_COUNT-1;
} else {
- EMSG(_(e_trailing));
+ emsg(_(e_trailing));
return;
}
} else {
@@ -6248,7 +6248,7 @@ void ex_history(exarg_T *eap)
end = arg;
}
if (!get_list_range(&end, &hisidx1, &hisidx2) || *end != NUL) {
- EMSG(_(e_trailing));
+ emsg(_(e_trailing));
return;
}
@@ -6475,7 +6475,7 @@ static int open_cmdwin(void)
// this happens!
if (!win_valid(old_curwin) || !bufref_valid(&old_curbuf)) {
cmdwin_result = Ctrl_C;
- EMSG(_("E199: Active window or buffer deleted"));
+ emsg(_("E199: Active window or buffer deleted"));
} else {
// autocmds may abort script processing
if (aborting() && cmdwin_result != K_IGNORE) {
diff --git a/src/nvim/ex_session.c b/src/nvim/ex_session.c
index 0dfd7e1edd..9aa8cc0107 100644
--- a/src/nvim/ex_session.c
+++ b/src/nvim/ex_session.c
@@ -860,7 +860,7 @@ void ex_loadview(exarg_T *eap)
char *fname = get_view_file(*eap->arg);
if (fname != NULL) {
if (do_source(fname, false, DOSO_NONE) == FAIL) {
- EMSG2(_(e_notopen), fname);
+ semsg(_(e_notopen), fname);
}
xfree(fname);
}
@@ -980,7 +980,7 @@ void ex_mkrc(exarg_T *eap)
|| ((ssop_flags & SSOP_CURDIR) && globaldir !=
NULL))) {
if (os_chdir((char *)dirnow) != 0) {
- EMSG(_(e_prev_dir));
+ emsg(_(e_prev_dir));
}
shorten_fnames(true);
// restore original dir
@@ -988,7 +988,7 @@ void ex_mkrc(exarg_T *eap)
|| ((ssop_flags & SSOP_CURDIR) && globaldir !=
NULL))) {
if (os_chdir((char *)dirnow) != 0) {
- EMSG(_(e_prev_dir));
+ emsg(_(e_prev_dir));
}
shorten_fnames(true);
}
@@ -1025,7 +1025,7 @@ void ex_mkrc(exarg_T *eap)
failed |= fclose(fd);
if (failed) {
- EMSG(_(e_write));
+ emsg(_(e_write));
} else if (eap->cmdidx == CMD_mksession) {
// successful session write - set v:this_session
char *const tbuf = xmalloc(MAXPATHL);
@@ -1043,7 +1043,7 @@ void ex_mkrc(exarg_T *eap)
static char *get_view_file(int c)
{
if (curbuf->b_ffname == NULL) {
- EMSG(_(e_noname));
+ emsg(_(e_noname));
return NULL;
}
char *sname = (char *)home_replace_save(NULL, curbuf->b_ffname);
diff --git a/src/nvim/file_search.c b/src/nvim/file_search.c
index fca62353d5..9b0caa8da0 100644
--- a/src/nvim/file_search.c
+++ b/src/nvim/file_search.c
@@ -419,7 +419,7 @@ void *vim_findfile_init(char_u *path, char_u *filename, char_u *stopdirs, int le
len = 0;
while (*wc_part != NUL) {
if (len + 5 >= MAXPATHL) {
- EMSG(_(e_pathtoolong));
+ emsg(_(e_pathtoolong));
break;
}
if (STRNCMP(wc_part, "**", 2) == 0) {
@@ -437,7 +437,7 @@ void *vim_findfile_init(char_u *path, char_u *filename, char_u *stopdirs, int le
}
wc_part = (char_u *)errpt;
if (*wc_part != NUL && !vim_ispathsep(*wc_part)) {
- EMSG2(_(
+ semsg(_(
"E343: Invalid path: '**[number]' must be at the end of the path or be followed by '%s'."),
PATHSEPSTR);
goto error_return;
@@ -463,7 +463,7 @@ void *vim_findfile_init(char_u *path, char_u *filename, char_u *stopdirs, int le
// create an absolute path
if (STRLEN(search_ctx->ffsc_start_dir)
+ STRLEN(search_ctx->ffsc_fix_path) + 3 >= MAXPATHL) {
- EMSG(_(e_pathtoolong));
+ emsg(_(e_pathtoolong));
goto error_return;
}
STRCPY(ff_expand_buffer, search_ctx->ffsc_start_dir);
@@ -1570,18 +1570,18 @@ char_u *find_file_in_path_option(char_u *ptr, size_t len, int options, int first
if (file_name == NULL && (options & FNAME_MESS)) {
if (first == TRUE) {
if (find_what == FINDFILE_DIR) {
- EMSG2(_("E344: Can't find directory \"%s\" in cdpath"),
+ semsg(_("E344: Can't find directory \"%s\" in cdpath"),
ff_file_to_find);
} else {
- EMSG2(_("E345: Can't find file \"%s\" in path"),
+ semsg(_("E345: Can't find file \"%s\" in path"),
ff_file_to_find);
}
} else {
if (find_what == FINDFILE_DIR) {
- EMSG2(_("E346: No more directory \"%s\" found in cdpath"),
+ semsg(_("E346: No more directory \"%s\" found in cdpath"),
ff_file_to_find);
} else {
- EMSG2(_("E347: No more file \"%s\" found in path"),
+ semsg(_("E347: No more file \"%s\" found in path"),
ff_file_to_find);
}
}
diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c
index cde6a55199..d499815ea6 100644
--- a/src/nvim/fileio.c
+++ b/src/nvim/fileio.c
@@ -465,7 +465,7 @@ int readfile(char_u *fname, char_u *sfname, linenr_T from, linenr_T lines_to_ski
&& (old_b_ffname != curbuf->b_ffname))
|| (using_b_fname
&& (old_b_fname != curbuf->b_fname))) {
- EMSG(_(e_auchangedbuf));
+ emsg(_(e_auchangedbuf));
return FAIL;
}
}
@@ -533,7 +533,7 @@ int readfile(char_u *fname, char_u *sfname, linenr_T from, linenr_T lines_to_ski
&& (curbuf != old_curbuf
|| (using_b_ffname && (old_b_ffname != curbuf->b_ffname))
|| (using_b_fname && (old_b_fname != curbuf->b_fname)))) {
- EMSG(_(e_auchangedbuf));
+ emsg(_(e_auchangedbuf));
if (!read_buffer) {
close(fd);
}
@@ -643,9 +643,9 @@ int readfile(char_u *fname, char_u *sfname, linenr_T from, linenr_T lines_to_ski
--no_wait_return;
msg_scroll = msg_save;
if (fd < 0) {
- EMSG(_("E200: *ReadPre autocommands made the file unreadable"));
+ emsg(_("E200: *ReadPre autocommands made the file unreadable"));
} else {
- EMSG(_("E201: *ReadPre autocommands must not change current buffer"));
+ emsg(_("E201: *ReadPre autocommands must not change current buffer"));
}
curbuf->b_p_ro = TRUE; // must use "w!" now
return FAIL;
@@ -862,7 +862,7 @@ retry:
advance_fenc = true;
if (fd < 0) {
// Re-opening the original file failed!
- EMSG(_("E202: Conversion made file unreadable!"));
+ emsg(_("E202: Conversion made file unreadable!"));
error = true;
goto failed;
}
@@ -2255,7 +2255,7 @@ int buf_write(buf_T *buf, char_u *fname, char_u *sfname, linenr_T start, linenr_
if (buf->b_ml.ml_mfp == NULL) {
/* This can happen during startup when there is a stray "w" in the
* vimrc file. */
- EMSG(_(e_emptybuf));
+ emsg(_(e_emptybuf));
return FAIL;
}
@@ -2269,7 +2269,7 @@ int buf_write(buf_T *buf, char_u *fname, char_u *sfname, linenr_T start, linenr_
// Avoid a crash for a long name.
if (STRLEN(fname) >= MAXPATHL) {
- EMSG(_(e_longname));
+ emsg(_(e_longname));
return FAIL;
}
@@ -2431,7 +2431,7 @@ int buf_write(buf_T *buf, char_u *fname, char_u *sfname, linenr_T start, linenr_
--no_wait_return;
msg_scroll = msg_save;
if (nofile_err) {
- EMSG(_("E676: No matching autocommands for acwrite buffer"));
+ emsg(_("E676: No matching autocommands for acwrite buffer"));
}
if (nofile_err
@@ -2464,7 +2464,7 @@ int buf_write(buf_T *buf, char_u *fname, char_u *sfname, linenr_T start, linenr_
return OK;
}
if (!aborting()) {
- EMSG(_("E203: Autocommands deleted or unloaded buffer to be written"));
+ emsg(_("E203: Autocommands deleted or unloaded buffer to be written"));
}
return FAIL;
}
@@ -2485,7 +2485,7 @@ int buf_write(buf_T *buf, char_u *fname, char_u *sfname, linenr_T start, linenr_
if (end < start) {
--no_wait_return;
msg_scroll = msg_save;
- EMSG(_("E204: Autocommand changed number of lines in unexpected way"));
+ emsg(_("E204: Autocommand changed number of lines in unexpected way"));
return FAIL;
}
}
@@ -2770,7 +2770,7 @@ int buf_write(buf_T *buf, char_u *fname, char_u *sfname, linenr_T start, linenr_
int ret;
char *failed_dir;
if ((ret = os_mkdir_recurse((char *)IObuff, 0755, &failed_dir)) != 0) {
- EMSG3(_("E303: Unable to create directory \"%s\" for backup file: %s"),
+ semsg(_("E303: Unable to create directory \"%s\" for backup file: %s"),
failed_dir, os_strerror(ret));
xfree(failed_dir);
}
@@ -2934,7 +2934,7 @@ nobackup:
int ret;
char *failed_dir;
if ((ret = os_mkdir_recurse((char *)IObuff, 0755, &failed_dir)) != 0) {
- EMSG3(_("E303: Unable to create directory \"%s\" for backup file: %s"),
+ semsg(_("E303: Unable to create directory \"%s\" for backup file: %s"),
failed_dir, os_strerror(ret));
xfree(failed_dir);
}
@@ -3581,7 +3581,7 @@ restore_backup:
* the current backup file becomes the original file
*/
if (org == NULL) {
- EMSG(_("E205: Patchmode: can't save original file"));
+ emsg(_("E205: Patchmode: can't save original file"));
} else if (!os_path_exists((char_u *)org)) {
vim_rename(backup, (char_u *)org);
XFREE_CLEAR(backup); // don't delete the file
@@ -3603,7 +3603,7 @@ restore_backup:
|| (empty_fd = os_open(org,
O_CREAT | O_EXCL | O_NOFOLLOW,
perm < 0 ? 0666 : (perm & 0777))) < 0) {
- EMSG(_("E206: patchmode: can't touch empty original file"));
+ emsg(_("E206: patchmode: can't touch empty original file"));
} else {
close(empty_fd);
}
@@ -3620,7 +3620,7 @@ restore_backup:
if (!p_bk && backup != NULL
&& !write_info.bw_conv_error
&& os_remove((char *)backup) != 0) {
- EMSG(_("E207: Can't delete backup file"));
+ emsg(_("E207: Can't delete backup file"));
}
goto nofail;
@@ -3660,14 +3660,14 @@ nofail:
#endif
if (errnum != NULL) {
if (errmsgarg != 0) {
- emsgf("%s: %s%s: %s", errnum, IObuff, errmsg, os_strerror(errmsgarg));
+ semsg("%s: %s%s: %s", errnum, IObuff, errmsg, os_strerror(errmsgarg));
} else {
- emsgf("%s: %s%s", errnum, IObuff, errmsg);
+ semsg("%s: %s%s", errnum, IObuff, errmsg);
}
} else if (errmsgarg != 0) {
- emsgf(errmsg, os_strerror(errmsgarg));
+ semsg(errmsg, os_strerror(errmsgarg));
} else {
- EMSG(errmsg);
+ emsg(errmsg);
}
if (errmsg_allocated) {
xfree(errmsg);
@@ -3761,7 +3761,7 @@ static int set_rw_fname(char_u *fname, char_u *sfname)
}
if (curbuf != buf) {
// We are in another buffer now, don't do the renaming.
- EMSG(_(e_auchangedbuf));
+ emsg(_(e_auchangedbuf));
return FAIL;
}
@@ -4775,7 +4775,7 @@ int vim_rename(const char_u *from, const char_u *to)
mch_free_acl(acl);
#endif
if (errmsg != NULL) {
- EMSG2(errmsg, to);
+ semsg(errmsg, to);
return -1;
}
os_remove((char *)from);
@@ -4981,7 +4981,7 @@ int buf_check_timestamp(buf_T *buf)
busy = false;
if (n) {
if (!bufref_valid(&bufref)) {
- EMSG(_("E246: FileChangedShell autocommand deleted buffer"));
+ emsg(_("E246: FileChangedShell autocommand deleted buffer"));
}
s = get_vim_var_str(VV_FCS_CHOICE);
if (STRCMP(s, "reload") == 0 && *reason != 'd') {
@@ -5057,7 +5057,7 @@ int buf_check_timestamp(buf_T *buf)
xstrlcat(tbuf, "; ", tbuf_len - 1);
xstrlcat(tbuf, mesg2, tbuf_len - 1);
}
- EMSG(tbuf);
+ emsg(tbuf);
retval = 2;
} else {
if (!autocmd_busy) {
@@ -5162,7 +5162,7 @@ void buf_reload(buf_T *buf, int orig_mode)
}
if (savebuf == NULL || saved == FAIL || buf != curbuf
|| move_lines(buf, savebuf) == FAIL) {
- EMSG2(_("E462: Could not prepare for reloading \"%s\""),
+ semsg(_("E462: Could not prepare for reloading \"%s\""),
buf->b_fname);
saved = FAIL;
}
@@ -5174,7 +5174,7 @@ void buf_reload(buf_T *buf, int orig_mode)
if (readfile(buf->b_ffname, buf->b_fname, (linenr_T)0, (linenr_T)0,
(linenr_T)MAXLNUM, &ea, flags) != OK) {
if (!aborting()) {
- EMSG2(_("E321: Could not reload \"%s\""), buf->b_fname);
+ semsg(_("E321: Could not reload \"%s\""), buf->b_fname);
}
if (savebuf != NULL && bufref_valid(&bufref) && buf == curbuf) {
// Put the text back from the save buffer. First
@@ -5709,9 +5709,9 @@ char_u *file_pat_to_reg_pat(const char_u *pat, const char_u *pat_end, char *allo
reg_pat[i] = NUL;
if (nested != 0) {
if (nested < 0) {
- EMSG(_("E219: Missing {."));
+ emsg(_("E219: Missing {."));
} else {
- EMSG(_("E220: Missing }."));
+ emsg(_("E220: Missing }."));
}
XFREE_CLEAR(reg_pat);
}
diff --git a/src/nvim/fold.c b/src/nvim/fold.c
index 8d86dca4d8..daf0df9326 100644
--- a/src/nvim/fold.c
+++ b/src/nvim/fold.c
@@ -418,7 +418,7 @@ void opFoldRange(pos_T firstpos, pos_T lastpos, int opening, int recurse, int ha
}
}
if (done == DONE_NOTHING) {
- EMSG(_(e_nofold));
+ emsg(_(e_nofold));
}
// Force a redraw to remove the Visual highlighting.
if (had_visual) {
@@ -551,9 +551,9 @@ int foldManualAllowed(bool create)
return TRUE;
}
if (create) {
- EMSG(_("E350: Cannot create fold with current 'foldmethod'"));
+ emsg(_("E350: Cannot create fold with current 'foldmethod'"));
} else {
- EMSG(_("E351: Cannot delete fold with current 'foldmethod'"));
+ emsg(_("E351: Cannot delete fold with current 'foldmethod'"));
}
return FALSE;
}
@@ -764,7 +764,7 @@ void deleteFold(win_T *const wp, const linenr_T start, const linenr_T end, const
}
}
if (!did_one) {
- EMSG(_(e_nofold));
+ emsg(_(e_nofold));
// Force a redraw to remove the Visual highlighting.
if (had_visual) {
redraw_buf_later(wp->w_buffer, INVERTED);
@@ -1196,7 +1196,7 @@ static void setFoldRepeat(pos_T pos, long count, int do_open)
if (!(done & DONE_ACTION)) {
// Only give an error message when no fold could be opened.
if (n == 0 && !(done & DONE_FOLD)) {
- EMSG(_(e_nofold));
+ emsg(_(e_nofold));
}
break;
}
@@ -1333,7 +1333,7 @@ static linenr_T setManualFoldWin(win_T *wp, linenr_T lnum, int opening, int recu
}
done |= DONE_FOLD;
} else if (donep == NULL && wp == curwin) {
- EMSG(_(e_nofold));
+ emsg(_(e_nofold));
}
if (donep != NULL) {
@@ -1651,7 +1651,7 @@ static void foldCreateMarkers(win_T *wp, pos_T start, pos_T end)
{
buf_T *buf = wp->w_buffer;
if (!MODIFIABLE(buf)) {
- EMSG(_(e_modifiable));
+ emsg(_(e_modifiable));
return;
}
parseMarker(wp);
diff --git a/src/nvim/getchar.c b/src/nvim/getchar.c
index 294cd60736..f871d19917 100644
--- a/src/nvim/getchar.c
+++ b/src/nvim/getchar.c
@@ -264,7 +264,7 @@ static void add_buff(buffheader_T *const buf, const char *const s, ptrdiff_t sle
buf->bh_space = 0;
buf->bh_curr = &(buf->bh_first);
} else if (buf->bh_curr == NULL) { // buffer has already been read
- IEMSG(_("E222: Add to read buffer"));
+ iemsg(_("E222: Add to read buffer"));
return;
} else if (buf->bh_index != 0) {
memmove(buf->bh_first.b_next->b_str,
@@ -899,7 +899,7 @@ int ins_typebuf(char_u *str, int noremap, int offset, bool nottyped, bool silent
newoff = MAXMAPLEN + 4;
newlen = typebuf.tb_len + addlen + newoff + 4 * (MAXMAPLEN + 4);
if (newlen < 0) { // string is getting too long
- EMSG(_(e_toocompl)); // also calls flush_buffers
+ emsg(_(e_toocompl)); // also calls flush_buffers
setcursor();
return FAIL;
}
@@ -1286,7 +1286,7 @@ void restore_typeahead(tasave_T *tp)
void openscript(char_u *name, bool directly)
{
if (curscript + 1 == NSCRIPT) {
- EMSG(_(e_nesting));
+ emsg(_(e_nesting));
return;
}
@@ -1309,7 +1309,7 @@ void openscript(char_u *name, bool directly)
int error;
if ((scriptin[curscript] = file_open_new(&error, (char *)NameBuff,
kFileReadOnly, 0)) == NULL) {
- emsgf(_(e_notopen_2), name, os_strerror(error));
+ semsg(_(e_notopen_2), name, os_strerror(error));
if (curscript) {
curscript--;
}
@@ -2074,7 +2074,7 @@ static int vgetorpeek(bool advance)
* The depth check catches ":map x y" and ":map y x".
*/
if (++mapdepth >= p_mmd) {
- EMSG(_("E223: recursive mapping"));
+ emsg(_("E223: recursive mapping"));
if (State & CMDLINE) {
redrawcmdline();
} else {
@@ -2930,10 +2930,10 @@ int buf_do_map(int maptype, MapArguments *args, int mode, bool is_abbrev, buf_T
&& args->unique
&& STRNCMP(mp->m_keys, lhs, (size_t)len) == 0) {
if (is_abbrev) {
- EMSG2(_("E224: global abbreviation already exists for %s"),
+ semsg(_("E224: global abbreviation already exists for %s"),
mp->m_keys);
} else {
- EMSG2(_("E225: global mapping already exists for %s"), mp->m_keys);
+ semsg(_("E225: global mapping already exists for %s"), mp->m_keys);
}
retval = 5;
goto theend;
@@ -3029,9 +3029,9 @@ int buf_do_map(int maptype, MapArguments *args, int mode, bool is_abbrev, buf_T
continue;
} else if (args->unique) {
if (is_abbrev) {
- EMSG2(_("E226: abbreviation already exists for %s"), p);
+ semsg(_("E226: abbreviation already exists for %s"), p);
} else {
- EMSG2(_("E227: mapping already exists for %s"), p);
+ semsg(_("E227: mapping already exists for %s"), p);
}
retval = 5;
goto theend;
@@ -3291,7 +3291,7 @@ void map_clear_mode(char_u *cmdp, char_u *arg, int forceit, int abbr)
local = (STRCMP(arg, "<buffer>") == 0);
if (!local && *arg != NUL) {
- EMSG(_(e_invarg));
+ emsg(_(e_invarg));
return;
}
@@ -4167,7 +4167,7 @@ int makemap(FILE *fd, buf_T *buf)
c1 = 't';
break;
default:
- IEMSG(_("E228: makemap: Illegal mode"));
+ iemsg(_("E228: makemap: Illegal mode"));
return FAIL;
}
do {
@@ -4530,7 +4530,7 @@ char_u *getcmdkeycmd(int promptc, void *cookie, int indent, bool do_concat)
if (vgetorpeek(false) == NUL) {
// incomplete <Cmd> is an error, because there is not much the user
// could do in this state.
- EMSG(e_cmdmap_err);
+ emsg(e_cmdmap_err);
aborted = true;
break;
}
@@ -4557,13 +4557,13 @@ char_u *getcmdkeycmd(int promptc, void *cookie, int indent, bool do_concat)
aborted = true;
} else if (c1 == K_COMMAND) {
// special case to give nicer error message
- EMSG(e_cmdmap_repeated);
+ emsg(e_cmdmap_repeated);
aborted = true;
} else if (IS_SPECIAL(c1)) {
if (c1 == K_SNR) {
ga_concat(&line_ga, "<SNR>");
} else {
- EMSG2(e_cmdmap_key, get_special_key_name(c1, cmod));
+ semsg(e_cmdmap_key, get_special_key_name(c1, cmod));
aborted = true;
}
} else {
diff --git a/src/nvim/globals.h b/src/nvim/globals.h
index 49ad5fd1ae..e2d3378402 100644
--- a/src/nvim/globals.h
+++ b/src/nvim/globals.h
@@ -845,154 +845,154 @@ EXTERN linenr_T spell_redraw_lnum INIT(= 0);
// The error messages that can be shared are included here.
// Excluded are errors that are only used once and debugging messages.
-EXTERN char_u e_abort[] INIT(= N_("E470: Command aborted"));
-EXTERN char_u e_afterinit[] INIT(= N_("E905: Cannot set this option after startup"));
-EXTERN char_u e_api_spawn_failed[] INIT(= N_("E903: Could not spawn API job"));
-EXTERN char_u e_argreq[] INIT(= N_("E471: Argument required"));
-EXTERN char_u e_backslash[] INIT(= N_("E10: \\ should be followed by /, ? or &"));
-EXTERN char_u e_cmdwin[] INIT(=
- N_(
- "E11: Invalid in command-line window; <CR> executes, CTRL-C quits"));
-EXTERN char_u e_curdir[] INIT(=
- N_(
- "E12: Command not allowed from exrc/vimrc in current dir or tag search"));
-EXTERN char_u e_endif[] INIT(= N_("E171: Missing :endif"));
-EXTERN char_u e_endtry[] INIT(= N_("E600: Missing :endtry"));
-EXTERN char_u e_endwhile[] INIT(= N_("E170: Missing :endwhile"));
-EXTERN char_u e_endfor[] INIT(= N_("E170: Missing :endfor"));
-EXTERN char_u e_while[] INIT(= N_("E588: :endwhile without :while"));
-EXTERN char_u e_for[] INIT(= N_("E588: :endfor without :for"));
-EXTERN char_u e_exists[] INIT(= N_("E13: File exists (add ! to override)"));
-EXTERN char_u e_failed[] INIT(= N_("E472: Command failed"));
-EXTERN char_u e_internal[] INIT(= N_("E473: Internal error"));
-EXTERN char_u e_intern2[] INIT(= N_("E685: Internal error: %s"));
-EXTERN char_u e_interr[] INIT(= N_("Interrupted"));
-EXTERN char_u e_invarg[] INIT(= N_("E474: Invalid argument"));
-EXTERN char_u e_invarg2[] INIT(= N_("E475: Invalid argument: %s"));
-EXTERN char_u e_invargval[] INIT(= N_("E475: Invalid value for argument %s"));
-EXTERN char_u e_invargNval[] INIT(= N_("E475: Invalid value for argument %s: %s"));
-EXTERN char_u e_duparg2[] INIT(= N_("E983: Duplicate argument: %s"));
-EXTERN char_u e_invexpr2[] INIT(= N_("E15: Invalid expression: %s"));
-EXTERN char_u e_invrange[] INIT(= N_("E16: Invalid range"));
-EXTERN char_u e_invcmd[] INIT(= N_("E476: Invalid command"));
-EXTERN char_u e_isadir2[] INIT(= N_("E17: \"%s\" is a directory"));
-EXTERN char_u e_no_spell[] INIT(= N_("E756: Spell checking is not possible"));
-EXTERN char_u e_invchan[] INIT(= N_("E900: Invalid channel id"));
-EXTERN char_u e_invchanjob[] INIT(= N_("E900: Invalid channel id: not a job"));
-EXTERN char_u e_jobtblfull[] INIT(= N_("E901: Job table is full"));
-EXTERN char_u e_jobspawn[] INIT(= N_("E903: Process failed to start: %s: \"%s\""));
-EXTERN char_u e_channotpty[] INIT(= N_("E904: channel is not a pty"));
-EXTERN char_u e_stdiochan2[] INIT(= N_("E905: Couldn't open stdio channel: %s"));
-EXTERN char_u e_invstream[] INIT(= N_("E906: invalid stream for channel"));
-EXTERN char_u e_invstreamrpc[] INIT(= N_("E906: invalid stream for rpc channel, use 'rpc'"));
-EXTERN char_u e_streamkey[] INIT(=
- N_(
- "E5210: dict key '%s' already set for buffered stream in channel %"
- PRIu64));
-EXTERN char_u e_libcall[] INIT(= N_("E364: Library call failed for \"%s()\""));
+EXTERN char e_abort[] INIT(= N_("E470: Command aborted"));
+EXTERN char e_afterinit[] INIT(= N_("E905: Cannot set this option after startup"));
+EXTERN char e_api_spawn_failed[] INIT(= N_("E903: Could not spawn API job"));
+EXTERN char e_argreq[] INIT(= N_("E471: Argument required"));
+EXTERN char e_backslash[] INIT(= N_("E10: \\ should be followed by /, ? or &"));
+EXTERN char e_cmdwin[] INIT(=
+ N_(
+ "E11: Invalid in command-line window; <CR> executes, CTRL-C quits"));
+EXTERN char e_curdir[] INIT(=
+ N_(
+ "E12: Command not allowed from exrc/vimrc in current dir or tag search"));
+EXTERN char e_endif[] INIT(= N_("E171: Missing :endif"));
+EXTERN char e_endtry[] INIT(= N_("E600: Missing :endtry"));
+EXTERN char e_endwhile[] INIT(= N_("E170: Missing :endwhile"));
+EXTERN char e_endfor[] INIT(= N_("E170: Missing :endfor"));
+EXTERN char e_while[] INIT(= N_("E588: :endwhile without :while"));
+EXTERN char e_for[] INIT(= N_("E588: :endfor without :for"));
+EXTERN char e_exists[] INIT(= N_("E13: File exists (add ! to override)"));
+EXTERN char e_failed[] INIT(= N_("E472: Command failed"));
+EXTERN char e_internal[] INIT(= N_("E473: Internal error"));
+EXTERN char e_intern2[] INIT(= N_("E685: Internal error: %s"));
+EXTERN char e_interr[] INIT(= N_("Interrupted"));
+EXTERN char e_invarg[] INIT(= N_("E474: Invalid argument"));
+EXTERN char e_invarg2[] INIT(= N_("E475: Invalid argument: %s"));
+EXTERN char e_invargval[] INIT(= N_("E475: Invalid value for argument %s"));
+EXTERN char e_invargNval[] INIT(= N_("E475: Invalid value for argument %s: %s"));
+EXTERN char e_duparg2[] INIT(= N_("E983: Duplicate argument: %s"));
+EXTERN char e_invexpr2[] INIT(= N_("E15: Invalid expression: %s"));
+EXTERN char e_invrange[] INIT(= N_("E16: Invalid range"));
+EXTERN char e_invcmd[] INIT(= N_("E476: Invalid command"));
+EXTERN char e_isadir2[] INIT(= N_("E17: \"%s\" is a directory"));
+EXTERN char e_no_spell[] INIT(= N_("E756: Spell checking is not possible"));
+EXTERN char e_invchan[] INIT(= N_("E900: Invalid channel id"));
+EXTERN char e_invchanjob[] INIT(= N_("E900: Invalid channel id: not a job"));
+EXTERN char e_jobtblfull[] INIT(= N_("E901: Job table is full"));
+EXTERN char e_jobspawn[] INIT(= N_("E903: Process failed to start: %s: \"%s\""));
+EXTERN char e_channotpty[] INIT(= N_("E904: channel is not a pty"));
+EXTERN char e_stdiochan2[] INIT(= N_("E905: Couldn't open stdio channel: %s"));
+EXTERN char e_invstream[] INIT(= N_("E906: invalid stream for channel"));
+EXTERN char e_invstreamrpc[] INIT(= N_("E906: invalid stream for rpc channel, use 'rpc'"));
+EXTERN char e_streamkey[] INIT(=
+ N_(
+ "E5210: dict key '%s' already set for buffered stream in channel %"
+ PRIu64));
+EXTERN char e_libcall[] INIT(= N_("E364: Library call failed for \"%s()\""));
EXTERN char e_fsync[] INIT(= N_("E667: Fsync failed: %s"));
-EXTERN char_u e_mkdir[] INIT(= N_("E739: Cannot create directory %s: %s"));
-EXTERN char_u e_markinval[] INIT(= N_("E19: Mark has invalid line number"));
-EXTERN char_u e_marknotset[] INIT(= N_("E20: Mark not set"));
-EXTERN char_u e_modifiable[] INIT(= N_("E21: Cannot make changes, 'modifiable' is off"));
-EXTERN char_u e_nesting[] INIT(= N_("E22: Scripts nested too deep"));
-EXTERN char_u e_noalt[] INIT(= N_("E23: No alternate file"));
-EXTERN char_u e_noabbr[] INIT(= N_("E24: No such abbreviation"));
-EXTERN char_u e_nobang[] INIT(= N_("E477: No ! allowed"));
-EXTERN char_u e_nogroup[] INIT(= N_("E28: No such highlight group name: %s"));
-EXTERN char_u e_noinstext[] INIT(= N_("E29: No inserted text yet"));
-EXTERN char_u e_nolastcmd[] INIT(= N_("E30: No previous command line"));
-EXTERN char_u e_nomap[] INIT(= N_("E31: No such mapping"));
-EXTERN char_u e_nomatch[] INIT(= N_("E479: No match"));
-EXTERN char_u e_nomatch2[] INIT(= N_("E480: No match: %s"));
-EXTERN char_u e_noname[] INIT(= N_("E32: No file name"));
-EXTERN char_u e_nopresub[] INIT(= N_("E33: No previous substitute regular expression"));
-EXTERN char_u e_noprev[] INIT(= N_("E34: No previous command"));
-EXTERN char_u e_noprevre[] INIT(= N_("E35: No previous regular expression"));
-EXTERN char_u e_norange[] INIT(= N_("E481: No range allowed"));
-EXTERN char_u e_noroom[] INIT(= N_("E36: Not enough room"));
-EXTERN char_u e_notmp[] INIT(= N_("E483: Can't get temp file name"));
-EXTERN char_u e_notopen[] INIT(= N_("E484: Can't open file %s"));
-EXTERN char_u e_notopen_2[] INIT(= N_("E484: Can't open file %s: %s"));
-EXTERN char_u e_notread[] INIT(= N_("E485: Can't read file %s"));
-EXTERN char_u e_null[] INIT(= N_("E38: Null argument"));
-EXTERN char_u e_number_exp[] INIT(= N_("E39: Number expected"));
-EXTERN char_u e_openerrf[] INIT(= N_("E40: Can't open errorfile %s"));
-EXTERN char_u e_outofmem[] INIT(= N_("E41: Out of memory!"));
-EXTERN char_u e_patnotf[] INIT(= N_("Pattern not found"));
-EXTERN char_u e_patnotf2[] INIT(= N_("E486: Pattern not found: %s"));
-EXTERN char_u e_positive[] INIT(= N_("E487: Argument must be positive"));
-EXTERN char_u e_prev_dir[] INIT(= N_("E459: Cannot go back to previous directory"));
-
-EXTERN char_u e_quickfix[] INIT(= N_("E42: No Errors"));
-EXTERN char_u e_loclist[] INIT(= N_("E776: No location list"));
-EXTERN char_u e_re_damg[] INIT(= N_("E43: Damaged match string"));
-EXTERN char_u e_re_corr[] INIT(= N_("E44: Corrupted regexp program"));
-EXTERN char_u e_readonly[] INIT(= N_("E45: 'readonly' option is set (add ! to override)"));
-EXTERN char_u e_readonlyvar[] INIT(= N_("E46: Cannot change read-only variable \"%.*s\""));
-EXTERN char_u e_stringreq[] INIT(= N_("E928: String required"));
-EXTERN char_u e_dictreq[] INIT(= N_("E715: Dictionary required"));
-EXTERN char_u e_blobidx[] INIT(= N_("E979: Blob index out of range: %" PRId64));
-EXTERN char_u e_invalblob[] INIT(= N_("E978: Invalid operation for Blob"));
-EXTERN char_u e_toomanyarg[] INIT(= N_("E118: Too many arguments for function: %s"));
-EXTERN char_u e_dictkey[] INIT(= N_("E716: Key not present in Dictionary: \"%s\""));
-EXTERN char_u e_listreq[] INIT(= N_("E714: List required"));
-EXTERN char_u e_listblobreq[] INIT(= N_("E897: List or Blob required"));
-EXTERN char_u e_listdictarg[] INIT(= N_("E712: Argument of %s must be a List or Dictionary"));
-EXTERN char_u e_listdictblobarg[] INIT(=
- N_(
- "E896: Argument of %s must be a List, Dictionary or Blob"));
-EXTERN char_u e_readerrf[] INIT(= N_("E47: Error while reading errorfile"));
-EXTERN char_u e_sandbox[] INIT(= N_("E48: Not allowed in sandbox"));
-EXTERN char_u e_secure[] INIT(= N_("E523: Not allowed here"));
-EXTERN char_u e_screenmode[] INIT(= N_("E359: Screen mode setting not supported"));
-EXTERN char_u e_scroll[] INIT(= N_("E49: Invalid scroll size"));
-EXTERN char_u e_shellempty[] INIT(= N_("E91: 'shell' option is empty"));
-EXTERN char_u e_signdata[] INIT(= N_("E255: Couldn't read in sign data!"));
-EXTERN char_u e_swapclose[] INIT(= N_("E72: Close error on swap file"));
-EXTERN char_u e_tagstack[] INIT(= N_("E73: tag stack empty"));
-EXTERN char_u e_toocompl[] INIT(= N_("E74: Command too complex"));
-EXTERN char_u e_longname[] INIT(= N_("E75: Name too long"));
-EXTERN char_u e_toomsbra[] INIT(= N_("E76: Too many ["));
-EXTERN char_u e_toomany[] INIT(= N_("E77: Too many file names"));
-EXTERN char_u e_trailing[] INIT(= N_("E488: Trailing characters"));
-EXTERN char_u e_trailing2[] INIT(= N_("E488: Trailing characters: %s"));
-EXTERN char_u e_umark[] INIT(= N_("E78: Unknown mark"));
-EXTERN char_u e_wildexpand[] INIT(= N_("E79: Cannot expand wildcards"));
-EXTERN char_u e_winheight[] INIT(= N_("E591: 'winheight' cannot be smaller than 'winminheight'"));
-EXTERN char_u e_winwidth[] INIT(= N_("E592: 'winwidth' cannot be smaller than 'winminwidth'"));
-EXTERN char_u e_write[] INIT(= N_("E80: Error while writing"));
-EXTERN char_u e_zerocount[] INIT(= N_("E939: Positive count required"));
-EXTERN char_u e_usingsid[] INIT(= N_("E81: Using <SID> not in a script context"));
-EXTERN char_u e_missingparen[] INIT(= N_("E107: Missing parentheses: %s"));
-EXTERN char_u e_maxmempat[] INIT(= N_("E363: pattern uses more memory than 'maxmempattern'"));
-EXTERN char_u e_emptybuf[] INIT(= N_("E749: empty buffer"));
-EXTERN char_u e_nobufnr[] INIT(= N_("E86: Buffer %" PRId64 " does not exist"));
-
-EXTERN char_u e_invalpat[] INIT(= N_("E682: Invalid search pattern or delimiter"));
-EXTERN char_u e_bufloaded[] INIT(= N_("E139: File is loaded in another buffer"));
-EXTERN char_u e_notset[] INIT(= N_("E764: Option '%s' is not set"));
-EXTERN char_u e_invalidreg[] INIT(= N_("E850: Invalid register name"));
-EXTERN char_u e_dirnotf[] INIT(= N_("E919: Directory not found in '%s': \"%s\""));
-EXTERN char_u e_au_recursive[] INIT(= N_("E952: Autocommand caused recursive behavior"));
-EXTERN char_u e_autocmd_close[] INIT(= N_("E813: Cannot close autocmd window"));
-EXTERN char_u e_unsupportedoption[] INIT(= N_("E519: Option not supported"));
-EXTERN char_u e_fnametoolong[] INIT(= N_("E856: Filename too long"));
-EXTERN char_u e_float_as_string[] INIT(= N_("E806: using Float as a String"));
-
-EXTERN char_u e_autocmd_err[] INIT(=N_("E5500: autocmd has thrown an exception: %s"));
-EXTERN char_u e_cmdmap_err[] INIT(=N_("E5520: <Cmd> mapping must end with <CR>"));
-EXTERN char_u
+EXTERN char e_mkdir[] INIT(= N_("E739: Cannot create directory %s: %s"));
+EXTERN char e_markinval[] INIT(= N_("E19: Mark has invalid line number"));
+EXTERN char e_marknotset[] INIT(= N_("E20: Mark not set"));
+EXTERN char e_modifiable[] INIT(= N_("E21: Cannot make changes, 'modifiable' is off"));
+EXTERN char e_nesting[] INIT(= N_("E22: Scripts nested too deep"));
+EXTERN char e_noalt[] INIT(= N_("E23: No alternate file"));
+EXTERN char e_noabbr[] INIT(= N_("E24: No such abbreviation"));
+EXTERN char e_nobang[] INIT(= N_("E477: No ! allowed"));
+EXTERN char e_nogroup[] INIT(= N_("E28: No such highlight group name: %s"));
+EXTERN char e_noinstext[] INIT(= N_("E29: No inserted text yet"));
+EXTERN char e_nolastcmd[] INIT(= N_("E30: No previous command line"));
+EXTERN char e_nomap[] INIT(= N_("E31: No such mapping"));
+EXTERN char e_nomatch[] INIT(= N_("E479: No match"));
+EXTERN char e_nomatch2[] INIT(= N_("E480: No match: %s"));
+EXTERN char e_noname[] INIT(= N_("E32: No file name"));
+EXTERN char e_nopresub[] INIT(= N_("E33: No previous substitute regular expression"));
+EXTERN char e_noprev[] INIT(= N_("E34: No previous command"));
+EXTERN char e_noprevre[] INIT(= N_("E35: No previous regular expression"));
+EXTERN char e_norange[] INIT(= N_("E481: No range allowed"));
+EXTERN char e_noroom[] INIT(= N_("E36: Not enough room"));
+EXTERN char e_notmp[] INIT(= N_("E483: Can't get temp file name"));
+EXTERN char e_notopen[] INIT(= N_("E484: Can't open file %s"));
+EXTERN char e_notopen_2[] INIT(= N_("E484: Can't open file %s: %s"));
+EXTERN char e_notread[] INIT(= N_("E485: Can't read file %s"));
+EXTERN char e_null[] INIT(= N_("E38: Null argument"));
+EXTERN char e_number_exp[] INIT(= N_("E39: Number expected"));
+EXTERN char e_openerrf[] INIT(= N_("E40: Can't open errorfile %s"));
+EXTERN char e_outofmem[] INIT(= N_("E41: Out of memory!"));
+EXTERN char e_patnotf[] INIT(= N_("Pattern not found"));
+EXTERN char e_patnotf2[] INIT(= N_("E486: Pattern not found: %s"));
+EXTERN char e_positive[] INIT(= N_("E487: Argument must be positive"));
+EXTERN char e_prev_dir[] INIT(= N_("E459: Cannot go back to previous directory"));
+
+EXTERN char e_quickfix[] INIT(= N_("E42: No Errors"));
+EXTERN char e_loclist[] INIT(= N_("E776: No location list"));
+EXTERN char e_re_damg[] INIT(= N_("E43: Damaged match string"));
+EXTERN char e_re_corr[] INIT(= N_("E44: Corrupted regexp program"));
+EXTERN char e_readonly[] INIT(= N_("E45: 'readonly' option is set (add ! to override)"));
+EXTERN char e_readonlyvar[] INIT(= N_("E46: Cannot change read-only variable \"%.*s\""));
+EXTERN char e_stringreq[] INIT(= N_("E928: String required"));
+EXTERN char e_dictreq[] INIT(= N_("E715: Dictionary required"));
+EXTERN char e_blobidx[] INIT(= N_("E979: Blob index out of range: %" PRId64));
+EXTERN char e_invalblob[] INIT(= N_("E978: Invalid operation for Blob"));
+EXTERN char e_toomanyarg[] INIT(= N_("E118: Too many arguments for function: %s"));
+EXTERN char e_dictkey[] INIT(= N_("E716: Key not present in Dictionary: \"%s\""));
+EXTERN char e_listreq[] INIT(= N_("E714: List required"));
+EXTERN char e_listblobreq[] INIT(= N_("E897: List or Blob required"));
+EXTERN char e_listdictarg[] INIT(= N_("E712: Argument of %s must be a List or Dictionary"));
+EXTERN char e_listdictblobarg[] INIT(=
+ N_(
+ "E896: Argument of %s must be a List, Dictionary or Blob"));
+EXTERN char e_readerrf[] INIT(= N_("E47: Error while reading errorfile"));
+EXTERN char e_sandbox[] INIT(= N_("E48: Not allowed in sandbox"));
+EXTERN char e_secure[] INIT(= N_("E523: Not allowed here"));
+EXTERN char e_screenmode[] INIT(= N_("E359: Screen mode setting not supported"));
+EXTERN char e_scroll[] INIT(= N_("E49: Invalid scroll size"));
+EXTERN char e_shellempty[] INIT(= N_("E91: 'shell' option is empty"));
+EXTERN char e_signdata[] INIT(= N_("E255: Couldn't read in sign data!"));
+EXTERN char e_swapclose[] INIT(= N_("E72: Close error on swap file"));
+EXTERN char e_tagstack[] INIT(= N_("E73: tag stack empty"));
+EXTERN char e_toocompl[] INIT(= N_("E74: Command too complex"));
+EXTERN char e_longname[] INIT(= N_("E75: Name too long"));
+EXTERN char e_toomsbra[] INIT(= N_("E76: Too many ["));
+EXTERN char e_toomany[] INIT(= N_("E77: Too many file names"));
+EXTERN char e_trailing[] INIT(= N_("E488: Trailing characters"));
+EXTERN char e_trailing2[] INIT(= N_("E488: Trailing characters: %s"));
+EXTERN char e_umark[] INIT(= N_("E78: Unknown mark"));
+EXTERN char e_wildexpand[] INIT(= N_("E79: Cannot expand wildcards"));
+EXTERN char e_winheight[] INIT(= N_("E591: 'winheight' cannot be smaller than 'winminheight'"));
+EXTERN char e_winwidth[] INIT(= N_("E592: 'winwidth' cannot be smaller than 'winminwidth'"));
+EXTERN char e_write[] INIT(= N_("E80: Error while writing"));
+EXTERN char e_zerocount[] INIT(= N_("E939: Positive count required"));
+EXTERN char e_usingsid[] INIT(= N_("E81: Using <SID> not in a script context"));
+EXTERN char e_missingparen[] INIT(= N_("E107: Missing parentheses: %s"));
+EXTERN char e_maxmempat[] INIT(= N_("E363: pattern uses more memory than 'maxmempattern'"));
+EXTERN char e_emptybuf[] INIT(= N_("E749: empty buffer"));
+EXTERN char e_nobufnr[] INIT(= N_("E86: Buffer %" PRId64 " does not exist"));
+
+EXTERN char e_invalpat[] INIT(= N_("E682: Invalid search pattern or delimiter"));
+EXTERN char e_bufloaded[] INIT(= N_("E139: File is loaded in another buffer"));
+EXTERN char e_notset[] INIT(= N_("E764: Option '%s' is not set"));
+EXTERN char e_invalidreg[] INIT(= N_("E850: Invalid register name"));
+EXTERN char e_dirnotf[] INIT(= N_("E919: Directory not found in '%s': \"%s\""));
+EXTERN char e_au_recursive[] INIT(= N_("E952: Autocommand caused recursive behavior"));
+EXTERN char e_autocmd_close[] INIT(= N_("E813: Cannot close autocmd window"));
+EXTERN char e_unsupportedoption[] INIT(= N_("E519: Option not supported"));
+EXTERN char e_fnametoolong[] INIT(= N_("E856: Filename too long"));
+EXTERN char e_float_as_string[] INIT(= N_("E806: using Float as a String"));
+
+EXTERN char e_autocmd_err[] INIT(=N_("E5500: autocmd has thrown an exception: %s"));
+EXTERN char e_cmdmap_err[] INIT(=N_("E5520: <Cmd> mapping must end with <CR>"));
+EXTERN char
e_cmdmap_repeated[] INIT(=N_("E5521: <Cmd> mapping must end with <CR> before second <Cmd>"));
-EXTERN char_u e_cmdmap_key[] INIT(=N_("E5522: <Cmd> mapping must not include %s key"));
+EXTERN char e_cmdmap_key[] INIT(=N_("E5522: <Cmd> mapping must not include %s key"));
-EXTERN char_u e_api_error[] INIT(=N_("E5555: API call: %s"));
+EXTERN char e_api_error[] INIT(=N_("E5555: API call: %s"));
EXTERN char e_luv_api_disabled[] INIT(=N_("E5560: %s must not be called in a lua loop callback"));
-EXTERN char_u e_floatonly[] INIT(=N_(
- "E5601: Cannot close window, only floating window would remain"));
-EXTERN char_u e_floatexchange[] INIT(=N_("E5602: Cannot exchange or rotate float"));
+EXTERN char e_floatonly[] INIT(=N_(
+ "E5601: Cannot close window, only floating window would remain"));
+EXTERN char e_floatexchange[] INIT(=N_("E5602: Cannot exchange or rotate float"));
EXTERN char e_non_empty_string_required[] INIT(= N_("E1142: Non-empty string required"));
diff --git a/src/nvim/hardcopy.c b/src/nvim/hardcopy.c
index d9830de2b5..38bd914558 100644
--- a/src/nvim/hardcopy.c
+++ b/src/nvim/hardcopy.c
@@ -263,7 +263,7 @@ struct prt_resfile_buffer_S {
* Parse 'printoptions' and set the flags in "printer_opts".
* Returns an error message or NULL;
*/
-char_u *parse_printoptions(void)
+char *parse_printoptions(void)
{
return parse_list_options(p_popt, printer_opts, OPT_PRINT_NUM_OPTIONS);
}
@@ -272,7 +272,7 @@ char_u *parse_printoptions(void)
* Parse 'printoptions' and set the flags in "printer_opts".
* Returns an error message or NULL;
*/
-char_u *parse_printmbfont(void)
+char *parse_printmbfont(void)
{
return parse_list_options(p_pmfn, mbfont_opts, OPT_MBFONT_NUM_OPTIONS);
}
@@ -286,10 +286,10 @@ char_u *parse_printmbfont(void)
* Returns an error message for an illegal option, NULL otherwise.
* Only used for the printer at the moment...
*/
-static char_u *parse_list_options(char_u *option_str, option_table_T *table, size_t table_size)
+static char *parse_list_options(char_u *option_str, option_table_T *table, size_t table_size)
{
option_table_T *old_opts;
- char_u *ret = NULL;
+ char *ret = NULL;
char_u *stringp;
char_u *colonp;
char_u *commap;
@@ -312,7 +312,7 @@ static char_u *parse_list_options(char_u *option_str, option_table_T *table, siz
while (*stringp) {
colonp = vim_strchr(stringp, ':');
if (colonp == NULL) {
- ret = (char_u *)N_("E550: Missing colon");
+ ret = N_("E550: Missing colon");
break;
}
commap = vim_strchr(stringp, ',');
@@ -329,7 +329,7 @@ static char_u *parse_list_options(char_u *option_str, option_table_T *table, siz
}
if (idx == table_size) {
- ret = (char_u *)N_("E551: Illegal component");
+ ret = N_("E551: Illegal component");
break;
}
@@ -338,7 +338,7 @@ static char_u *parse_list_options(char_u *option_str, option_table_T *table, siz
if (table[idx].hasnum) {
if (!ascii_isdigit(*p)) {
- ret = (char_u *)N_("E552: digit expected");
+ ret = N_("E552: digit expected");
break;
}
@@ -621,12 +621,12 @@ void ex_hardcopy(exarg_T *eap)
settings.has_color = TRUE;
if (*eap->arg == '>') {
- char_u *errormsg = NULL;
+ char *errormsg = NULL;
// Expand things like "%.ps".
if (expand_filename(eap, eap->cmdlinep, &errormsg) == FAIL) {
if (errormsg != NULL) {
- EMSG(errormsg);
+ emsg(errormsg);
}
return;
}
@@ -1329,7 +1329,7 @@ static void prt_write_file_raw_len(char_u *buffer, size_t bytes)
{
if (!prt_file_error
&& fwrite(buffer, sizeof(char_u), bytes, prt_ps_fd) != bytes) {
- EMSG(_("E455: Error writing to PostScript output file"));
+ emsg(_("E455: Error writing to PostScript output file"));
prt_file_error = TRUE;
}
}
@@ -1704,7 +1704,7 @@ static bool prt_open_resource(struct prt_ps_resource_S *resource)
FILE *fd_resource = os_fopen((char *)resource->filename, READBIN);
if (fd_resource == NULL) {
- EMSG2(_("E624: Can't open file \"%s\""), resource->filename);
+ semsg(_("E624: Can't open file \"%s\""), resource->filename);
return false;
}
memset(prt_resfile.buffer, NUL, PRT_FILE_BUFFER_LEN);
@@ -1713,7 +1713,7 @@ static bool prt_open_resource(struct prt_ps_resource_S *resource)
prt_resfile.len = (int)fread((char *)prt_resfile.buffer, sizeof(char_u),
PRT_FILE_BUFFER_LEN, fd_resource);
if (ferror(fd_resource)) {
- EMSG2(_("E457: Can't read PostScript resource file \"%s\""),
+ semsg(_("E457: Can't read PostScript resource file \"%s\""),
resource->filename);
fclose(fd_resource);
return false;
@@ -1729,7 +1729,7 @@ static bool prt_open_resource(struct prt_ps_resource_S *resource)
if (prt_resfile_strncmp(offset, PRT_RESOURCE_HEADER,
(int)STRLEN(PRT_RESOURCE_HEADER)) != 0) {
- EMSG2(_("E618: file \"%s\" is not a PostScript resource file"),
+ semsg(_("E618: file \"%s\" is not a PostScript resource file"),
resource->filename);
return false;
}
@@ -1746,7 +1746,7 @@ static bool prt_open_resource(struct prt_ps_resource_S *resource)
}
if (prt_resfile_strncmp(offset, PRT_RESOURCE_RESOURCE,
(int)STRLEN(PRT_RESOURCE_RESOURCE)) != 0) {
- EMSG2(_("E619: file \"%s\" is not a supported PostScript resource file"),
+ semsg(_("E619: file \"%s\" is not a supported PostScript resource file"),
resource->filename);
return false;
}
@@ -1763,7 +1763,7 @@ static bool prt_open_resource(struct prt_ps_resource_S *resource)
(int)STRLEN(PRT_RESOURCE_CMAP)) == 0) {
resource->type = PRT_RESOURCE_TYPE_CMAP;
} else {
- EMSG2(_("E619: file \"%s\" is not a supported PostScript resource file"),
+ semsg(_("E619: file \"%s\" is not a supported PostScript resource file"),
resource->filename);
return false;
}
@@ -1804,7 +1804,7 @@ static bool prt_open_resource(struct prt_ps_resource_S *resource)
}
if (!seen_title || !seen_version) {
- EMSG2(_("E619: file \"%s\" is not a supported PostScript resource file"),
+ semsg(_("E619: file \"%s\" is not a supported PostScript resource file"),
resource->filename);
return false;
}
@@ -1817,7 +1817,7 @@ static bool prt_check_resource(const struct prt_ps_resource_S *resource, const c
{
// Version number m.n should match, the revision number does not matter
if (STRNCMP(resource->version, version, STRLEN(version))) {
- EMSG2(_("E621: \"%s\" resource file has wrong version"),
+ semsg(_("E621: \"%s\" resource file has wrong version"),
resource->name);
return false;
}
@@ -2203,7 +2203,7 @@ int mch_print_init(prt_settings_T *psettings, char_u *jobname, int forceit)
if (!prt_custom_cmap) {
// Check encoding and character set are compatible
if ((p_mbenc->needs_charset & p_mbchar->has_charset) == 0) {
- EMSG(_("E673: Incompatible multi-byte encoding and character set."));
+ emsg(_("E673: Incompatible multi-byte encoding and character set."));
return FALSE;
}
@@ -2215,7 +2215,7 @@ int mch_print_init(prt_settings_T *psettings, char_u *jobname, int forceit)
} else {
// Add custom CMap character set name
if (*p_pmcs == NUL) {
- EMSG(_("E674: printmbcharset cannot be empty with multi-byte encoding."));
+ emsg(_("E674: printmbcharset cannot be empty with multi-byte encoding."));
return FALSE;
}
STRLCPY(prt_cmap, p_pmcs, sizeof(prt_cmap) - 2);
@@ -2231,7 +2231,7 @@ int mch_print_init(prt_settings_T *psettings, char_u *jobname, int forceit)
STRCAT(prt_cmap, "H");
if (!mbfont_opts[OPT_MBFONT_REGULAR].present) {
- EMSG(_("E675: No default font specified for multi-byte printing."));
+ emsg(_("E675: No default font specified for multi-byte printing."));
return FALSE;
}
@@ -2394,7 +2394,7 @@ int mch_print_init(prt_settings_T *psettings, char_u *jobname, int forceit)
if (psettings->outfile == NULL) {
prt_ps_file_name = vim_tempname();
if (prt_ps_file_name == NULL) {
- EMSG(_(e_notmp));
+ emsg(_(e_notmp));
return FAIL;
}
prt_ps_fd = os_fopen((char *)prt_ps_file_name, WRITEBIN);
@@ -2406,7 +2406,7 @@ int mch_print_init(prt_settings_T *psettings, char_u *jobname, int forceit)
}
}
if (prt_ps_fd == NULL) {
- EMSG(_("E324: Can't open PostScript output file"));
+ emsg(_("E324: Can't open PostScript output file"));
mch_print_cleanup();
return FAIL;
}
@@ -2439,7 +2439,7 @@ static int prt_add_resource(struct prt_ps_resource_S *resource)
fd_resource = os_fopen((char *)resource->filename, READBIN);
if (fd_resource == NULL) {
- EMSG2(_("E456: Can't open file \"%s\""), resource->filename);
+ semsg(_("E456: Can't open file \"%s\""), resource->filename);
return FALSE;
}
switch (resource->type) {
@@ -2459,7 +2459,7 @@ static int prt_add_resource(struct prt_ps_resource_S *resource)
bytes_read = fread((char *)resource_buffer, sizeof(char_u),
sizeof(resource_buffer), fd_resource);
if (ferror(fd_resource)) {
- EMSG2(_("E457: Can't read PostScript resource file \"%s\""),
+ semsg(_("E457: Can't read PostScript resource file \"%s\""),
resource->filename);
fclose(fd_resource);
return FALSE;
@@ -2567,7 +2567,7 @@ int mch_print_begin(prt_settings_T *psettings)
// Search for external resources VIM supplies
if (!prt_find_resource("prolog", &res_prolog)) {
- EMSG(_("E456: Can't find PostScript resource file \"prolog.ps\""));
+ emsg(_("E456: Can't find PostScript resource file \"prolog.ps\""));
return FALSE;
}
if (!prt_open_resource(&res_prolog)) {
@@ -2579,7 +2579,7 @@ int mch_print_begin(prt_settings_T *psettings)
if (prt_out_mbyte) {
// Look for required version of multi-byte printing procset
if (!prt_find_resource("cidfont", &res_cidfont)) {
- EMSG(_("E456: Can't find PostScript resource file \"cidfont.ps\""));
+ emsg(_("E456: Can't find PostScript resource file \"cidfont.ps\""));
return FALSE;
}
if (!prt_open_resource(&res_cidfont)) {
@@ -2609,7 +2609,7 @@ int mch_print_begin(prt_settings_T *psettings)
// Use latin1 as default printing encoding
p_encoding = (char_u *)"latin1";
if (!prt_find_resource((char *)p_encoding, &res_encoding)) {
- EMSG2(_("E456: Can't find PostScript resource file \"%s.ps\""),
+ semsg(_("E456: Can't find PostScript resource file \"%s.ps\""),
p_encoding);
return FALSE;
}
@@ -2628,7 +2628,7 @@ int mch_print_begin(prt_settings_T *psettings)
if (prt_use_courier) {
// Include ASCII range encoding vector
if (!prt_find_resource(prt_ascii_encoding, &res_encoding)) {
- EMSG2(_("E456: Can't find PostScript resource file \"%s.ps\""),
+ semsg(_("E456: Can't find PostScript resource file \"%s.ps\""),
prt_ascii_encoding);
return FALSE;
}
@@ -2644,7 +2644,7 @@ int mch_print_begin(prt_settings_T *psettings)
if (!(enc_canon_props(p_enc) & enc_canon_props(p_encoding) & ENC_8BIT)) {
// Set up encoding conversion if required
if (convert_setup(&prt_conv, p_enc, p_encoding) == FAIL) {
- emsgf(_("E620: Unable to convert to print encoding \"%s\""),
+ semsg(_("E620: Unable to convert to print encoding \"%s\""),
p_encoding);
return false;
}
@@ -2654,7 +2654,7 @@ int mch_print_begin(prt_settings_T *psettings)
if (prt_out_mbyte && prt_custom_cmap) {
// Find user supplied CMap
if (!prt_find_resource(prt_cmap, &res_cmap)) {
- EMSG2(_("E456: Can't find PostScript resource file \"%s.ps\""),
+ semsg(_("E456: Can't find PostScript resource file \"%s.ps\""),
prt_cmap);
return FALSE;
}
@@ -2879,7 +2879,7 @@ void mch_print_end(prt_settings_T *psettings)
// Not printing to a file: use 'printexpr' to print the file.
if (eval_printexpr((char *)prt_ps_file_name, (char *)psettings->arguments)
== FAIL) {
- EMSG(_("E365: Failed to print PostScript file"));
+ emsg(_("E365: Failed to print PostScript file"));
} else {
prt_message((char_u *)_("Print job sent."));
}
diff --git a/src/nvim/hashtab.c b/src/nvim/hashtab.c
index a8e5de839a..ca6f033c47 100644
--- a/src/nvim/hashtab.c
+++ b/src/nvim/hashtab.c
@@ -281,11 +281,11 @@ static void hash_may_resize(hashtab_T *ht, size_t minitems)
#ifdef HT_DEBUG
if (ht->ht_used > ht->ht_filled) {
- EMSG("hash_may_resize(): more used than filled");
+ emsg("hash_may_resize(): more used than filled");
}
if (ht->ht_filled >= ht->ht_mask + 1) {
- EMSG("hash_may_resize(): table completely filled");
+ emsg("hash_may_resize(): table completely filled");
}
#endif // ifdef HT_DEBUG
diff --git a/src/nvim/highlight.c b/src/nvim/highlight.c
index 737e668e81..3050ca02de 100644
--- a/src/nvim/highlight.c
+++ b/src/nvim/highlight.c
@@ -76,7 +76,7 @@ static int get_attr_entry(HlEntry entry)
// compute new ones for all groups.
// When called recursively, we are really out of numbers.
if (recursive) {
- EMSG(_("E424: Too many different highlighting attributes in use"));
+ emsg(_("E424: Too many different highlighting attributes in use"));
return 0;
}
recursive = true;
diff --git a/src/nvim/if_cscope.c b/src/nvim/if_cscope.c
index f3b46eb9e4..4ed7ddc38a 100644
--- a/src/nvim/if_cscope.c
+++ b/src/nvim/if_cscope.c
@@ -64,7 +64,7 @@ static cscmd_T cs_cmds[] =
static void cs_usage_msg(csid_e x)
{
- (void)EMSG2(_("E560: Usage: cs[cope] %s"), cs_cmds[(int)x].usage);
+ (void)semsg(_("E560: Usage: cs[cope] %s"), cs_cmds[(int)x].usage);
}
@@ -216,7 +216,7 @@ void ex_cstag(exarg_T *eap)
int ret = FALSE;
if (*eap->arg == NUL) {
- (void)EMSG(_("E562: Usage: cstag <ident>"));
+ (void)emsg(_("E562: Usage: cstag <ident>"));
return;
}
@@ -268,7 +268,7 @@ void ex_cstag(exarg_T *eap)
}
if (!ret) {
- (void)EMSG(_("E257: cstag: tag not found"));
+ (void)emsg(_("E257: cstag: tag not found"));
g_do_tagpreview = 0;
}
}
@@ -407,7 +407,7 @@ static void cs_stat_emsg(char *fname)
char *buf = xmalloc(strlen(stat_emsg) + MAXPATHL + 10);
(void)sprintf(buf, stat_emsg, fname, errno);
- (void)EMSG(buf);
+ (void)emsg(buf);
xfree(buf);
}
@@ -489,7 +489,7 @@ staterr:
i = cs_insert_filelist(fname, ppath, flags, &file_info);
} else {
if (p_csverbose) {
- (void)EMSG2(_("E564: %s is not a directory or a valid cscope database"),
+ (void)semsg(_("E564: %s is not a directory or a valid cscope database"),
fname);
}
goto add_err;
@@ -550,7 +550,7 @@ static size_t cs_cnt_connections(void)
/// @param idx connection index
static void cs_reading_emsg(size_t idx)
{
- EMSGU(_("E262: error reading cscope connection %" PRIu64), idx);
+ semsg(_("E262: error reading cscope connection %" PRIu64), (uint64_t)idx);
}
#define CSREAD_BUFSIZE 2048
@@ -662,7 +662,7 @@ static char *cs_create_cmd(char *csoption, char *pattern)
search = 9;
break;
default:
- (void)EMSG(_("E561: unknown cscope search type"));
+ (void)emsg(_("E561: unknown cscope search type"));
cs_usage_msg(Find);
return NULL;
}
@@ -700,7 +700,7 @@ static int cs_create_connection(size_t i)
*/
to_cs[0] = to_cs[1] = from_cs[0] = from_cs[1] = -1;
if (pipe(to_cs) < 0 || pipe(from_cs) < 0) {
- (void)EMSG(_("E566: Could not create cscope pipes"));
+ (void)emsg(_("E566: Could not create cscope pipes"));
err_closing:
if (to_cs[0] != -1) {
(void)close(to_cs[0]);
@@ -719,7 +719,7 @@ err_closing:
switch (csinfo[i].pid = fork()) {
case -1:
- (void)EMSG(_("E622: Could not fork for cscope"));
+ (void)emsg(_("E622: Could not fork for cscope"));
goto err_closing;
case 0: // child: run cscope.
if (dup2(to_cs[0], STDIN_FILENO) == -1) {
@@ -752,7 +752,7 @@ err_closing:
if (!(pipe_stdin = CreatePipe(&stdin_rd, &stdin_wr, &sa, 0))
|| !(pipe_stdout = CreatePipe(&stdout_rd, &stdout_wr, &sa, 0))) {
- (void)EMSG(_("E566: Could not create cscope pipes"));
+ (void)emsg(_("E566: Could not create cscope pipes"));
err_closing:
if (pipe_stdin) {
CloseHandle(stdin_rd);
@@ -856,7 +856,7 @@ err_closing:
if (!created) {
PERROR(_("cs_create_connection exec failed"));
- (void)EMSG(_("E623: Could not spawn cscope process"));
+ (void)emsg(_("E623: Could not spawn cscope process"));
goto err_closing;
}
// else
@@ -892,7 +892,7 @@ static int cs_find(exarg_T *eap)
char *opt, *pat;
if (cs_check_for_connections() == FALSE) {
- (void)EMSG(_("E567: no cscope connections"));
+ (void)emsg(_("E567: no cscope connections"));
return FALSE;
}
@@ -975,7 +975,7 @@ static int cs_find_common(char *opt, char *pat, int forceit, int verbose, int us
char *buf = xmalloc(strlen(nf));
sprintf(buf, nf, *qfpos, *(qfpos-1));
- (void)EMSG(buf);
+ (void)emsg(buf);
xfree(buf);
return FALSE;
}
@@ -1035,7 +1035,7 @@ static int cs_find_common(char *opt, char *pat, int forceit, int verbose, int us
buf = xmalloc(strlen(opt) + strlen(pat) + strlen(nf));
sprintf(buf, nf, opt, pat);
- (void)EMSG(buf);
+ (void)emsg(buf);
xfree(buf);
xfree(nummatches);
return FALSE;
@@ -1050,7 +1050,7 @@ static int cs_find_common(char *opt, char *pat, int forceit, int verbose, int us
f = os_fopen((char *)tmp, "w");
if (f == NULL) {
- EMSG2(_(e_notopen), tmp);
+ semsg(_(e_notopen), tmp);
} else {
cs_file_results(f, nummatches);
fclose(f);
@@ -1161,7 +1161,7 @@ static int cs_insert_filelist(char *fname, char *ppath, char *flags, FileInfo *f
if (csinfo[j].fname != NULL
&& os_fileid_equal_fileinfo(&(csinfo[j].file_id), file_info)) {
if (p_csverbose) {
- (void)EMSG(_("E568: duplicate cscope database not added"));
+ (void)emsg(_("E568: duplicate cscope database not added"));
}
return CSCOPE_FAILURE;
}
@@ -1267,7 +1267,7 @@ static int cs_kill(exarg_T *eap)
i = (size_t)num;
} else { // All negative values besides -1 are invalid.
if (p_csverbose) {
- (void)EMSG2(_("E261: cscope connection %s not found"), stok);
+ (void)semsg(_("E261: cscope connection %s not found"), stok);
}
return CSCOPE_FAILURE;
}
@@ -1283,7 +1283,7 @@ static int cs_kill(exarg_T *eap)
if (!killall && (i >= csinfo_size || csinfo[i].fname == NULL)) {
if (p_csverbose) {
- (void)EMSG2(_("E261: cscope connection %s not found"), stok);
+ (void)semsg(_("E261: cscope connection %s not found"), stok);
}
return CSCOPE_FAILURE;
} else {
@@ -1428,7 +1428,7 @@ static char *cs_manage_matches(char **matches, char **contexts, size_t totmatche
cs_print_tags_priv(mp, cp, cnt);
break;
default: // should not reach here
- IEMSG(_("E570: fatal error in cs_manage_matches"));
+ iemsg(_("E570: fatal error in cs_manage_matches"));
return NULL;
}
@@ -1776,7 +1776,7 @@ static int cs_read_prompt(size_t i)
buf[bufpos - epromptlen] = NUL;
// print message to user
- (void)EMSG2(cs_emsg, buf);
+ (void)semsg(cs_emsg, buf);
// send RETURN to cscope
(void)putc('\n', csinfo[i].to_fp);
@@ -1799,7 +1799,7 @@ static int cs_read_prompt(size_t i)
if (ch == EOF) {
PERROR("cs_read_prompt EOF");
if (buf != NULL && buf[0] != NUL) {
- (void)EMSG2(cs_emsg, buf);
+ (void)semsg(cs_emsg, buf);
} else if (p_csverbose) {
cs_reading_emsg(i); // don't have additional information
}
diff --git a/src/nvim/keymap.c b/src/nvim/keymap.c
index b724d82f7c..fc2f9b04f5 100644
--- a/src/nvim/keymap.c
+++ b/src/nvim/keymap.c
@@ -647,7 +647,7 @@ int find_special_key(const char_u **srcp, const size_t src_len, int *const modp,
} else if (end - bp > 4 && STRNICMP(bp, "char-", 5) == 0) {
vim_str2nr(bp + 5, NULL, &l, STR2NR_ALL, NULL, NULL, 0, true);
if (l == 0) {
- EMSG(_(e_invarg));
+ emsg(_(e_invarg));
return 0;
}
bp += l + 5;
@@ -677,7 +677,7 @@ int find_special_key(const char_u **srcp, const size_t src_len, int *const modp,
// <Char-123> or <Char-033> or <Char-0x33>
vim_str2nr(last_dash + 6, NULL, &l, STR2NR_ALL, NULL, &n, 0, true);
if (l == 0) {
- EMSG(_(e_invarg));
+ emsg(_(e_invarg));
return 0;
}
key = (int)n;
@@ -891,7 +891,7 @@ char_u *replace_termcodes(const char_u *from, const size_t from_len, char_u **bu
// (room: 5 * 6 = 30 bytes; needed: 3 + <nr> + 1 <= 14)
if (end - src >= 4 && STRNICMP(src, "<SID>", 5) == 0) {
if (current_sctx.sc_sid <= 0) {
- EMSG(_(e_usingsid));
+ emsg(_(e_usingsid));
} else {
src += 5;
result[dlen++] = K_SPECIAL;
diff --git a/src/nvim/lua/converter.c b/src/nvim/lua/converter.c
index ca3c4f604a..9f2372f831 100644
--- a/src/nvim/lua/converter.c
+++ b/src/nvim/lua/converter.c
@@ -62,7 +62,7 @@ static LuaTableProps nlua_traverse_table(lua_State *const lstate)
LuaTableProps ret;
memset(&ret, 0, sizeof(ret));
if (!lua_checkstack(lstate, lua_gettop(lstate) + 3)) {
- emsgf(_("E1502: Lua failed to grow stack to %i"), lua_gettop(lstate) + 2);
+ semsg(_("E1502: Lua failed to grow stack to %i"), lua_gettop(lstate) + 2);
ret.type = kObjectTypeNil;
return ret;
}
@@ -198,7 +198,7 @@ bool nlua_pop_typval(lua_State *lstate, typval_T *ret_tv)
kvi_push(stack, ((TVPopStackItem) { ret_tv, false, false, 0 }));
while (ret && kv_size(stack)) {
if (!lua_checkstack(lstate, lua_gettop(lstate) + 3)) {
- emsgf(_("E1502: Lua failed to grow stack to %i"), lua_gettop(lstate) + 3);
+ semsg(_("E1502: Lua failed to grow stack to %i"), lua_gettop(lstate) + 3);
ret = false;
break;
}
@@ -376,7 +376,7 @@ bool nlua_pop_typval(lua_State *lstate, typval_T *ret_tv)
cur.tv->vval.v_float = (float_T)table_props.val;
break;
case kObjectTypeNil:
- EMSG(_("E5100: Cannot convert given lua table: table "
+ emsg(_("E5100: Cannot convert given lua table: table "
"should either have a sequence of positive integer keys "
"or contain only string keys"));
ret = false;
@@ -408,13 +408,13 @@ nlua_pop_typval_table_processing_end:
cur.tv->v_type = VAR_SPECIAL;
cur.tv->vval.v_special = kSpecialVarNull;
} else {
- EMSG(_("E5101: Cannot convert given lua type"));
+ emsg(_("E5101: Cannot convert given lua type"));
ret = false;
}
break;
}
default:
- EMSG(_("E5101: Cannot convert given lua type"));
+ emsg(_("E5101: Cannot convert given lua type"));
ret = false;
break;
}
@@ -503,7 +503,7 @@ static bool typval_conv_special = false;
#define TYPVAL_ENCODE_CONV_LIST_START(tv, len) \
do { \
if (!lua_checkstack(lstate, lua_gettop(lstate) + 3)) { \
- emsgf(_("E5102: Lua failed to grow stack to %i"), \
+ semsg(_("E5102: Lua failed to grow stack to %i"), \
lua_gettop(lstate) + 3); \
return false; \
} \
@@ -526,7 +526,7 @@ static bool typval_conv_special = false;
#define TYPVAL_ENCODE_CONV_DICT_START(tv, dict, len) \
do { \
if (!lua_checkstack(lstate, lua_gettop(lstate) + 3)) { \
- emsgf(_("E5102: Lua failed to grow stack to %i"), \
+ semsg(_("E5102: Lua failed to grow stack to %i"), \
lua_gettop(lstate) + 3); \
return false; \
} \
@@ -614,7 +614,7 @@ bool nlua_push_typval(lua_State *lstate, typval_T *const tv, bool special)
const int initial_size = lua_gettop(lstate);
if (!lua_checkstack(lstate, initial_size + 2)) {
- emsgf(_("E1502: Lua failed to grow stack to %i"), initial_size + 4);
+ semsg(_("E1502: Lua failed to grow stack to %i"), initial_size + 4);
return false;
}
if (encode_vim_to_lua(lstate, tv, "nlua_push_typval argument") == FAIL) {
diff --git a/src/nvim/lua/executor.c b/src/nvim/lua/executor.c
index 05c33d7918..f3888c7a90 100644
--- a/src/nvim/lua/executor.c
+++ b/src/nvim/lua/executor.c
@@ -80,7 +80,7 @@ static void nlua_error(lua_State *const lstate, const char *const msg)
const char *const str = lua_tolstring(lstate, -1, &len);
msg_ext_set_kind("lua_error");
- emsgf_multiline(msg, (int)len, str);
+ semsg_multiline(msg, (int)len, str);
lua_pop(lstate, 1);
}
@@ -101,7 +101,7 @@ static void nlua_luv_error_event(void **argv)
{
char *error = (char *)argv[0];
msg_ext_set_kind("lua_error");
- emsgf_multiline("Error executing luv callback:\n%s", error);
+ semsg_multiline("Error executing luv callback:\n%s", error);
xfree(error);
}
@@ -458,7 +458,7 @@ void nlua_init(void)
lua_State *lstate = luaL_newstate();
if (lstate == NULL) {
- EMSG(_("E970: Failed to initialize lua interpreter"));
+ emsg(_("E970: Failed to initialize lua interpreter"));
preserve_exit();
}
luaL_openlibs(lstate);
@@ -1091,7 +1091,7 @@ void ex_luado(exarg_T *const eap)
FUNC_ATTR_NONNULL_ALL
{
if (u_save(eap->line1 - 1, eap->line2 + 1) == FAIL) {
- EMSG(_("cannot save undo information"));
+ emsg(_("cannot save undo information"));
return;
}
const char *const cmd = (const char *)eap->arg;
diff --git a/src/nvim/main.c b/src/nvim/main.c
index 123872b3df..0409628ed8 100644
--- a/src/nvim/main.c
+++ b/src/nvim/main.c
@@ -823,11 +823,11 @@ static void command_line_scan(mparm_T *parmp)
msgpack_packer *p = msgpack_packer_new(&fp, msgpack_file_write);
if (fof_ret != 0) {
- emsgf(_("E5421: Failed to open stdin: %s"), os_strerror(fof_ret));
+ semsg(_("E5421: Failed to open stdin: %s"), os_strerror(fof_ret));
}
if (p == NULL) {
- EMSG(_(e_outofmem));
+ emsg(_(e_outofmem));
}
Object md = DICTIONARY_OBJ(api_metadata());
@@ -1742,7 +1742,7 @@ static bool do_user_initialization(void)
if (os_path_exists(init_lua_path)
&& do_source((char *)init_lua_path, true, DOSO_VIMRC)) {
if (os_path_exists(user_vimrc)) {
- EMSG3(_("E5422: Conflicting configs: \"%s\" \"%s\""), init_lua_path,
+ semsg(_("E5422: Conflicting configs: \"%s\" \"%s\""), init_lua_path,
user_vimrc);
}
@@ -1814,7 +1814,7 @@ static void source_startup_scripts(const mparm_T *const parmp)
// Do nothing.
} else {
if (do_source(parmp->use_vimrc, false, DOSO_NONE) != OK) {
- EMSG2(_("E282: Cannot read from \"%s\""), parmp->use_vimrc);
+ semsg(_("E282: Cannot read from \"%s\""), parmp->use_vimrc);
}
}
} else if (!silent_mode) {
diff --git a/src/nvim/mark.c b/src/nvim/mark.c
index ea9acdf31a..e351697643 100644
--- a/src/nvim/mark.c
+++ b/src/nvim/mark.c
@@ -564,19 +564,19 @@ static void fmarks_check_one(xfmark_T *fm, char_u *name, buf_T *buf)
int check_mark(pos_T *pos)
{
if (pos == NULL) {
- EMSG(_(e_umark));
+ emsg(_(e_umark));
return FAIL;
}
if (pos->lnum <= 0) {
// lnum is negative if mark is in another file can can't get that
// file, error message already give then.
if (pos->lnum == 0) {
- EMSG(_(e_marknotset));
+ emsg(_(e_marknotset));
}
return FAIL;
}
if (pos->lnum > curbuf->b_ml.ml_line_count) {
- EMSG(_(e_markinval));
+ emsg(_(e_markinval));
return FAIL;
}
return OK;
@@ -713,7 +713,7 @@ static void show_one_mark(int c, char_u *arg, pos_T *p, char_u *name_arg, int cu
if (arg == NULL) {
MSG(_("No marks set"));
} else {
- EMSG2(_("E283: No marks matching \"%s\""), arg);
+ semsg(_("E283: No marks matching \"%s\""), arg);
}
}
} else if (!got_int
@@ -762,9 +762,9 @@ void ex_delmarks(exarg_T *eap)
// clear all marks
clrallmarks(curbuf);
} else if (eap->forceit) {
- EMSG(_(e_invarg));
+ emsg(_(e_invarg));
} else if (*eap->arg == NUL) {
- EMSG(_(e_argreq));
+ emsg(_(e_argreq));
} else {
// clear specified marks only
for (p = eap->arg; *p != NUL; ++p) {
@@ -779,7 +779,7 @@ void ex_delmarks(exarg_T *eap)
: (digit ? ascii_isdigit(p[2])
: ASCII_ISUPPER(p[2])))
|| to < from) {
- EMSG2(_(e_invarg2), p);
+ semsg(_(e_invarg2), p);
return;
}
p += 2;
@@ -821,7 +821,7 @@ void ex_delmarks(exarg_T *eap)
case ' ':
break;
default:
- EMSG2(_(e_invarg2), p);
+ semsg(_(e_invarg2), p);
return;
}
}
diff --git a/src/nvim/memfile.c b/src/nvim/memfile.c
index 438340e0c4..2a0ea9a269 100644
--- a/src/nvim/memfile.c
+++ b/src/nvim/memfile.c
@@ -168,7 +168,7 @@ void mf_close(memfile_T *mfp, bool del_file)
return;
}
if (mfp->mf_fd >= 0 && close(mfp->mf_fd) < 0) {
- EMSG(_(e_swapclose));
+ emsg(_(e_swapclose));
}
if (del_file && mfp->mf_fname != NULL) {
os_remove((char *)mfp->mf_fname);
@@ -206,7 +206,7 @@ void mf_close_file(buf_T *buf, bool getlines)
}
if (close(mfp->mf_fd) < 0) { // close the file
- EMSG(_(e_swapclose));
+ emsg(_(e_swapclose));
}
mfp->mf_fd = -1;
@@ -325,7 +325,7 @@ void mf_put(memfile_T *mfp, bhdr_T *hp, bool dirty, bool infile)
unsigned flags = hp->bh_flags;
if ((flags & BH_LOCKED) == 0) {
- IEMSG(_("E293: block was not locked"));
+ iemsg(_("E293: block was not locked"));
}
flags &= ~BH_LOCKED;
if (dirty) {
@@ -648,7 +648,7 @@ static int mf_write(memfile_T *mfp, bhdr_T *hp)
/// write or when hitting a key. We keep on trying, in case some
/// space becomes available.
if (!did_swapwrite_msg) {
- EMSG(_("E297: Write error in swap file"));
+ emsg(_("E297: Write error in swap file"));
}
did_swapwrite_msg = true;
return FAIL;
@@ -792,7 +792,7 @@ static bool mf_do_open(memfile_T *mfp, char_u *fname, int flags)
if ((flags & O_CREAT)
&& os_fileinfo_link((char *)mfp->mf_fname, &file_info)) {
mfp->mf_fd = -1;
- EMSG(_("E300: Swap file already exists (symlink attack?)"));
+ emsg(_("E300: Swap file already exists (symlink attack?)"));
} else {
// try to open the file
mfp->mf_fd = mch_open_rw((char *)mfp->mf_fname, flags | O_NOFOLLOW);
diff --git a/src/nvim/memline.c b/src/nvim/memline.c
index 0d3164f578..b8f0cde70e 100644
--- a/src/nvim/memline.c
+++ b/src/nvim/memline.c
@@ -2,7 +2,7 @@
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
// for debugging
-// #define CHECK(c, s) do { if (c) EMSG(s); } while (0)
+// #define CHECK(c, s) do { if (c) emsg(s); } while (0)
#define CHECK(c, s) do { } while (0)
/*
@@ -296,7 +296,7 @@ int ml_open(buf_T *buf)
*/
hp = mf_new(mfp, false, 1);
if (hp->bh_bnum != 0) {
- IEMSG(_("E298: Didn't get block nr 0?"));
+ iemsg(_("E298: Didn't get block nr 0?"));
goto error;
}
b0p = hp->bh_data;
@@ -340,7 +340,7 @@ int ml_open(buf_T *buf)
goto error;
}
if (hp->bh_bnum != 1) {
- IEMSG(_("E298: Didn't get block nr 1?"));
+ iemsg(_("E298: Didn't get block nr 1?"));
goto error;
}
pp = hp->bh_data;
@@ -356,7 +356,7 @@ int ml_open(buf_T *buf)
*/
hp = ml_new_data(mfp, false, 1);
if (hp->bh_bnum != 2) {
- IEMSG(_("E298: Didn't get block nr 2?"));
+ iemsg(_("E298: Didn't get block nr 2?"));
goto error;
}
@@ -448,13 +448,13 @@ void ml_setname(buf_T *buf)
mfp->mf_fd = os_open((char *)mfp->mf_fname, O_RDWR, 0);
if (mfp->mf_fd < 0) {
// could not (re)open the swap file, what can we do????
- EMSG(_("E301: Oops, lost the swap file!!!"));
+ emsg(_("E301: Oops, lost the swap file!!!"));
return;
}
(void)os_set_cloexec(mfp->mf_fd);
}
if (!success) {
- EMSG(_("E302: Could not rename swap file"));
+ emsg(_("E302: Could not rename swap file"));
}
}
@@ -538,7 +538,7 @@ void ml_open_file(buf_T *buf)
if (*p_dir != NUL && mfp->mf_fname == NULL) {
need_wait_return = true; // call wait_return later
no_wait_return++;
- (void)EMSG2(_("E303: Unable to open swap file for \"%s\", recovery impossible"),
+ (void)semsg(_("E303: Unable to open swap file for \"%s\", recovery impossible"),
buf_spname(buf) != NULL ? buf_spname(buf) : buf->b_fname);
--no_wait_return;
}
@@ -654,7 +654,7 @@ static void ml_upd_block0(buf_T *buf, upd_block0_T what)
}
b0p = hp->bh_data;
if (ml_check_b0_id(b0p) == FAIL) {
- IEMSG(_("E304: ml_upd_block0(): Didn't get block 0??"));
+ iemsg(_("E304: ml_upd_block0(): Didn't get block 0??"));
} else {
if (what == UB_FNAME) {
set_b0_fname(b0p, buf);
@@ -814,7 +814,7 @@ void ml_recover(bool checkext)
// count the number of matching swap files
len = recover_names(fname, FALSE, 0, NULL);
if (len == 0) { // no swap files found
- EMSG2(_("E305: No swap file found for %s"), fname);
+ semsg(_("E305: No swap file found for %s"), fname);
goto theend;
}
if (len == 1) { // one swap file found, use it
@@ -865,7 +865,7 @@ void ml_recover(bool checkext)
mfp = mf_open(fname_used, O_RDONLY);
fname_used = p;
if (mfp == NULL || mfp->mf_fd < 0) {
- EMSG2(_("E306: Cannot open %s"), fname_used);
+ semsg(_("E306: Cannot open %s"), fname_used);
goto theend;
}
buf->b_ml.ml_mfp = mfp;
@@ -901,7 +901,7 @@ void ml_recover(bool checkext)
goto theend;
}
if (ml_check_b0_id(b0p) == FAIL) {
- EMSG2(_("E307: %s does not look like a Vim swap file"), mfp->mf_fname);
+ semsg(_("E307: %s does not look like a Vim swap file"), mfp->mf_fname);
goto theend;
}
if (b0_magic_wrong(b0p)) {
@@ -982,7 +982,7 @@ void ml_recover(bool checkext)
&& org_file_info.stat.st_mtim.tv_sec
> swp_file_info.stat.st_mtim.tv_sec)
|| org_file_info.stat.st_mtim.tv_sec != mtime)) {
- EMSG(_("E308: Warning: Original file may have been changed"));
+ emsg(_("E308: Warning: Original file may have been changed"));
}
ui_flush();
@@ -1052,7 +1052,7 @@ void ml_recover(bool checkext)
*/
if ((hp = mf_get(mfp, bnum, page_count)) == NULL) {
if (bnum == 1) {
- EMSG2(_("E309: Unable to read block 1 from %s"), mfp->mf_fname);
+ semsg(_("E309: Unable to read block 1 from %s"), mfp->mf_fname);
goto theend;
}
++error;
@@ -1121,7 +1121,7 @@ void ml_recover(bool checkext)
dp = hp->bh_data;
if (dp->db_id != DATA_ID) { // block id wrong
if (bnum == 1) {
- EMSG2(_("E310: Block 1 ID wrong (%s not a .swp file?)"),
+ semsg(_("E310: Block 1 ID wrong (%s not a .swp file?)"),
mfp->mf_fname);
goto theend;
}
@@ -1232,11 +1232,11 @@ void ml_recover(bool checkext)
recoverymode = FALSE;
if (got_int) {
- EMSG(_("E311: Recovery Interrupted"));
+ emsg(_("E311: Recovery Interrupted"));
} else if (error) {
++no_wait_return;
MSG(">>>>>>>>>>>>>");
- EMSG(_( "E312: Errors detected while recovering; look for lines starting with ???"));
+ emsg(_( "E312: Errors detected while recovering; look for lines starting with ???"));
--no_wait_return;
MSG(_("See \":help E312\" for more information."));
MSG(">>>>>>>>>>>>>");
@@ -1756,7 +1756,7 @@ void ml_preserve(buf_T *buf, int message, bool do_fsync)
if (mfp == NULL || mfp->mf_fname == NULL) {
if (message) {
- EMSG(_("E313: Cannot preserve, there is no swap file"));
+ emsg(_("E313: Cannot preserve, there is no swap file"));
}
return;
}
@@ -1809,7 +1809,7 @@ theend:
if (status == OK) {
MSG(_("File preserved"));
} else {
- EMSG(_("E314: Preserve failed"));
+ emsg(_("E314: Preserve failed"));
}
}
}
@@ -1857,7 +1857,7 @@ char_u *ml_get_buf(buf_T *buf, linenr_T lnum, bool will_change)
// Avoid giving this message for a recursive call, may happen when
// the GUI redraws part of the text.
recursive++;
- IEMSGN(_("E315: ml_get: invalid lnum: %" PRId64), lnum);
+ siemsg(_("E315: ml_get: invalid lnum: %" PRId64), (int64_t)lnum);
recursive--;
}
errorret:
@@ -1893,8 +1893,8 @@ errorret:
recursive++;
get_trans_bufname(buf);
shorten_dir(NameBuff);
- iemsgf(_("E316: ml_get: cannot find line %" PRId64 " in buffer %d %s"),
- lnum, buf->b_fnum, NameBuff);
+ siemsg(_("E316: ml_get: cannot find line %" PRId64 " in buffer %d %s"),
+ (int64_t)lnum, buf->b_fnum, NameBuff);
recursive--;
}
goto errorret;
@@ -2295,7 +2295,7 @@ static int ml_append_int(buf_T *buf, linenr_T lnum, char_u *line, colnr_T len, b
}
pp = hp->bh_data; // must be pointer block
if (pp->pb_id != PTR_ID) {
- IEMSG(_("E317: pointer block id wrong 3"));
+ iemsg(_("E317: pointer block id wrong 3"));
mf_put(mfp, hp, false, false);
return FAIL;
}
@@ -2437,7 +2437,7 @@ static int ml_append_int(buf_T *buf, linenr_T lnum, char_u *line, colnr_T len, b
* Safety check: fallen out of for loop?
*/
if (stack_idx < 0) {
- IEMSG(_("E318: Updated too many blocks?"));
+ iemsg(_("E318: Updated too many blocks?"));
buf->b_ml.ml_stack_top = 0; // invalidate stack
}
}
@@ -2629,7 +2629,7 @@ static int ml_delete_int(buf_T *buf, linenr_T lnum, bool message)
}
pp = hp->bh_data; // must be pointer block
if (pp->pb_id != PTR_ID) {
- IEMSG(_("E317: pointer block id wrong 4"));
+ iemsg(_("E317: pointer block id wrong 4"));
mf_put(mfp, hp, false, false);
return FAIL;
}
@@ -2845,7 +2845,7 @@ static void ml_flush_line(buf_T *buf)
hp = ml_find_line(buf, lnum, ML_FIND);
if (hp == NULL) {
- IEMSGN(_("E320: Cannot find line %" PRId64), lnum);
+ siemsg(_("E320: Cannot find line %" PRId64), (int64_t)lnum);
} else {
dp = hp->bh_data;
idx = lnum - buf->b_ml.ml_locked_low;
@@ -3060,7 +3060,7 @@ static bhdr_T *ml_find_line(buf_T *buf, linenr_T lnum, int action)
pp = (PTR_BL *)(dp); // must be pointer block
if (pp->pb_id != PTR_ID) {
- IEMSG(_("E317: pointer block id wrong"));
+ iemsg(_("E317: pointer block id wrong"));
goto error_block;
}
@@ -3099,10 +3099,10 @@ static bhdr_T *ml_find_line(buf_T *buf, linenr_T lnum, int action)
}
if (idx >= (int)pp->pb_count) { // past the end: something wrong!
if (lnum > buf->b_ml.ml_line_count) {
- IEMSGN(_("E322: line number out of range: %" PRId64 " past the end"),
- lnum - buf->b_ml.ml_line_count);
+ siemsg(_("E322: line number out of range: %" PRId64 " past the end"),
+ (int64_t)lnum - buf->b_ml.ml_line_count);
} else {
- IEMSGN(_("E323: line count wrong in block %" PRId64), bnum);
+ siemsg(_("E323: line count wrong in block %" PRId64), bnum);
}
goto error_block;
}
@@ -3181,7 +3181,7 @@ static void ml_lineadd(buf_T *buf, int count)
pp = hp->bh_data; // must be pointer block
if (pp->pb_id != PTR_ID) {
mf_put(mfp, hp, false, false);
- IEMSG(_("E317: pointer block id wrong 2"));
+ iemsg(_("E317: pointer block id wrong 2"));
break;
}
pp->pb_pointer[ip->ip_index].pe_line_count += count;
@@ -3214,7 +3214,7 @@ int resolve_symlink(const char_u *fname, char_u *buf)
for (;; ) {
// Limit symlink depth to 100, catch recursive loops.
if (++depth == 100) {
- EMSG2(_("E773: Symlink loop for \"%s\""), fname);
+ semsg(_("E773: Symlink loop for \"%s\""), fname);
return FAIL;
}
@@ -3356,7 +3356,7 @@ static void attention_message(buf_T *buf, char_u *fname)
assert(buf->b_fname != NULL);
++no_wait_return;
- (void)EMSG(_("E325: ATTENTION"));
+ (void)emsg(_("E325: ATTENTION"));
MSG_PUTS(_("\nFound a swap file by the name \""));
msg_home_replace(fname);
MSG_PUTS("\"\n");
@@ -3665,7 +3665,7 @@ static char *findswapname(buf_T *buf, char **dirp, char *old_fname, bool *found_
*/
if (fname[n - 1] == 'a') { // ".s?a"
if (fname[n - 2] == 'a') { // ".saa": tried enough, give up
- EMSG(_("E326: Too many swap files found"));
+ emsg(_("E326: Too many swap files found"));
XFREE_CLEAR(fname);
break;
}
@@ -3681,7 +3681,7 @@ static char *findswapname(buf_T *buf, char **dirp, char *old_fname, bool *found_
int ret;
char *failed_dir;
if ((ret = os_mkdir_recurse(dir_name, 0755, &failed_dir)) != 0) {
- EMSG3(_("E303: Unable to create directory \"%s\" for swap file, "
+ semsg(_("E303: Unable to create directory \"%s\" for swap file, "
"recovery impossible: %s"),
failed_dir, os_strerror(ret));
xfree(failed_dir);
diff --git a/src/nvim/memory.c b/src/nvim/memory.c
index 5345580b93..547a9015b7 100644
--- a/src/nvim/memory.c
+++ b/src/nvim/memory.c
@@ -510,7 +510,7 @@ void do_outofmem_msg(size_t size)
* message fails, e.g. when setting v:errmsg. */
did_outofmem_msg = true;
- EMSGU(_("E342: Out of memory! (allocating %" PRIu64 " bytes)"), size);
+ semsg(_("E342: Out of memory! (allocating %" PRIu64 " bytes)"), (uint64_t)size);
}
}
diff --git a/src/nvim/menu.c b/src/nvim/menu.c
index 5ada5e092d..2ec68fe032 100644
--- a/src/nvim/menu.c
+++ b/src/nvim/menu.c
@@ -166,7 +166,7 @@ void ex_menu(exarg_T *eap)
menu_path = (char *)arg;
if (*menu_path == '.') {
- EMSG2(_(e_invarg2), menu_path);
+ semsg(_(e_invarg2), menu_path);
goto theend;
}
@@ -179,7 +179,7 @@ void ex_menu(exarg_T *eap)
show_menus((char_u *)menu_path, modes);
goto theend;
} else if (*map_to != NUL && (unmenu || enable != kNone)) {
- EMSG(_(e_trailing));
+ emsg(_(e_trailing));
goto theend;
}
@@ -316,7 +316,7 @@ static int add_menu_path(const char_u *const menu_path, vimmenu_T *menuarg,
dname = menu_text(name, NULL, NULL);
if (*dname == NUL) {
// Only a mnemonic or accelerator is not valid.
- EMSG(_("E792: Empty menu name"));
+ emsg(_("E792: Empty menu name"));
goto erret;
}
@@ -327,13 +327,13 @@ static int add_menu_path(const char_u *const menu_path, vimmenu_T *menuarg,
if (menu_name_equal(name, menu) || menu_name_equal(dname, menu)) {
if (*next_name == NUL && menu->children != NULL) {
if (!sys_menu) {
- EMSG(_("E330: Menu path must not lead to a sub-menu"));
+ emsg(_("E330: Menu path must not lead to a sub-menu"));
}
goto erret;
}
if (*next_name != NUL && menu->children == NULL) {
if (!sys_menu) {
- EMSG(_(e_notsubmenu));
+ emsg(_(e_notsubmenu));
}
goto erret;
}
@@ -353,12 +353,12 @@ static int add_menu_path(const char_u *const menu_path, vimmenu_T *menuarg,
if (menu == NULL) {
if (*next_name == NUL && parent == NULL) {
- EMSG(_("E331: Must not add menu items directly to menu bar"));
+ emsg(_("E331: Must not add menu items directly to menu bar"));
goto erret;
}
if (menu_is_separator(dname) && *next_name != NUL) {
- EMSG(_("E332: Separator cannot be part of a menu path"));
+ emsg(_("E332: Separator cannot be part of a menu path"));
goto erret;
}
@@ -517,7 +517,7 @@ static int menu_enable_recurse(vimmenu_T *menu, char_u *name, int modes, int ena
if (*name == NUL || *name == '*' || menu_name_equal(name, menu)) {
if (*p != NUL) {
if (menu->children == NULL) {
- EMSG(_(e_notsubmenu));
+ emsg(_(e_notsubmenu));
return FAIL;
}
if (menu_enable_recurse(menu->children, p, modes, enable) == FAIL) {
@@ -541,7 +541,7 @@ static int menu_enable_recurse(vimmenu_T *menu, char_u *name, int modes, int ena
menu = menu->next;
}
if (*name != NUL && *name != '*' && menu == NULL) {
- EMSG2(_(e_nomenu), name);
+ semsg(_(e_nomenu), name);
return FAIL;
}
@@ -570,7 +570,7 @@ static int remove_menu(vimmenu_T **menup, char_u *name, int modes, bool silent)
if (*name == NUL || menu_name_equal(name, menu)) {
if (*p != NUL && menu->children == NULL) {
if (!silent) {
- EMSG(_(e_notsubmenu));
+ emsg(_(e_notsubmenu));
}
return FAIL;
}
@@ -580,7 +580,7 @@ static int remove_menu(vimmenu_T **menup, char_u *name, int modes, bool silent)
}
} else if (*name != NUL) {
if (!silent) {
- EMSG(_(e_othermode));
+ emsg(_(e_othermode));
}
return FAIL;
}
@@ -612,7 +612,7 @@ static int remove_menu(vimmenu_T **menup, char_u *name, int modes, bool silent)
if (*name != NUL) {
if (menu == NULL) {
if (!silent) {
- EMSG2(_(e_nomenu), name);
+ semsg(_(e_nomenu), name);
}
return FAIL;
}
@@ -795,10 +795,10 @@ static vimmenu_T *find_menu(vimmenu_T *menu, char_u *name, int modes)
if (menu_name_equal(name, menu)) {
// Found menu
if (*p != NUL && menu->children == NULL) {
- EMSG(_(e_notsubmenu));
+ emsg(_(e_notsubmenu));
return NULL;
} else if ((menu->modes & modes) == 0x0) {
- EMSG(_(e_othermode));
+ emsg(_(e_othermode));
return NULL;
} else if (*p == NUL) { // found a full match
return menu;
@@ -809,7 +809,7 @@ static vimmenu_T *find_menu(vimmenu_T *menu, char_u *name, int modes)
}
if (menu == NULL) {
- EMSG2(_(e_nomenu), name);
+ semsg(_(e_nomenu), name);
return NULL;
}
// Found a match, search the sub-menu.
@@ -1464,7 +1464,7 @@ static void execute_menu(const exarg_T *eap, vimmenu_T *menu)
menu->silent[idx]);
}
} else if (eap != NULL) {
- EMSG2(_("E335: Menu not defined for %s mode"), mode);
+ semsg(_("E335: Menu not defined for %s mode"), mode);
}
}
@@ -1482,10 +1482,10 @@ void ex_emenu(exarg_T *eap)
while (menu != NULL) {
if (menu_name_equal(name, menu)) {
if (*p == NUL && menu->children != NULL) {
- EMSG(_("E333: Menu path must lead to a menu item"));
+ emsg(_("E333: Menu path must lead to a menu item"));
menu = NULL;
} else if (*p != NUL && menu->children == NULL) {
- EMSG(_(e_notsubmenu));
+ emsg(_(e_notsubmenu));
menu = NULL;
}
break;
@@ -1500,7 +1500,7 @@ void ex_emenu(exarg_T *eap)
}
xfree(saved_name);
if (menu == NULL) {
- EMSG2(_("E334: Menu not found: %s"), eap->arg);
+ semsg(_("E334: Menu not found: %s"), eap->arg);
return;
}
@@ -1556,7 +1556,7 @@ void ex_menutranslate(exarg_T *eap)
*arg = NUL;
arg = menu_skip_part(to);
if (arg == to) {
- EMSG(_(e_invarg));
+ emsg(_(e_invarg));
} else {
from = vim_strsave(from);
from_noamp = menu_text(from, NULL, NULL);
diff --git a/src/nvim/message.c b/src/nvim/message.c
index 85ae6d9ce7..adadfde1b6 100644
--- a/src/nvim/message.c
+++ b/src/nvim/message.c
@@ -453,11 +453,11 @@ void trunc_string(char_u *s, char_u *buf, int room_in, int buflen)
}
/*
- * Note: Caller of smgs() and smsg_attr() must check the resulting string is
+ * Note: Caller of smsg() and smsg_attr() must check the resulting string is
* shorter than IOSIZE!!!
*/
-int smsg(char *s, ...)
+int smsg(const char *s, ...)
FUNC_ATTR_PRINTF(1, 2)
{
va_list arglist;
@@ -468,7 +468,7 @@ int smsg(char *s, ...)
return msg(IObuff);
}
-int smsg_attr(int attr, char *s, ...)
+int smsg_attr(int attr, const char *s, ...)
FUNC_ATTR_PRINTF(2, 3)
{
va_list arglist;
@@ -479,7 +479,7 @@ int smsg_attr(int attr, char *s, ...)
return msg_attr((const char *)IObuff, attr);
}
-int smsg_attr_keep(int attr, char *s, ...)
+int smsg_attr_keep(int attr, const char *s, ...)
FUNC_ATTR_PRINTF(2, 3)
{
va_list arglist;
@@ -730,25 +730,25 @@ static bool emsg_multiline(const char *s, bool multiline)
/// When terminal not initialized (yet) mch_errmsg(..) is used.
///
/// @return true if wait_return not called
-bool emsg(const char_u *s)
+bool emsg(const char *s)
{
return emsg_multiline((const char *)s, false);
}
void emsg_invreg(int name)
{
- EMSG2(_("E354: Invalid register name: '%s'"), transchar(name));
+ semsg(_("E354: Invalid register name: '%s'"), transchar(name));
}
/// Print an error message with unknown number of arguments
-bool emsgf(const char *const fmt, ...)
+bool semsg(const char *const fmt, ...)
FUNC_ATTR_PRINTF(1, 2)
{
bool ret;
va_list ap;
va_start(ap, fmt);
- ret = emsgfv(fmt, ap);
+ ret = semsgv(fmt, ap);
va_end(ap);
return ret;
@@ -756,7 +756,7 @@ bool emsgf(const char *const fmt, ...)
#define MULTILINE_BUFSIZE 8192
-bool emsgf_multiline(const char *const fmt, ...)
+bool semsg_multiline(const char *const fmt, ...)
{
bool ret;
va_list ap;
@@ -777,7 +777,7 @@ bool emsgf_multiline(const char *const fmt, ...)
}
/// Print an error message with unknown number of arguments
-static bool emsgfv(const char *fmt, va_list ap)
+static bool semsgv(const char *fmt, va_list ap)
{
static char errbuf[IOSIZE];
if (emsg_not_now()) {
@@ -786,7 +786,7 @@ static bool emsgfv(const char *fmt, va_list ap)
vim_vsnprintf(errbuf, sizeof(errbuf), fmt, ap);
- return emsg((const char_u *)errbuf);
+ return emsg(errbuf);
}
/// Same as emsg(...), but abort on error when ABORT_ON_INTERNAL_ERROR is
@@ -794,20 +794,20 @@ static bool emsgfv(const char *fmt, va_list ap)
/// detected when fuzzing vim.
void iemsg(const char *s)
{
- emsg((char_u *)s);
+ emsg(s);
#ifdef ABORT_ON_INTERNAL_ERROR
abort();
#endif
}
-/// Same as emsgf(...) but abort on error when ABORT_ON_INTERNAL_ERROR is
+/// Same as semsg(...) but abort on error when ABORT_ON_INTERNAL_ERROR is
/// defined. It is used for internal errors only, so that they can be
/// detected when fuzzing vim.
-void iemsgf(const char *s, ...)
+void siemsg(const char *s, ...)
{
va_list ap;
va_start(ap, s);
- (void)emsgfv(s, ap);
+ (void)semsgv(s, ap);
va_end(ap);
#ifdef ABORT_ON_INTERNAL_ERROR
abort();
@@ -817,17 +817,17 @@ void iemsgf(const char *s, ...)
/// Give an "Internal error" message.
void internal_error(char *where)
{
- IEMSG2(_(e_intern2), where);
+ siemsg(_(e_intern2), where);
}
-static void msg_emsgf_event(void **argv)
+static void msg_semsg_event(void **argv)
{
char *s = argv[0];
- (void)emsg((char_u *)s);
+ (void)emsg(s);
xfree(s);
}
-void msg_schedule_emsgf(const char *const fmt, ...)
+void msg_schedule_semsg(const char *const fmt, ...)
FUNC_ATTR_PRINTF(1, 2)
{
va_list ap;
@@ -836,7 +836,7 @@ void msg_schedule_emsgf(const char *const fmt, ...)
va_end(ap);
char *s = xstrdup((char *)IObuff);
- multiqueue_put(main_loop.events, msg_emsgf_event, 1, s);
+ multiqueue_put(main_loop.events, msg_semsg_event, 1, s);
}
/*
@@ -1009,7 +1009,7 @@ void ex_messages(void *const eap_p)
}
if (*eap->arg != NUL) {
- EMSG(_(e_invarg));
+ emsg(_(e_invarg));
return;
}
@@ -3308,7 +3308,7 @@ int verbose_open(void)
verbose_fd = os_fopen((char *)p_vfile, "a");
if (verbose_fd == NULL) {
- EMSG2(_(e_notopen), p_vfile);
+ semsg(_(e_notopen), p_vfile);
return FAIL;
}
}
diff --git a/src/nvim/message.h b/src/nvim/message.h
index 6d4d030500..e22c2e1e3f 100644
--- a/src/nvim/message.h
+++ b/src/nvim/message.h
@@ -38,30 +38,6 @@
/// Display error message
///
-/// Sets error flag in process, can be transformed into an exception.
-#define EMSG(s) emsg((char_u *)(s))
-
-/// Like #EMSG, but for messages with one "%s" inside
-#define EMSG2(s, p) emsgf((const char *)(s), (p))
-
-/// Like #EMSG, but for messages with two "%s" inside
-#define EMSG3(s, p, q) emsgf((const char *)(s), (p), (q))
-
-/// Like #EMSG, but for messages with one "%" PRId64 inside
-#define EMSGN(s, n) emsgf((const char *)(s), (int64_t)(n))
-
-/// Like #EMSG, but for messages with one "%" PRIu64 inside
-#define EMSGU(s, n) emsgf((const char *)(s), (uint64_t)(n))
-
-/// Like #EMSG, but for internal messages
-#define IEMSG(s) iemsg((const char *)(s))
-
-/// Like #EMSG2, but for internal messages
-#define IEMSG2(s, p) iemsgf((const char *)(s), (p))
-
-/// Like #EMSGN, but for internal messages
-#define IEMSGN(s, n) iemsgf((const char *)(s), (int64_t)(n))
-
/// Display message at the recorded position
#define MSG_PUTS(s) msg_puts((const char *)(s))
diff --git a/src/nvim/misc1.c b/src/nvim/misc1.c
index 561bcd4929..a412078721 100644
--- a/src/nvim/misc1.c
+++ b/src/nvim/misc1.c
@@ -920,7 +920,7 @@ int call_shell(char_u *cmd, ShellOpts opts, char_u *extra_shell_arg)
}
if (*p_sh == NUL) {
- EMSG(_(e_shellempty));
+ emsg(_(e_shellempty));
retval = -1;
} else {
// The external command may update a tags file, clear cached tags.
@@ -958,7 +958,7 @@ char_u *get_cmd_output(char_u *cmd, char_u *infile, ShellOpts flags, size_t *ret
// get a name for the temp file
char_u *tempname = vim_tempname();
if (tempname == NULL) {
- EMSG(_(e_notmp));
+ emsg(_(e_notmp));
return NULL;
}
@@ -979,7 +979,7 @@ char_u *get_cmd_output(char_u *cmd, char_u *infile, ShellOpts flags, size_t *ret
FILE *fd = os_fopen((char *)tempname, READBIN);
if (fd == NULL) {
- EMSG2(_(e_notopen), tempname);
+ semsg(_(e_notopen), tempname);
goto done;
}
@@ -992,7 +992,7 @@ char_u *get_cmd_output(char_u *cmd, char_u *infile, ShellOpts flags, size_t *ret
fclose(fd);
os_remove((char *)tempname);
if (i != len) {
- EMSG2(_(e_notread), tempname);
+ semsg(_(e_notread), tempname);
XFREE_CLEAR(buffer);
} else if (ret_len == NULL) {
// Change NUL into SOH, otherwise the string is truncated.
diff --git a/src/nvim/normal.c b/src/nvim/normal.c
index dec0109879..daff0697a6 100644
--- a/src/nvim/normal.c
+++ b/src/nvim/normal.c
@@ -2170,7 +2170,7 @@ static void op_function(const oparg_T *oap)
const bool save_finish_op = finish_op;
if (*p_opfunc == NUL) {
- EMSG(_("E774: 'operatorfunc' is empty"));
+ emsg(_("E774: 'operatorfunc' is empty"));
} else {
// Set '[ and '] marks to text to be operated on.
curbuf->b_op_start = oap->start;
@@ -3225,9 +3225,9 @@ size_t find_ident_at_pos(win_T *wp, linenr_T lnum, colnr_T startcol, char_u **te
if (ptr[col] == NUL || (i == 0 && this_class != 2)) {
// Didn't find an identifier or text.
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;
}
@@ -4546,7 +4546,7 @@ dozet:
} else if (foldmethodIsMarker(curwin)) {
deleteFold(curwin, (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;
@@ -5010,7 +5010,7 @@ static void nv_ident(cmdarg_T *cap)
bool kp_ex = (*kp == ':'); // 'keywordprg' is an ex command
bool kp_help = (STRCMP(kp, ":he") == 0 || 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;
}
size_t buf_size = n * 2 + 30 + STRLEN(kp);
@@ -5052,7 +5052,7 @@ static void nv_ident(cmdarg_T *cap)
--n;
}
if (n == 0) {
- EMSG(_(e_noident)); // found dashes only
+ emsg(_(e_noident)); // found dashes only
xfree(buf);
return;
}
@@ -6348,7 +6348,7 @@ static void nv_Replace(cmdarg_T *cap)
nv_operator(cap);
} else if (!checkclearopq(cap->oap)) {
if (!MODIFIABLE(curbuf)) {
- EMSG(_(e_modifiable));
+ emsg(_(e_modifiable));
} else {
if (virtual_active()) {
coladvance(getviscol());
@@ -6369,7 +6369,7 @@ static void nv_vreplace(cmdarg_T *cap)
nv_replace(cap); // Do same as "r" in Visual mode for now
} else if (!checkclearopq(cap->oap)) {
if (!MODIFIABLE(curbuf)) {
- EMSG(_(e_modifiable));
+ emsg(_(e_modifiable));
} else {
if (cap->extra_char == Ctrl_V) { // get another character
cap->extra_char = get_literal();
@@ -6614,11 +6614,11 @@ static void nv_pcmark(cmdarg_T *cap)
nv_cursormark(cap, false, pos);
} 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);
@@ -7925,7 +7925,7 @@ static void nv_edit(cmdarg_T *cap)
nv_object(cap);
} else if (!curbuf->b_p_ma && !p_im && !curbuf->terminal) {
// Only give this error when 'insertmode' is off.
- EMSG(_(e_modifiable));
+ emsg(_(e_modifiable));
clearop(cap->oap);
} else if (!checkclearopq(cap->oap)) {
switch (cap->cmdchar) {
diff --git a/src/nvim/ops.c b/src/nvim/ops.c
index d995a2b75b..1805d62e9c 100644
--- a/src/nvim/ops.c
+++ b/src/nvim/ops.c
@@ -633,7 +633,7 @@ void op_reindent(oparg_T *oap, Indenter how)
// Don't even try when 'modifiable' is off.
if (!MODIFIABLE(curbuf)) {
- EMSG(_(e_modifiable));
+ emsg(_(e_modifiable));
return;
}
@@ -1009,7 +1009,7 @@ int do_execreg(int regname, int colon, int addcr, int silent)
if (regname == '@') { // repeat previous one
if (execreg_lastc == NUL) {
- EMSG(_("E748: No previously used register"));
+ emsg(_("E748: No previously used register"));
return FAIL;
}
regname = execreg_lastc;
@@ -1027,7 +1027,7 @@ int do_execreg(int regname, int colon, int addcr, int silent)
if (regname == ':') { // use last command line
if (last_cmdline == NULL) {
- EMSG(_(e_nolastcmd));
+ emsg(_(e_nolastcmd));
return FAIL;
}
// don't keep the cmdline containing @:
@@ -1057,7 +1057,7 @@ int do_execreg(int regname, int colon, int addcr, int silent)
} else if (regname == '.') { // use last inserted text
p = get_last_insert_save();
if (p == NULL) {
- EMSG(_(e_noinstext));
+ emsg(_(e_noinstext));
return FAIL;
}
retval = put_in_typebuf(p, false, colon, silent);
@@ -1282,14 +1282,14 @@ bool get_spec_reg(int regname, char_u **argp, bool *allocated, bool errmsg)
case ':': // last command line
if (last_cmdline == NULL && errmsg) {
- EMSG(_(e_nolastcmd));
+ emsg(_(e_nolastcmd));
}
*argp = last_cmdline;
return true;
case '/': // last search-pattern
if (last_search_pat() == NULL && errmsg) {
- EMSG(_(e_noprevre));
+ emsg(_(e_noprevre));
}
*argp = last_search_pat();
return true;
@@ -1298,7 +1298,7 @@ bool get_spec_reg(int regname, char_u **argp, bool *allocated, bool errmsg)
*argp = get_last_insert_save();
*allocated = true;
if (*argp == NULL && errmsg) {
- EMSG(_(e_noinstext));
+ emsg(_(e_noinstext));
}
return true;
@@ -1415,7 +1415,7 @@ int op_delete(oparg_T *oap)
}
if (!MODIFIABLE(curbuf)) {
- EMSG(_(e_modifiable));
+ emsg(_(e_modifiable));
return FAIL;
}
@@ -3075,7 +3075,7 @@ void do_put(int regname, yankreg_T *reg, int dir, long count, int flags)
}
if (y_size == 0 || y_array == NULL) {
- EMSG2(_("E353: Nothing in register %s"),
+ semsg(_("E353: Nothing in register %s"),
regname == 0 ? (char_u *)"\"" : transchar(regname));
goto end;
}
@@ -5383,7 +5383,7 @@ void write_reg_contents_lst(int name, char_u **strings, bool must_append, Motion
if (strings[0] == NULL) {
s = (char_u *)"";
} else if (strings[1] != NULL) {
- EMSG(_("E883: search pattern and expression register may not "
+ emsg(_("E883: search pattern and expression register may not "
"contain two or more lines"));
return;
}
@@ -5445,7 +5445,7 @@ void write_reg_contents_ex(int name, const char_u *str, ssize_t len, bool must_a
buf = buflist_findnr(num);
if (buf == NULL) {
- EMSGN(_(e_nobufnr), (long)num);
+ semsg(_(e_nobufnr), (int64_t)num);
}
} else {
buf = buflist_findnr(buflist_findpat(str, str + STRLEN(str),
@@ -6185,7 +6185,7 @@ err:
reg->additional_data = NULL;
reg->timestamp = 0;
if (errmsg) {
- EMSG("clipboard: provider returned invalid data");
+ emsg("clipboard: provider returned invalid data");
}
*target = reg;
return false;
diff --git a/src/nvim/option.c b/src/nvim/option.c
index 8badf80924..4e99e781f8 100644
--- a/src/nvim/option.c
+++ b/src/nvim/option.c
@@ -949,8 +949,8 @@ void set_title_defaults(void)
int do_set(char_u *arg, int opt_flags)
{
int opt_idx;
- char_u *errmsg;
- char_u errbuf[80];
+ char *errmsg;
+ char errbuf[80];
char_u *startarg;
int prefix; // 1: nothing, 0: "no", 2: "inv" in front of name
char_u nextchar; // next non-white char after option name
@@ -1071,7 +1071,7 @@ int do_set(char_u *arg, int opt_flags)
nextchar = arg[len];
if (opt_idx == -1 && key == 0) { // found a mismatch: skip
- errmsg = (char_u *)N_("E518: Unknown option");
+ errmsg = N_("E518: Unknown option");
goto skip;
}
@@ -1082,7 +1082,7 @@ int do_set(char_u *arg, int opt_flags)
if (vim_strchr((char_u *)"=:!&<", nextchar) == NULL
&& (!(options[opt_idx].flags & P_BOOL)
|| nextchar == '?')) {
- errmsg = (char_u *)_(e_unsupportedoption);
+ errmsg = _(e_unsupportedoption);
}
goto skip;
}
@@ -1109,11 +1109,11 @@ int do_set(char_u *arg, int opt_flags)
// Disallow changing some options from modelines.
if (opt_flags & OPT_MODELINE) {
if (flags & (P_SECURE | P_NO_ML)) {
- errmsg = (char_u *)N_("E520: Not allowed in a modeline");
+ errmsg = N_("E520: Not allowed in a modeline");
goto skip;
}
if ((flags & P_MLE) && !p_mle) {
- errmsg = (char_u *)N_("E992: Not allowed in a modeline when 'modelineexpr' is off");
+ errmsg = N_("E992: Not allowed in a modeline when 'modelineexpr' is off");
goto skip;
}
// In diff mode some options are overruled. This avoids that
@@ -1181,7 +1181,7 @@ int do_set(char_u *arg, int opt_flags)
}
}
} else {
- errmsg = (char_u *)N_("E846: Key code not set");
+ errmsg = N_("E846: Key code not set");
goto skip;
}
if (nextchar != '?'
@@ -1232,7 +1232,7 @@ int do_set(char_u *arg, int opt_flags)
}
}
- errmsg = (char_u *)set_bool_option(opt_idx, varp, (int)value,
+ errmsg = set_bool_option(opt_idx, varp, (int)value,
opt_flags);
} else { // Numeric or string.
if (vim_strchr((const char_u *)"=:&<", nextchar) == NULL
@@ -1275,11 +1275,11 @@ int do_set(char_u *arg, int opt_flags)
// Allow negative, octal and hex numbers.
vim_str2nr(arg, NULL, &i, STR2NR_ALL, &value, NULL, 0, true);
if (i == 0 || (arg[i] != NUL && !ascii_iswhite(arg[i]))) {
- errmsg = (char_u *)N_("E521: Number required after =");
+ errmsg = N_("E521: Number required after =");
goto skip;
}
} else {
- errmsg = (char_u *)N_("E521: Number required after =");
+ errmsg = N_("E521: Number required after =");
goto skip;
}
@@ -1292,9 +1292,9 @@ int do_set(char_u *arg, int opt_flags)
if (removing) {
value = *(long *)varp - value;
}
- errmsg = (char_u *)set_num_option(opt_idx, varp, (long)value,
- errbuf, sizeof(errbuf),
- opt_flags);
+ errmsg = set_num_option(opt_idx, varp, (long)value,
+ errbuf, sizeof(errbuf),
+ opt_flags);
} else if (opt_idx >= 0) { // String.
char_u *save_arg = NULL;
char_u *s = NULL;
@@ -1361,7 +1361,7 @@ int do_set(char_u *arg, int opt_flags)
&& (*arg == NUL || *arg == ' ')) {
STRCPY(errbuf, ":help");
save_arg = arg;
- arg = errbuf;
+ arg = (char_u *)errbuf;
}
/*
* Convert 'backspace' number to string, for
@@ -1415,7 +1415,7 @@ int do_set(char_u *arg, int opt_flags)
STRLCAT(errbuf, "[,],", sizeof(errbuf));
}
save_arg = arg;
- arg = errbuf;
+ arg = (char_u *)errbuf;
}
/*
* Remove '>' before 'dir' and 'bdir', for
@@ -1690,7 +1690,7 @@ skip:
trans_characters(IObuff, IOSIZE);
no_wait_return++; // wait_return done later
- emsg(IObuff); // show error highlighted
+ emsg((char *)IObuff); // show error highlighted
no_wait_return--;
return FAIL;
@@ -1736,10 +1736,10 @@ static void did_set_option(int opt_idx, int opt_flags, int new_value, int value_
}
}
-static char_u *illegal_char(char_u *errbuf, size_t errbuflen, int c)
+static char *illegal_char(char *errbuf, size_t errbuflen, int c)
{
if (errbuf == NULL) {
- return (char_u *)"";
+ return "";
}
vim_snprintf((char *)errbuf, errbuflen, _("E539: Illegal character <%s>"),
(char *)transchar(c));
@@ -1761,7 +1761,7 @@ static int string_to_key(char_u *arg)
/// Check value of 'cedit' and set cedit_key.
/// Returns NULL if value is OK, error message otherwise.
-static char_u *check_cedit(void)
+static char *check_cedit(void)
{
int n;
@@ -2141,7 +2141,7 @@ void set_string_option_direct(const char *name, int opt_idx, const char_u *val,
idx = findoption(name);
if (idx < 0) { // Not found (should not happen).
internal_error("set_string_option_direct()");
- IEMSG2(_("For option %s"), name);
+ siemsg(_("For option %s"), name);
return;
}
}
@@ -2238,9 +2238,9 @@ static char *set_string_option(const int opt_idx, const char *const value, const
char *const saved_newval = xstrdup(s);
int value_checked = false;
- char *const r = (char *)did_set_string_option(opt_idx, (char_u **)varp, (int)true,
- (char_u *)oldval,
- NULL, 0, opt_flags, &value_checked);
+ char *const r = did_set_string_option(opt_idx, (char_u **)varp, (int)true,
+ (char_u *)oldval,
+ NULL, 0, opt_flags, &value_checked);
if (r == NULL) {
did_set_option(opt_idx, opt_flags, true, value_checked);
}
@@ -2313,11 +2313,11 @@ static bool valid_spellfile(const char_u *val)
/// @param errbuflen length of errors buffer
/// @param opt_flags OPT_LOCAL and/or OPT_GLOBAL
/// @param value_checked value was checked to be safe, no need to set P_INSECURE
-static char_u *did_set_string_option(int opt_idx, char_u **varp, bool new_value_alloced,
- char_u *oldval, char_u *errbuf, size_t errbuflen,
- int opt_flags, int *value_checked)
+static char *did_set_string_option(int opt_idx, char_u **varp, bool new_value_alloced,
+ char_u *oldval, char *errbuf, size_t errbuflen,
+ int opt_flags, int *value_checked)
{
- char_u *errmsg = NULL;
+ char *errmsg = NULL;
char_u *s, *p;
int did_chartab = false;
char_u **gvarp;
@@ -2369,7 +2369,7 @@ static char_u *did_set_string_option(int opt_idx, char_u **varp, bool new_value_
} else if (varp == &p_bex || varp == &p_pm) { // 'backupext' and 'patchmode'
if (STRCMP(*p_bex == '.' ? p_bex + 1 : p_bex,
*p_pm == '.' ? p_pm + 1 : p_pm) == 0) {
- errmsg = (char_u *)N_("E589: 'backupext' and 'patchmode' are equal");
+ errmsg = N_("E589: 'backupext' and 'patchmode' are equal");
}
} else if (varp == &curwin->w_p_briopt) { // 'breakindentopt'
if (briopt_check(curwin) == FAIL) {
@@ -2457,11 +2457,11 @@ static char_u *did_set_string_option(int opt_idx, char_u **varp, bool new_value_
} else {
FOR_ALL_TAB_WINDOWS(tp, wp) {
if (set_chars_option(wp, &wp->w_p_lcs, true) != NULL) {
- errmsg = (char_u *)_("E834: Conflicts with value of 'listchars'");
+ errmsg = _("E834: Conflicts with value of 'listchars'");
goto ambw_end;
}
if (set_chars_option(wp, &wp->w_p_fcs, true) != NULL) {
- errmsg = (char_u *)_("E835: Conflicts with value of 'fillchars'");
+ errmsg = _("E835: Conflicts with value of 'fillchars'");
goto ambw_end;
}
}
@@ -2634,9 +2634,9 @@ ambw_end:
s++;
}
if (*s++ == NUL) {
- errmsg = (char_u *)N_("E524: Missing colon");
+ errmsg = N_("E524: Missing colon");
} else if (*s == ',' || *s == NUL) {
- errmsg = (char_u *)N_("E525: Zero length string");
+ errmsg = N_("E525: Zero length string");
}
if (errmsg != NULL) {
break;
@@ -2714,7 +2714,7 @@ ambw_end:
transchar_byte(*(s - 1)));
errmsg = errbuf;
} else {
- errmsg = (char_u *)"";
+ errmsg = "";
}
break;
}
@@ -2723,20 +2723,20 @@ ambw_end:
s++;
} else if (*s) {
if (errbuf != NULL) {
- errmsg = (char_u *)N_("E527: Missing comma");
+ errmsg = N_("E527: Missing comma");
} else {
- errmsg = (char_u *)"";
+ errmsg = "";
}
break;
}
}
if (*p_shada && errmsg == NULL && get_shada_parameter('\'') < 0) {
- errmsg = (char_u *)N_("E528: Must specify a ' value");
+ errmsg = N_("E528: Must specify a ' value");
}
} else if (gvarp == &p_sbr) { // 'showbreak'
for (s = *varp; *s; ) {
if (ptr2cells(s) != 1) {
- errmsg = (char_u *)N_("E595: 'showbreak' contains unprintable or wide character");
+ errmsg = N_("E595: 'showbreak' contains unprintable or wide character");
}
MB_PTR_ADV(s);
}
@@ -2905,7 +2905,7 @@ ambw_end:
*--s);
errmsg = errbuf;
} else {
- errmsg = (char_u *)"";
+ errmsg = "";
}
break;
}
@@ -3009,7 +3009,7 @@ ambw_end:
} else if (gvarp == &curwin->w_allbuf_opt.wo_fmr) { // 'foldmarker'
p = vim_strchr(*varp, ',');
if (p == NULL) {
- errmsg = (char_u *)N_("E536: comma required");
+ errmsg = N_("E536: comma required");
} else if (p == *varp || p[1] == NUL) {
errmsg = e_invarg;
} else if (foldmethodIsMarker(curwin)) {
@@ -3017,7 +3017,7 @@ ambw_end:
}
} else if (gvarp == &p_cms) { // 'commentstring'
if (**varp != NUL && strstr((char *)(*varp), "%s") == NULL) {
- errmsg = (char_u *)N_("E537: 'commentstring' must be empty or contain %s");
+ errmsg = N_("E537: 'commentstring' must be empty or contain %s");
}
} else if (varp == &p_fdo) { // 'foldopen'
if (opt_strings_flags(p_fdo, p_fdo_values, &fdo_flags, true) != OK) {
@@ -3342,7 +3342,7 @@ int check_signcolumn(char_u *val)
/// Handle setting 'colorcolumn' or 'textwidth' in window "wp".
///
/// @return error message, NULL if it's OK.
-char_u *check_colorcolumn(win_T *wp)
+char *check_colorcolumn(win_T *wp)
{
char_u *s;
int col;
@@ -3427,7 +3427,7 @@ void check_blending(win_T *wp)
///
/// @param varp either &curwin->w_p_lcs or &curwin->w_p_fcs
/// @return error message, NULL if it's OK.
-static char_u *set_chars_option(win_T *wp, char_u **varp, bool set)
+static char *set_chars_option(win_T *wp, char_u **varp, bool set)
{
int round, i, len, entries;
char_u *p, *s;
@@ -3614,10 +3614,10 @@ static char_u *set_chars_option(win_T *wp, char_u **varp, bool set)
/// Check validity of options with the 'statusline' format.
/// Return error message or NULL.
-char_u *check_stl_option(char_u *s)
+char *check_stl_option(char_u *s)
{
int groupdepth = 0;
- static char_u errbuf[80];
+ static char errbuf[80];
while (*s) {
// Check for valid keys after % sequences
@@ -3668,19 +3668,19 @@ char_u *check_stl_option(char_u *s)
s++;
}
if (*s != '}') {
- return (char_u *)N_("E540: Unclosed expression sequence");
+ return N_("E540: Unclosed expression sequence");
}
}
}
if (groupdepth != 0) {
- return (char_u *)N_("E542: unbalanced groups");
+ return N_("E542: unbalanced groups");
}
return NULL;
}
-static char_u *did_set_spell_option(bool is_spellfile)
+static char *did_set_spell_option(bool is_spellfile)
{
- char_u *errmsg = NULL;
+ char *errmsg = NULL;
if (is_spellfile) {
int l = (int)STRLEN(curwin->w_s->b_p_spf);
@@ -3704,7 +3704,7 @@ static char_u *did_set_spell_option(bool is_spellfile)
/// Set curbuf->b_cap_prog to the regexp program for 'spellcapcheck'.
/// Return error message when failed, NULL when OK.
-static char_u *compile_cap_prog(synblock_T *synblock)
+static char *compile_cap_prog(synblock_T *synblock)
FUNC_ATTR_NONNULL_ALL
{
regprog_T *rp = synblock->b_cap_prog;
@@ -3831,7 +3831,7 @@ static char *set_bool_option(const int opt_idx, char_u *const varp, const int va
// Ensure that options set to p_force_on cannot be disabled.
if ((int *)varp == &p_force_on && p_force_on == false) {
p_force_on = true;
- return (char *)e_unsupportedoption;
+ return e_unsupportedoption;
// Ensure that options set to p_force_off cannot be enabled.
} else if ((int *)varp == &p_force_off && p_force_off == true) {
p_force_off = false;
@@ -4017,9 +4017,9 @@ static char *set_bool_option(const int opt_idx, char_u *const varp, const int va
}
} else if ((int *)varp == &curwin->w_p_spell) { // 'spell'
if (curwin->w_p_spell) {
- char_u *errmsg = did_set_spelllang(curwin);
+ char *errmsg = did_set_spelllang(curwin);
if (errmsg != NULL) {
- EMSG(_(errmsg));
+ emsg(_(errmsg));
}
}
}
@@ -4136,10 +4136,10 @@ static char *set_bool_option(const int opt_idx, char_u *const varp, const int va
/// @param[in] opt_flags OPT_LOCAL, OPT_GLOBAL or OPT_MODELINE.
///
/// @return NULL on success, error message on error.
-static char *set_num_option(int opt_idx, char_u *varp, long value, char_u *errbuf, size_t errbuflen,
+static char *set_num_option(int opt_idx, char_u *varp, long value, char *errbuf, size_t errbuflen,
int opt_flags)
{
- char_u *errmsg = NULL;
+ char *errmsg = NULL;
long old_value = *(long *)varp;
long old_Rows = Rows; // remember old Rows
long *pp = (long *)varp;
@@ -4147,12 +4147,12 @@ static char *set_num_option(int opt_idx, char_u *varp, long value, char_u *errbu
// Disallow changing some options from secure mode.
if ((secure || sandbox != 0)
&& (options[opt_idx].flags & P_SECURE)) {
- return (char *)e_secure;
+ return e_secure;
}
// Many number options assume their value is in the signed int range.
if (value < INT_MIN || value > INT_MAX) {
- return (char *)e_invarg;
+ return e_invarg;
}
// Options that need some validation.
@@ -4921,12 +4921,12 @@ char *set_option_value(const char *const name, const long number, const char *co
opt_idx = findoption(name);
if (opt_idx < 0) {
- EMSG2(_("E355: Unknown option: %s"), name);
+ semsg(_("E355: Unknown option: %s"), name);
} else {
uint32_t flags = options[opt_idx].flags;
// Disallow changing some options in the sandbox
if (sandbox > 0 && (flags & P_SECURE)) {
- EMSG(_(e_sandbox));
+ emsg(_(e_sandbox));
return NULL;
}
if (flags & P_STRING) {
@@ -4948,7 +4948,7 @@ char *set_option_value(const char *const name, const long number, const char *co
// There's another character after zeros or the string
// is empty. In both cases, we are trying to set a
// num option using a string.
- EMSG3(_("E521: Number required: &%s = '%s'"),
+ semsg(_("E521: Number required: &%s = '%s'"),
name, string);
return NULL; // do nothing as we hit an error
}
@@ -5487,7 +5487,7 @@ void unset_global_local_option(char *name, void *from)
int opt_idx = findoption(name);
if (opt_idx < 0) {
- EMSG2(_("E355: Unknown option: %s"), name);
+ semsg(_("E355: Unknown option: %s"), name);
return;
}
p = &(options[opt_idx]);
@@ -5935,7 +5935,7 @@ static char_u *get_varp(vimoption_T *p)
case PV_WINBL:
return (char_u *)&(curwin->w_p_winbl);
default:
- IEMSG(_("E356: get_varp ERROR"));
+ iemsg(_("E356: get_varp ERROR"));
}
// always return a valid pointer to avoid a crash!
return (char_u *)&(curbuf->b_p_wm);
@@ -6808,7 +6808,7 @@ static void langmap_set(void)
}
}
if (to == NUL) {
- EMSG2(_("E357: 'langmap': Matching character missing for %s"),
+ semsg(_("E357: 'langmap': Matching character missing for %s"),
transchar(from));
return;
}
@@ -6828,7 +6828,7 @@ static void langmap_set(void)
p = p2;
if (p[0] != NUL) {
if (p[0] != ',') {
- EMSG2(_("E358: 'langmap': Extra characters after semicolon: %s"),
+ semsg(_("E358: 'langmap': Extra characters after semicolon: %s"),
p);
return;
}
@@ -7305,9 +7305,9 @@ bool tabstop_set(char_u *var, long **array)
if (strtol((char *)cp, (char **)&end, 10) <= 0) {
if (cp != end) {
- EMSG(_(e_positive));
+ emsg(_(e_positive));
} else {
- EMSG(_(e_invarg));
+ emsg(_(e_invarg));
}
return false;
}
@@ -7320,7 +7320,7 @@ bool tabstop_set(char_u *var, long **array)
valcount++;
continue;
}
- EMSG(_(e_invarg));
+ emsg(_(e_invarg));
return false;
}
diff --git a/src/nvim/os/dl.c b/src/nvim/os/dl.c
index b2e3994d10..7d095d31e3 100644
--- a/src/nvim/os/dl.c
+++ b/src/nvim/os/dl.c
@@ -49,7 +49,7 @@ bool os_libcall(const char *libname, const char *funcname, const char *argv, int
// open the dynamic loadable library
if (uv_dlopen(libname, &lib)) {
- EMSG2(_("dlerror = \"%s\""), uv_dlerror(&lib));
+ semsg(_("dlerror = \"%s\""), uv_dlerror(&lib));
uv_dlclose(&lib);
return false;
}
@@ -57,7 +57,7 @@ bool os_libcall(const char *libname, const char *funcname, const char *argv, int
// find and load the requested function in the library
gen_fn fn;
if (uv_dlsym(&lib, funcname, (void **)&fn)) {
- EMSG2(_("dlerror = \"%s\""), uv_dlerror(&lib));
+ semsg(_("dlerror = \"%s\""), uv_dlerror(&lib));
uv_dlclose(&lib);
return false;
}
diff --git a/src/nvim/os/env.c b/src/nvim/os/env.c
index 0f363ecfc3..727b10f7a7 100644
--- a/src/nvim/os/env.c
+++ b/src/nvim/os/env.c
@@ -250,7 +250,7 @@ void os_copy_fullenv(char **env, size_t env_size)
char *utf8_str;
int conversion_result = utf16_to_utf8(p, -1, &utf8_str);
if (conversion_result != 0) {
- EMSG2("utf16_to_utf8 failed: %d", conversion_result);
+ semsg("utf16_to_utf8 failed: %d", conversion_result);
break;
}
p += l + 1;
@@ -297,7 +297,7 @@ char *os_getenvname_at_index(size_t index)
char *utf8_str;
int conversion_result = utf16_to_utf8(p, -1, &utf8_str);
if (conversion_result != 0) {
- EMSG2("utf16_to_utf8 failed: %d", conversion_result);
+ semsg("utf16_to_utf8 failed: %d", conversion_result);
break;
}
@@ -375,7 +375,7 @@ void os_get_hostname(char *hostname, size_t size)
if (GetComputerNameW(host_utf16, &host_wsize) == 0) {
*hostname = '\0';
DWORD err = GetLastError();
- EMSG2("GetComputerNameW failed: %d", err);
+ semsg("GetComputerNameW failed: %d", err);
return;
}
host_utf16[host_wsize] = '\0';
@@ -383,13 +383,13 @@ void os_get_hostname(char *hostname, size_t size)
char *host_utf8;
int conversion_result = utf16_to_utf8(host_utf16, -1, &host_utf8);
if (conversion_result != 0) {
- EMSG2("utf16_to_utf8 failed: %d", conversion_result);
+ semsg("utf16_to_utf8 failed: %d", conversion_result);
return;
}
xstrlcpy(hostname, host_utf8, size);
xfree(host_utf8);
#else
- EMSG("os_get_hostname failed: missing uname()");
+ emsg("os_get_hostname failed: missing uname()");
*hostname = '\0';
#endif
}
@@ -481,7 +481,7 @@ void init_homedir(void)
var = (char *)IObuff;
}
if (os_chdir(os_buf) != 0) {
- EMSG(_(e_prev_dir));
+ emsg(_(e_prev_dir));
}
}
}
diff --git a/src/nvim/os/fileio.c b/src/nvim/os/fileio.c
index 1ae6ca4244..b1710737d0 100644
--- a/src/nvim/os/fileio.c
+++ b/src/nvim/os/fileio.c
@@ -426,6 +426,6 @@ int msgpack_file_write(void *data, const char *buf, size_t len)
/// @return -1 (error return for msgpack_packer callbacks).
int msgpack_file_write_error(const int error)
{
- emsgf(_("E5420: Failed to write to file: %s"), os_strerror(error));
+ semsg(_("E5420: Failed to write to file: %s"), os_strerror(error));
return -1;
}
diff --git a/src/nvim/os/fs.c b/src/nvim/os/fs.c
index 9675cfbb0f..3ff13c2b3f 100644
--- a/src/nvim/os/fs.c
+++ b/src/nvim/os/fs.c
@@ -1212,7 +1212,7 @@ char *os_resolve_shortcut(const char *fname)
wchar_t *p;
const int r = utf8_to_utf16(fname, -1, &p);
if (r != 0) {
- EMSG2("utf8_to_utf16 failed: %d", r);
+ semsg("utf8_to_utf16 failed: %d", r);
} else if (p != NULL) {
// Get a pointer to the IPersistFile interface.
hr = pslw->lpVtbl->QueryInterface(pslw, &IID_IPersistFile, (void **)&ppf);
@@ -1239,7 +1239,7 @@ char *os_resolve_shortcut(const char *fname)
if (hr == S_OK && wsz[0] != NUL) {
const int r2 = utf16_to_utf8(wsz, -1, &rfname);
if (r2 != 0) {
- EMSG2("utf16_to_utf8 failed: %d", r2);
+ semsg("utf16_to_utf8 failed: %d", r2);
}
}
@@ -1274,7 +1274,7 @@ bool os_is_reparse_point_include(const char *path)
const int r = utf8_to_utf16(path, -1, &utf16_path);
if (r != 0) {
- EMSG2("utf8_to_utf16 failed: %d", r);
+ semsg("utf8_to_utf16 failed: %d", r);
return false;
}
diff --git a/src/nvim/os/shell.c b/src/nvim/os/shell.c
index 2bff65b241..1399fc758c 100644
--- a/src/nvim/os/shell.c
+++ b/src/nvim/os/shell.c
@@ -159,7 +159,7 @@ int os_expand_wildcards(int num_pat, char_u **pat, int *num_file, char_u ***file
// get a name for the temp file
if ((tempname = vim_tempname()) == NULL) {
- EMSG(_(e_notmp));
+ emsg(_(e_notmp));
return FAIL;
}
@@ -389,7 +389,7 @@ int os_expand_wildcards(int num_pat, char_u **pat, int *num_file, char_u ***file
os_remove((char *)tempname);
if (readlen != len) {
// unexpected read error
- EMSG2(_(e_notread), tempname);
+ semsg(_(e_notread), tempname);
xfree(tempname);
xfree(buffer);
return FAIL;
@@ -1180,7 +1180,7 @@ static void shell_write_cb(Stream *stream, void *data, int status)
if (status) {
// Can happen if system() tries to send input to a shell command that was
// backgrounded (:call system("cat - &", "foo")). #3529 #5241
- msg_schedule_emsgf(_("E5677: Error writing input to shell-command: %s"),
+ msg_schedule_semsg(_("E5677: Error writing input to shell-command: %s"),
uv_err_name(status));
}
stream_close(stream, NULL, NULL);
diff --git a/src/nvim/os/users.c b/src/nvim/os/users.c
index fd7ead68da..9952e2b387 100644
--- a/src/nvim/os/users.c
+++ b/src/nvim/os/users.c
@@ -64,7 +64,7 @@ int os_get_usernames(garray_T *users)
char *user;
int conversion_result = utf16_to_utf8(uinfo[i].usri0_name, -1, &user);
if (conversion_result != 0) {
- EMSG2("utf16_to_utf8 failed: %d", conversion_result);
+ semsg("utf16_to_utf8 failed: %d", conversion_result);
break;
}
add_user(users, user, false);
diff --git a/src/nvim/path.c b/src/nvim/path.c
index 2a80079817..6f0f715a25 100644
--- a/src/nvim/path.c
+++ b/src/nvim/path.c
@@ -1701,7 +1701,7 @@ char_u *find_file_name_in_path(char_u *ptr, size_t len, int options, long count,
if (file_name == NULL && (options & FNAME_MESS)) {
char_u c = ptr[len];
ptr[len] = NUL;
- EMSG2(_("E447: Can't find file \"%s\" in path"), ptr);
+ semsg(_("E447: Can't find file \"%s\" in path"), ptr);
ptr[len] = c;
}
@@ -2081,7 +2081,7 @@ int expand_wildcards_eval(char_u **pat, int *num_file, char_u ***file, int flags
int ret = FAIL;
char_u *eval_pat = NULL;
char_u *exp_pat = *pat;
- char_u *ignored_msg;
+ char *ignored_msg;
size_t usedlen;
if (*exp_pat == '%' || *exp_pat == '#' || *exp_pat == '<') {
@@ -2257,7 +2257,7 @@ int path_full_dir_name(char *directory, char *buffer, size_t len)
if (os_chdir(old_dir) != SUCCESS) {
// That shouldn't happen, since we've tested if it works.
retval = FAIL;
- EMSG(_(e_prev_dir));
+ emsg(_(e_prev_dir));
}
return retval;
diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c
index d4f68c9948..54da291bab 100644
--- a/src/nvim/quickfix.c
+++ b/src/nvim/quickfix.c
@@ -345,23 +345,19 @@ static struct fmtpattern {
/// pattern specifier is supplied in "efmpat". The converted pattern is stored
/// in "regpat". Returns a pointer to the location after the pattern.
static char_u *efmpat_to_regpat(const char_u *efmpat, char_u *regpat, efm_T *efminfo, int idx,
- int round, char_u *errmsg, size_t errmsglen)
+ int round)
FUNC_ATTR_NONNULL_ALL
{
if (efminfo->addr[idx]) {
// Each errorformat pattern can occur only once
- snprintf((char *)errmsg, errmsglen,
- _("E372: Too many %%%c in format string"), *efmpat);
- EMSG(errmsg);
+ semsg(_("E372: Too many %%%c in format string"), *efmpat);
return NULL;
}
if ((idx && idx < 6
&& vim_strchr((char_u *)"DXOPQ", efminfo->prefix) != NULL)
|| (idx == 6
&& vim_strchr((char_u *)"OPQ", efminfo->prefix) == NULL)) {
- snprintf((char *)errmsg, errmsglen,
- _("E373: Unexpected %%%c in format string"), *efmpat);
- EMSG(errmsg);
+ semsg(_("E373: Unexpected %%%c in format string"), *efmpat);
return NULL;
}
efminfo->addr[idx] = (char_u)++ round;
@@ -405,8 +401,7 @@ static char_u *efmpat_to_regpat(const char_u *efmpat, char_u *regpat, efm_T *efm
/// Convert a scanf like format in 'errorformat' to a regular expression.
/// Returns a pointer to the location after the pattern.
-static char_u *scanf_fmt_to_regpat(const char_u **pefmp, const char_u *efm, int len, char_u *regpat,
- char_u *errmsg, size_t errmsglen)
+static char_u *scanf_fmt_to_regpat(const char_u **pefmp, const char_u *efm, int len, char_u *regpat)
FUNC_ATTR_NONNULL_ALL
{
const char_u *efmp = *pefmp;
@@ -421,7 +416,7 @@ static char_u *scanf_fmt_to_regpat(const char_u **pefmp, const char_u *efm, int
while (efmp < efm + len && (*regpat++ = *++efmp) != ']') {
}
if (efmp == efm + len) {
- EMSG(_("E374: Missing ] in format string"));
+ emsg(_("E374: Missing ] in format string"));
return NULL;
}
}
@@ -431,10 +426,7 @@ static char_u *scanf_fmt_to_regpat(const char_u **pefmp, const char_u *efm, int
*regpat++ = '\\';
*regpat++ = '+';
} else {
- // TODO(vim): scanf()-like: %*ud, %*3c, %*f, ... ?
- snprintf((char *)errmsg, errmsglen,
- _("E375: Unsupported %%%c in format string"), *efmp);
- EMSG(errmsg);
+ semsg(_("E375: Unsupported %%%c in format string"), *efmp);
return NULL;
}
@@ -444,8 +436,7 @@ static char_u *scanf_fmt_to_regpat(const char_u **pefmp, const char_u *efm, int
}
/// Analyze/parse an errorformat prefix.
-static const char_u *efm_analyze_prefix(const char_u *efmp, efm_T *efminfo, char_u *errmsg,
- size_t errmsglen)
+static const char_u *efm_analyze_prefix(const char_u *efmp, efm_T *efminfo)
FUNC_ATTR_NONNULL_ALL
{
if (vim_strchr((char_u *)"+-", *efmp) != NULL) {
@@ -454,9 +445,7 @@ static const char_u *efm_analyze_prefix(const char_u *efmp, efm_T *efminfo, char
if (vim_strchr((char_u *)"DXAEWINCZGOPQ", *efmp) != NULL) {
efminfo->prefix = *efmp;
} else {
- snprintf((char *)errmsg, errmsglen,
- _("E376: Invalid %%%c in format string prefix"), *efmp);
- EMSG(errmsg);
+ semsg(_("E376: Invalid %%%c in format string prefix"), *efmp);
return NULL;
}
@@ -465,8 +454,7 @@ static const char_u *efm_analyze_prefix(const char_u *efmp, efm_T *efminfo, char
// Converts a 'errorformat' string to regular expression pattern
-static int efm_to_regpat(const char_u *efm, int len, efm_T *fmt_ptr, char_u *regpat, char_u *errmsg,
- size_t errmsglen)
+static int efm_to_regpat(const char_u *efm, int len, efm_T *fmt_ptr, char_u *regpat)
FUNC_ATTR_NONNULL_ALL
{
// Build regexp pattern from current 'errorformat' option
@@ -483,15 +471,14 @@ static int efm_to_regpat(const char_u *efm, int len, efm_T *fmt_ptr, char_u *reg
}
}
if (idx < FMT_PATTERNS) {
- ptr = efmpat_to_regpat(efmp, ptr, fmt_ptr, idx, round, errmsg,
- errmsglen);
+ ptr = efmpat_to_regpat(efmp, ptr, fmt_ptr, idx, round);
if (ptr == NULL) {
return FAIL;
}
round++;
} else if (*efmp == '*') {
efmp++;
- ptr = scanf_fmt_to_regpat(&efmp, efm, len, ptr, errmsg, errmsglen);
+ ptr = scanf_fmt_to_regpat(&efmp, efm, len, ptr);
if (ptr == NULL) {
return FAIL;
}
@@ -504,14 +491,12 @@ static int efm_to_regpat(const char_u *efm, int len, efm_T *fmt_ptr, char_u *reg
} else if (efmp == efm + 1) { // analyse prefix
// prefix is allowed only at the beginning of the errorformat
// option part
- efmp = efm_analyze_prefix(efmp, fmt_ptr, errmsg, errmsglen);
+ efmp = efm_analyze_prefix(efmp, fmt_ptr);
if (efmp == NULL) {
return FAIL;
}
} else {
- snprintf((char *)errmsg, CMDBUFFSIZE + 1,
- _("E377: Invalid %%%c in format string"), *efmp);
- EMSG(errmsg);
+ semsg(_("E377: Invalid %%%c in format string"), *efmp);
return FAIL;
}
} else { // copy normal character
@@ -590,9 +575,6 @@ static efm_T *parse_efm_option(char_u *efm)
efm_T *fmt_last = NULL;
int len;
- size_t errmsglen = CMDBUFFSIZE + 1;
- char_u *errmsg = xmalloc(errmsglen);
-
// Get some space to modify the format string into.
size_t sz = efm_regpat_bufsz(efm);
char_u *fmtstr = xmalloc(sz);
@@ -610,7 +592,7 @@ static efm_T *parse_efm_option(char_u *efm)
// Isolate one part in the 'errorformat' option
len = efm_option_part_len(efm);
- if (efm_to_regpat(efm, len, fmt_ptr, fmtstr, errmsg, errmsglen) == FAIL) {
+ if (efm_to_regpat(efm, len, fmt_ptr, fmtstr) == FAIL) {
goto parse_efm_error;
}
if ((fmt_ptr->prog = vim_regcomp(fmtstr, RE_MAGIC + RE_STRING)) == NULL) {
@@ -621,7 +603,7 @@ static efm_T *parse_efm_option(char_u *efm)
}
if (fmt_first == NULL) { // nothing found
- EMSG(_("E378: 'errorformat' contains no pattern"));
+ emsg(_("E378: 'errorformat' contains no pattern"));
}
goto parse_efm_end;
@@ -631,7 +613,6 @@ parse_efm_error:
parse_efm_end:
xfree(fmtstr);
- xfree(errmsg);
return fmt_first;
}
@@ -1026,7 +1007,7 @@ static int qf_setup_state(qfstate_T *pstate, char_u *restrict enc, const char_u
if (efile != NULL
&& (pstate->fd = os_fopen((const char *)efile, "r")) == NULL) {
- EMSG2(_(e_openerrf), efile);
+ semsg(_(e_openerrf), efile);
return FAIL;
}
@@ -1170,7 +1151,7 @@ static int qf_init_ext(qf_info_T *qi, int qf_idx, const char_u *restrict efile,
retval = qfl->qf_count;
goto qf_init_end;
}
- EMSG(_(e_readerrf));
+ emsg(_(e_readerrf));
error2:
if (!adding) {
// Error when creating a new list. Free the new list
@@ -1563,7 +1544,7 @@ static int qf_parse_dir_pfx(int idx, qffields_T *fields, qf_list_T *qfl)
{
if (idx == 'D') { // enter directory
if (*fields->namebuf == NUL) {
- EMSG(_("E379: Missing or empty directory name"));
+ emsg(_("E379: Missing or empty directory name"));
return QF_FAIL;
}
qfl->qf_directory = qf_push_dir(fields->namebuf, &qfl->qf_dir_stack, false);
@@ -1747,7 +1728,7 @@ static void decr_quickfix_busy(void)
}
#ifdef ABORT_ON_INTERNAL_ERROR
if (quickfix_busy < 0) {
- EMSG("quickfix_busy has become negative");
+ emsg("quickfix_busy has become negative");
abort();
}
#endif
@@ -1757,7 +1738,7 @@ static void decr_quickfix_busy(void)
void check_quickfix_busy(void)
{
if (quickfix_busy != 0) {
- EMSGN("quickfix_busy not zero on exit: %" PRId64, (int64_t)quickfix_busy);
+ semsg("quickfix_busy not zero on exit: %" PRId64, (int64_t)quickfix_busy);
# ifdef ABORT_ON_INTERNAL_ERROR
abort();
# endif
@@ -1893,7 +1874,7 @@ static qf_info_T *qf_cmd_get_stack(exarg_T *eap, int print_emsg)
qi = GET_LOC_LIST(curwin);
if (qi == NULL) {
if (print_emsg) {
- EMSG(_(e_loclist));
+ emsg(_(e_loclist));
}
return NULL;
}
@@ -2360,7 +2341,7 @@ static qfline_T *get_nth_valid_entry(qf_list_T *qfl, int errornr, int dir, int *
qf_ptr = prev_qf_ptr;
qf_idx = prev_index;
if (err != NULL) {
- EMSG(_(err));
+ emsg(_(err));
return NULL;
}
break;
@@ -2721,13 +2702,13 @@ static int qf_jump_edit_buffer(qf_info_T *qi, qfline_T *qf_ptr, int forceit, win
// If a location list, check whether the associated window is still
// present.
if (qfl_type == QFLT_LOCATION && !win_valid_any_tab(oldwin)) {
- EMSG(_("E924: Current window was closed"));
+ emsg(_("E924: Current window was closed"));
*opened_window = false;
return NOTDONE;
}
if (qfl_type == QFLT_QUICKFIX && !qflist_valid(NULL, save_qfid)) {
- EMSG(_(e_current_quickfix_list_was_changed));
+ emsg(_(e_current_quickfix_list_was_changed));
return NOTDONE;
}
@@ -2735,9 +2716,9 @@ static int qf_jump_edit_buffer(qf_info_T *qi, qfline_T *qf_ptr, int forceit, win
|| old_changetick != qfl->qf_changedtick
|| !is_qf_entry_present(qfl, qf_ptr)) {
if (qfl_type == QFLT_QUICKFIX) {
- EMSG(_(e_current_quickfix_list_was_changed));
+ emsg(_(e_current_quickfix_list_was_changed));
} else {
- EMSG(_(e_current_location_list_was_changed));
+ emsg(_(e_current_location_list_was_changed));
}
return NOTDONE;
}
@@ -2836,9 +2817,9 @@ static int qf_jump_open_window(qf_info_T *qi, qfline_T *qf_ptr, bool newwin, int
|| old_changetick != qfl->qf_changedtick
|| !is_qf_entry_present(qfl, qf_ptr)) {
if (qfl_type == QFLT_QUICKFIX) {
- EMSG(_(e_current_quickfix_list_was_changed));
+ emsg(_(e_current_quickfix_list_was_changed));
} else {
- EMSG(_(e_current_location_list_was_changed));
+ emsg(_(e_current_location_list_was_changed));
}
return FAIL;
}
@@ -2861,9 +2842,9 @@ static int qf_jump_open_window(qf_info_T *qi, qfline_T *qf_ptr, bool newwin, int
|| old_changetick != qfl->qf_changedtick
|| !is_qf_entry_present(qfl, qf_ptr)) {
if (qfl_type == QFLT_QUICKFIX) {
- EMSG(_(e_current_quickfix_list_was_changed));
+ emsg(_(e_current_quickfix_list_was_changed));
} else {
- EMSG(_(e_current_location_list_was_changed));
+ emsg(_(e_current_location_list_was_changed));
}
return FAIL;
}
@@ -2950,7 +2931,7 @@ static void qf_jump_newwin(qf_info_T *qi, int dir, int errornr, int forceit, boo
}
if (qf_stack_empty(qi) || qf_list_empty(qf_get_curlist(qi))) {
- EMSG(_(e_quickfix));
+ emsg(_(e_quickfix));
return;
}
@@ -3123,7 +3104,7 @@ void qf_list(exarg_T *eap)
}
if (qf_stack_empty(qi) || qf_list_empty(qf_get_curlist(qi))) {
- EMSG(_(e_quickfix));
+ emsg(_(e_quickfix));
return;
}
@@ -3133,7 +3114,7 @@ void qf_list(exarg_T *eap)
plus = true;
}
if (!get_list_range(&arg, &idx1, &idx2) || *arg != NUL) {
- EMSG(_(e_trailing));
+ emsg(_(e_trailing));
return;
}
qfl = qf_get_curlist(qi);
@@ -3278,13 +3259,13 @@ void qf_age(exarg_T *eap)
while (count--) {
if (eap->cmdidx == CMD_colder || eap->cmdidx == CMD_lolder) {
if (qi->qf_curlist == 0) {
- EMSG(_("E380: At bottom of quickfix stack"));
+ emsg(_("E380: At bottom of quickfix stack"));
break;
}
--qi->qf_curlist;
} else {
if (qi->qf_curlist >= qi->qf_listcount - 1) {
- EMSG(_("E381: At top of quickfix stack"));
+ emsg(_("E381: At top of quickfix stack"));
break;
}
++qi->qf_curlist;
@@ -3302,7 +3283,7 @@ void qf_history(exarg_T *eap)
if (eap->addr_count > 0) {
if (qi == NULL) {
- EMSG(_(e_loclist));
+ emsg(_(e_loclist));
return;
}
@@ -3312,7 +3293,7 @@ void qf_history(exarg_T *eap)
qf_msg(qi, qi->qf_curlist, "");
qf_update_buffer(qi, NULL);
} else {
- EMSG(_(e_invrange));
+ emsg(_(e_invrange));
}
return;
@@ -3488,7 +3469,7 @@ void qf_view_result(bool split)
qi = GET_LOC_LIST(curwin);
}
if (qf_list_empty(qf_get_curlist(qi))) {
- EMSG(_(e_quickfix));
+ emsg(_(e_quickfix));
return;
}
@@ -4383,7 +4364,7 @@ static char_u *get_mef_name(void)
if (*p_mef == NUL) {
name = vim_tempname();
if (name == NULL) {
- EMSG(_(e_notmp));
+ emsg(_(e_notmp));
}
return name;
}
@@ -4957,7 +4938,7 @@ void ex_cbelow(exarg_T *eap)
int buf_has_flag;
if (eap->addr_count > 0 && eap->line2 <= 0) {
- EMSG(_(e_invrange));
+ emsg(_(e_invrange));
return;
}
@@ -4969,7 +4950,7 @@ void ex_cbelow(exarg_T *eap)
buf_has_flag = BUF_HAS_LL_ENTRY;
}
if (!(curbuf->b_has_qf_entry & buf_has_flag)) {
- EMSG(_(e_quickfix));
+ emsg(_(e_quickfix));
return;
}
@@ -4980,7 +4961,7 @@ void ex_cbelow(exarg_T *eap)
qfl = qf_get_curlist(qi);
// check if the list has valid errors
if (!qf_list_has_valid_entries(qfl)) {
- EMSG(_(e_quickfix));
+ emsg(_(e_quickfix));
return;
}
@@ -5011,7 +4992,7 @@ void ex_cbelow(exarg_T *eap)
if (errornr > 0) {
qf_jump(qi, 0, errornr, false);
} else {
- EMSG(_(e_no_more_items));
+ emsg(_(e_no_more_items));
}
}
@@ -5135,7 +5116,7 @@ static void vgr_init_regmatch(regmmatch_T *regmatch, char_u *s)
if (s == NULL || *s == NUL) {
// Pattern is empty, use last search pattern.
if (last_search_pat() == NULL) {
- EMSG(_(e_noprevre));
+ emsg(_(e_noprevre));
return;
}
regmatch->regprog = vim_regcomp(last_search_pat(), RE_MAGIC);
@@ -5195,7 +5176,7 @@ static bool vgr_qflist_valid(win_T *wp, qf_info_T *qi, unsigned qfid, char_u *ti
if (!qflist_valid(wp, qfid)) {
if (wp != NULL) {
// An autocmd has freed the location list
- EMSG(_(e_current_location_list_was_changed));
+ emsg(_(e_current_location_list_was_changed));
return false;
} else {
// Quickfix list is not found, create a new one.
@@ -5354,7 +5335,7 @@ void ex_vimgrep(exarg_T *eap)
char_u *title = vim_strsave(qf_cmdtitle(*eap->cmdlinep));
p = skip_vimgrep_pat(eap->arg, &s, &flags);
if (p == NULL) {
- EMSG(_(e_invalpat));
+ emsg(_(e_invalpat));
goto theend;
}
@@ -5365,7 +5346,7 @@ void ex_vimgrep(exarg_T *eap)
p = skipwhite(p);
if (*p == NUL) {
- EMSG(_("E683: File name missing or invalid pattern"));
+ emsg(_("E683: File name missing or invalid pattern"));
goto theend;
}
@@ -5381,7 +5362,7 @@ void ex_vimgrep(exarg_T *eap)
goto theend;
}
if (fcount == 0) {
- EMSG(_(e_nomatch));
+ emsg(_(e_nomatch));
goto theend;
}
@@ -5527,7 +5508,7 @@ void ex_vimgrep(exarg_T *eap)
target_dir);
}
} else {
- EMSG2(_(e_nomatch2), s);
+ semsg(_(e_nomatch2), s);
}
decr_quickfix_busy();
@@ -6251,7 +6232,7 @@ static int qf_add_entry_from_dict(qf_list_T *qfl, const dict_T *d, bool first_en
if (bufnum != 0 && (buflist_findnr(bufnum) == NULL)) {
if (!did_bufnr_emsg) {
did_bufnr_emsg = true;
- EMSGN(_("E92: Buffer %" PRId64 " not found"), bufnum);
+ semsg(_("E92: Buffer %" PRId64 " not found"), (int64_t)bufnum);
}
valid = false;
bufnum = 0;
@@ -6659,7 +6640,7 @@ int set_errorlist(win_T *wp, list_T *list, int action, char_u *title, dict_T *wh
// A dict argument cannot be specified with a non-empty list argument
if (list != NULL && tv_list_len(list) != 0 && what != NULL) {
- EMSG2(_(e_invarg2), _("cannot have both a list and a \"what\" argument"));
+ semsg(_(e_invarg2), _("cannot have both a list and a \"what\" argument"));
return FAIL;
}
@@ -6760,12 +6741,12 @@ static int cbuffer_process_args(exarg_T *eap, buf_T **bufp, linenr_T *line1, lin
}
if (buf == NULL) {
- EMSG(_(e_invarg));
+ emsg(_(e_invarg));
return FAIL;
}
if (buf->b_ml.ml_mfp == NULL) {
- EMSG(_("E681: Buffer is not loaded"));
+ emsg(_("E681: Buffer is not loaded"));
return FAIL;
}
@@ -6776,7 +6757,7 @@ static int cbuffer_process_args(exarg_T *eap, buf_T **bufp, linenr_T *line1, lin
if (eap->line1 < 1 || eap->line1 > buf->b_ml.ml_line_count
|| eap->line2 < 1 || eap->line2 > buf->b_ml.ml_line_count) {
- EMSG(_(e_invrange));
+ emsg(_(e_invrange));
return FAIL;
}
@@ -6936,7 +6917,7 @@ void ex_cexpr(exarg_T *eap)
}
decr_quickfix_busy();
} else {
- EMSG(_("E777: String or List expected"));
+ emsg(_("E777: String or List expected"));
}
cleanup:
tv_clear(&tv);
@@ -7149,7 +7130,7 @@ void ex_helpgrep(exarg_T *eap)
if (!qf_list_empty(qf_get_curlist(qi))) {
qf_jump(qi, 0, 0, false);
} else {
- EMSG2(_(e_nomatch2), eap->arg);
+ semsg(_(e_nomatch2), eap->arg);
}
decr_quickfix_busy();
diff --git a/src/nvim/regexp.c b/src/nvim/regexp.c
index d39d6c69f1..72c64ec2df 100644
--- a/src/nvim/regexp.c
+++ b/src/nvim/regexp.c
@@ -463,13 +463,13 @@ static int toggle_Magic(int x)
// Used for an error (down from) vim_regcomp(): give the error message, set
// rc_did_emsg and return NULL
-#define EMSG_RET_NULL(m) return (EMSG(m), rc_did_emsg = true, (void *)NULL)
-#define IEMSG_RET_NULL(m) return (IEMSG(m), rc_did_emsg = true, (void *)NULL)
-#define EMSG_RET_FAIL(m) return (EMSG(m), rc_did_emsg = true, FAIL)
+#define EMSG_RET_NULL(m) return (emsg(m), rc_did_emsg = true, (void *)NULL)
+#define IEMSG_RET_NULL(m) return (iemsg(m), rc_did_emsg = true, (void *)NULL)
+#define EMSG_RET_FAIL(m) return (emsg(m), rc_did_emsg = true, FAIL)
#define EMSG2_RET_NULL(m, c) \
- return (EMSG2((m), (c) ? "" : "\\"), rc_did_emsg = true, (void *)NULL)
+ return (semsg((m), (c) ? "" : "\\"), rc_did_emsg = true, (void *)NULL)
#define EMSG2_RET_FAIL(m, c) \
- return (EMSG2((m), (c) ? "" : "\\"), rc_did_emsg = true, FAIL)
+ return (semsg((m), (c) ? "" : "\\"), rc_did_emsg = true, FAIL)
#define EMSG_ONE_RET_NULL EMSG2_RET_NULL(_( \
"E369: invalid item in %s%%[]"), reg_magic == MAGIC_ALL)
@@ -1237,7 +1237,7 @@ static int seen_endbrace(int refnum)
}
if (*p == NUL) {
- EMSG(_("E65: Illegal back reference"));
+ emsg(_("E65: Illegal back reference"));
rc_did_emsg = true;
return false;
}
@@ -1767,7 +1767,7 @@ static char_u *regpiece(int *flagp)
else
sprintf((char *)IObuff, _("E62: Nested %s%c"),
reg_magic == MAGIC_ALL ? "" : "\\", no_Magic(peekchr()));
- EMSG_RET_NULL(IObuff);
+ EMSG_RET_NULL((char *)IObuff);
}
return ret;
@@ -1929,7 +1929,7 @@ static char_u *regatom(int *flagp)
sprintf((char *)IObuff, _("E64: %s%c follows nothing"),
(c == '*' ? reg_magic >= MAGIC_ON : reg_magic == MAGIC_ALL)
? "" : "\\", c);
- EMSG_RET_NULL(IObuff);
+ EMSG_RET_NULL((char *)IObuff);
/* NOTREACHED */
case Magic('~'): /* previous substitute pattern */
@@ -3153,7 +3153,7 @@ static int read_limits(long *minval, long *maxval)
if (*regparse != '}') {
sprintf((char *)IObuff, _("E554: Syntax error in %s{...}"),
reg_magic == MAGIC_ALL ? "" : "\\");
- EMSG_RET_FAIL(IObuff);
+ EMSG_RET_FAIL((char *)IObuff);
}
/*
@@ -3483,7 +3483,7 @@ static long bt_regexec_both(char_u *line,
/* Be paranoid... */
if (prog == NULL || line == NULL) {
- IEMSG(_(e_null));
+ iemsg(_(e_null));
goto theend;
}
@@ -4730,7 +4730,7 @@ static bool regmatch(
* follows. The code is below. Parameters are stored in
* a regstar_T on the regstack. */
if ((long)((unsigned)regstack.ga_len >> 10) >= p_mmp) {
- EMSG(_(e_maxmempat));
+ emsg(_(e_maxmempat));
status = RA_FAIL;
} else {
ga_grow(&regstack, sizeof(regstar_T));
@@ -4768,7 +4768,7 @@ static bool regmatch(
case NOBEHIND:
/* Need a bit of room to store extra positions. */
if ((long)((unsigned)regstack.ga_len >> 10) >= p_mmp) {
- EMSG(_(e_maxmempat));
+ emsg(_(e_maxmempat));
status = RA_FAIL;
} else {
ga_grow(&regstack, sizeof(regbehind_T));
@@ -4816,7 +4816,7 @@ static bool regmatch(
break;
default:
- IEMSG(_(e_re_corr));
+ iemsg(_(e_re_corr));
#ifdef REGEXP_DEBUG
printf("Illegal op code %d\n", op);
#endif
@@ -5174,7 +5174,7 @@ static bool regmatch(
* We get here only if there's trouble -- normally "case END" is
* the terminating point.
*/
- IEMSG(_(e_re_corr));
+ iemsg(_(e_re_corr));
#ifdef REGEXP_DEBUG
printf("Premature EOL\n");
#endif
@@ -5196,7 +5196,7 @@ static regitem_T *regstack_push(regstate_T state, char_u *scan)
regitem_T *rp;
if ((long)((unsigned)regstack.ga_len >> 10) >= p_mmp) {
- EMSG(_(e_maxmempat));
+ emsg(_(e_maxmempat));
return NULL;
}
ga_grow(&regstack, sizeof(regitem_T));
@@ -5581,7 +5581,7 @@ do_class:
break;
default: // Oh dear. Called inappropriately.
- IEMSG(_(e_re_corr));
+ iemsg(_(e_re_corr));
#ifdef REGEXP_DEBUG
printf("Called regrepeat with op code %d\n", OP(p));
#endif
@@ -5631,7 +5631,7 @@ static int prog_magic_wrong(void)
}
if (UCHARAT(((bt_regprog_T *)prog)->program) != REGMAGIC) {
- EMSG(_(e_re_corr));
+ emsg(_(e_re_corr));
return true;
}
return false;
@@ -6689,7 +6689,7 @@ static int vim_regsub_both(char_u *source, typval_T *expr, char_u *dest,
// Be paranoid...
if ((source == NULL && expr == NULL) || dest == NULL) {
- EMSG(_(e_null));
+ emsg(_(e_null));
return 0;
}
if (prog_magic_wrong())
@@ -6943,7 +6943,7 @@ static int vim_regsub_both(char_u *source, typval_T *expr, char_u *dest,
}
} else if (*s == NUL) { // we hit NUL.
if (copy) {
- IEMSG(_(e_re_damg));
+ iemsg(_(e_re_damg));
}
goto exit;
} else {
@@ -7229,7 +7229,7 @@ regprog_T *vim_regcomp(char_u *expr_arg, int re_flags)
regname[newengine]);
#endif
} else {
- EMSG(_(
+ emsg(_(
"E864: \\%#= can only be followed by 0, 1, or 2. The automatic engine will be used "));
regexp_engine = AUTOMATIC_ENGINE;
}
@@ -7263,7 +7263,7 @@ regprog_T *vim_regcomp(char_u *expr_arg, int re_flags)
fprintf(f, "Syntax error in \"%s\"\n", expr);
fclose(f);
} else
- EMSG2("(NFA) Could not open \"%s\" to write !!!",
+ semsg("(NFA) Could not open \"%s\" to write !!!",
BT_REGEXP_DEBUG_LOG_NAME);
}
#endif
@@ -7328,7 +7328,7 @@ static bool vim_regexec_string(regmatch_T *rmp, char_u *line, colnr_T col,
// Cannot use the same prog recursively, it contains state.
if (rmp->regprog->re_in_use) {
- EMSG(_(e_recursive));
+ emsg(_(e_recursive));
return false;
}
rmp->regprog->re_in_use = true;
@@ -7425,7 +7425,7 @@ long vim_regexec_multi(
// Cannot use the same prog recursively, it contains state.
if (rmp->regprog->re_in_use) {
- EMSG(_(e_recursive));
+ emsg(_(e_recursive));
return false;
}
rmp->regprog->re_in_use = true;
diff --git a/src/nvim/regexp_nfa.c b/src/nvim/regexp_nfa.c
index 0eb061034f..04fb77e6b3 100644
--- a/src/nvim/regexp_nfa.c
+++ b/src/nvim/regexp_nfa.c
@@ -1244,11 +1244,11 @@ static int nfa_regatom(void)
p = vim_strchr(classchars, no_Magic(c));
if (p == NULL) {
if (extra == NFA_ADD_NL) {
- EMSGN(_(e_ill_char_class), c);
+ semsg(_(e_ill_char_class), (int64_t)c);
rc_did_emsg = true;
return FAIL;
}
- IEMSGN("INTERNAL: Unknown character class char: %" PRId64, c);
+ siemsg("INTERNAL: Unknown character class char: %" PRId64, (int64_t)c);
return FAIL;
}
// When '.' is followed by a composing char ignore the dot, so that
@@ -1286,7 +1286,7 @@ static int nfa_regatom(void)
case Magic('|'):
case Magic('&'):
case Magic(')'):
- EMSGN(_(e_misplaced), no_Magic(c)); // -V1037
+ semsg(_(e_misplaced), (int64_t)no_Magic(c)); // -V1037
return FAIL;
case Magic('='):
@@ -1296,7 +1296,7 @@ static int nfa_regatom(void)
case Magic('*'):
case Magic('{'):
// these should follow an atom, not form an atom
- EMSGN(_(e_misplaced), no_Magic(c));
+ semsg(_(e_misplaced), (int64_t)no_Magic(c));
return FAIL;
case Magic('~'):
@@ -1306,7 +1306,7 @@ static int nfa_regatom(void)
// Previous substitute pattern.
// Generated as "\%(pattern\)".
if (reg_prev_sub == NULL) {
- EMSG(_(e_nopresub));
+ emsg(_(e_nopresub));
return FAIL;
}
for (lp = reg_prev_sub; *lp != NUL; MB_CPTR_ADV(lp)) {
@@ -1383,7 +1383,7 @@ static int nfa_regatom(void)
re_has_z = REX_SET;
break;
default:
- emsgf(_("E867: (NFA) Unknown operator '\\z%c'"),
+ semsg(_("E867: (NFA) Unknown operator '\\z%c'"),
no_Magic(c));
return FAIL;
}
@@ -1489,7 +1489,7 @@ static int nfa_regatom(void)
while (ascii_isdigit(c)) {
if (n > (INT32_MAX - (c - '0')) / 10) {
// overflow.
- EMSG(_(e_value_too_large));
+ emsg(_(e_value_too_large));
return FAIL;
}
n = n * 10 + (c - '0');
@@ -1516,7 +1516,7 @@ static int nfa_regatom(void)
limit = INT32_MAX / MB_MAXBYTES;
}
if (n >= limit) {
- EMSG(_(e_value_too_large));
+ emsg(_(e_value_too_large));
return FAIL;
}
EMIT((int)n);
@@ -1529,7 +1529,7 @@ static int nfa_regatom(void)
break;
}
}
- emsgf(_("E867: (NFA) Unknown operator '\\%%%c'"),
+ semsg(_("E867: (NFA) Unknown operator '\\%%%c'"),
no_Magic(c));
return FAIL;
}
@@ -1955,7 +1955,7 @@ static int nfa_regpiece(void)
break;
}
if (i == 0) {
- emsgf(_("E869: (NFA) Unknown operator '\\@%c'"), op);
+ semsg(_("E869: (NFA) Unknown operator '\\@%c'"), op);
return FAIL;
}
EMIT(i);
@@ -2752,7 +2752,7 @@ static void st_error(int *postfix, int *end, int *p)
fclose(df);
}
#endif
- EMSG(_("E874: (NFA) Could not pop the stack!"));
+ emsg(_("E874: (NFA) Could not pop the stack!"));
}
/*
@@ -4103,7 +4103,7 @@ skip_add:
const size_t newsize = newlen * sizeof(nfa_thread_T);
if ((long)(newsize >> 10) >= p_mmp) {
- EMSG(_(e_maxmempat));
+ emsg(_(e_maxmempat));
depth--;
return NULL;
}
@@ -4393,7 +4393,7 @@ static regsubs_T *addstate_here(
const size_t newsize = newlen * sizeof(nfa_thread_T);
if ((long)(newsize >> 10) >= p_mmp) {
- EMSG(_(e_maxmempat));
+ emsg(_(e_maxmempat));
return NULL;
}
nfa_thread_T *const newl = xmalloc(newsize);
@@ -4522,7 +4522,7 @@ static int check_char_class(int class, int c)
default:
// should not be here :P
- IEMSGN(_(e_ill_char_class), class);
+ siemsg(_(e_ill_char_class), (int64_t)class);
return FAIL;
}
return FAIL;
@@ -4799,7 +4799,7 @@ static int recursive_regmatch(
fprintf(log_fd, "MATCH = %s\n", !result ? "false" : "OK");
fprintf(log_fd, "****************************\n");
} else {
- EMSG(_(e_log_open_failed));
+ emsg(_(e_log_open_failed));
log_fd = stderr;
}
#endif
@@ -5081,7 +5081,7 @@ static int nfa_regmatch(nfa_regprog_T *prog, nfa_state_T *start,
FILE *debug = fopen(NFA_REGEXP_DEBUG_LOG, "a");
if (debug == NULL) {
- EMSG2("(NFA) COULD NOT OPEN %s!", NFA_REGEXP_DEBUG_LOG);
+ semsg("(NFA) COULD NOT OPEN %s!", NFA_REGEXP_DEBUG_LOG);
return false;
}
#endif
@@ -5119,7 +5119,7 @@ static int nfa_regmatch(nfa_regprog_T *prog, nfa_state_T *start,
abs(start->id), code);
fprintf(log_fd, "**********************************\n");
} else {
- EMSG(_(e_log_open_failed));
+ emsg(_(e_log_open_failed));
log_fd = stderr;
}
#endif
@@ -6145,7 +6145,7 @@ static int nfa_regmatch(nfa_regprog_T *prog, nfa_state_T *start,
#ifdef REGEXP_DEBUG
if (c < 0) {
- IEMSGN("INTERNAL: Negative state char: %" PRId64, c);
+ siemsg("INTERNAL: Negative state char: %" PRId64, (int64_t)c);
}
#endif
result = (c == curc);
@@ -6427,7 +6427,7 @@ static long nfa_regtry(nfa_regprog_T *prog,
fprintf(f, "\n\n");
fclose(f);
} else {
- EMSG("Could not open temporary log file for writing");
+ emsg("Could not open temporary log file for writing");
}
#endif
@@ -6542,7 +6542,7 @@ static long nfa_regexec_both(char_u *line, colnr_T startcol,
/* Be paranoid... */
if (prog == NULL || line == NULL) {
- IEMSG(_(e_null));
+ iemsg(_(e_null));
goto theend;
}
diff --git a/src/nvim/runtime.c b/src/nvim/runtime.c
index 9ecde88a51..674d807e96 100644
--- a/src/nvim/runtime.c
+++ b/src/nvim/runtime.c
@@ -146,7 +146,7 @@ int do_in_path(char_u *path, char *name, int flags, DoInRuntimepathCB callback,
char *basepath = path == p_rtp ? "runtimepath" : "packpath";
if (flags & DIP_ERR) {
- EMSG3(_(e_dirnotf), basepath, name);
+ semsg(_(e_dirnotf), basepath, name);
} else if (p_verbose > 0) {
verbose_enter();
smsg(_("not found in '%s': \"%s\""), basepath, name);
@@ -268,7 +268,7 @@ int do_in_cached_path(char_u *name, int flags, DoInRuntimepathCB callback, void
if (!did_one && name != NULL) {
if (flags & DIP_ERR) {
- EMSG3(_(e_dirnotf), "runtime path", name);
+ semsg(_(e_dirnotf), "runtime path", name);
} else if (p_verbose > 0) {
verbose_enter();
smsg(_("not found in runtime path: \"%s\""), name);
diff --git a/src/nvim/search.c b/src/nvim/search.c
index c3e6fb816b..c9c75c787e 100644
--- a/src/nvim/search.c
+++ b/src/nvim/search.c
@@ -144,9 +144,9 @@ int search_regcomp(char_u *pat, int pat_save, int pat_use, int options, regmmatc
}
if (spats[i].pat == NULL) { // pattern was never defined
if (pat_use == RE_SUBST) {
- EMSG(_(e_nopresub));
+ emsg(_(e_nopresub));
} else {
- EMSG(_(e_noprevre));
+ emsg(_(e_noprevre));
}
rc_did_emsg = true;
return FAIL;
@@ -577,7 +577,7 @@ int searchit(win_T *win, buf_T *buf, pos_T *pos, pos_T *end_pos, Direction dir,
if (search_regcomp(pat, RE_SEARCH, pat_use,
(options & (SEARCH_HIS + SEARCH_KEEP)), &regmatch) == FAIL) {
if ((options & SEARCH_MSG) && !rc_did_emsg) {
- EMSG2(_("E383: Invalid search string: %s"), mr_pattern);
+ semsg(_("E383: Invalid search string: %s"), mr_pattern);
}
return FAIL;
}
@@ -953,15 +953,15 @@ int searchit(win_T *win, buf_T *buf, pos_T *pos, pos_T *end_pos, Direction dir,
if (!found) { // did not find it
if (got_int) {
- EMSG(_(e_interr));
+ emsg(_(e_interr));
} else if ((options & SEARCH_MSG) == SEARCH_MSG) {
if (p_ws) {
- EMSG2(_(e_patnotf2), mr_pattern);
+ semsg(_(e_patnotf2), mr_pattern);
} else if (lnum == 0) {
- EMSG2(_("E384: search hit TOP without match for: %s"),
+ semsg(_("E384: search hit TOP without match for: %s"),
mr_pattern);
} else {
- EMSG2(_("E385: search hit BOTTOM without match for: %s"),
+ semsg(_("E385: search hit BOTTOM without match for: %s"),
mr_pattern);
}
}
@@ -1115,7 +1115,7 @@ int do_search(oparg_T *oap, int dirc, int search_delim, char_u *pat, long count,
if (spats[RE_SEARCH].pat == NULL) { // no previous pattern
searchstr = spats[RE_SUBST].pat;
if (searchstr == NULL) {
- EMSG(_(e_noprevre));
+ emsg(_(e_noprevre));
retval = 0;
goto end_do_search;
}
@@ -1426,7 +1426,7 @@ int do_search(oparg_T *oap, int dirc, int search_delim, char_u *pat, long count,
search_delim = dirc;
if (dirc != '?' && dirc != '/') {
retval = 0;
- EMSG(_("E386: Expected '?' or '/' after ';'"));
+ emsg(_("E386: Expected '?' or '/' after ';'"));
goto end_do_search;
}
++pat;
@@ -4655,7 +4655,7 @@ void f_searchcount(typval_T *argvars, typval_T *rettv, FunPtr fptr)
bool error = false;
if (argvars[0].v_type != VAR_DICT || argvars[0].vval.v_dict == NULL) {
- EMSG(_(e_dictreq));
+ emsg(_(e_dictreq));
return;
}
dict = argvars[0].vval.v_dict;
@@ -4690,11 +4690,11 @@ void f_searchcount(typval_T *argvars, typval_T *rettv, FunPtr fptr)
di = tv_dict_find(dict, (const char *)"pos", -1);
if (di != NULL) {
if (di->di_tv.v_type != VAR_LIST) {
- EMSG2(_(e_invarg2), "pos");
+ semsg(_(e_invarg2), "pos");
return;
}
if (tv_list_len(di->di_tv.vval.v_list) != 3) {
- EMSG2(_(e_invarg2), "List format should be [lnum, col, off]");
+ semsg(_(e_invarg2), "List format should be [lnum, col, off]");
return;
}
li = tv_list_find(di->di_tv.vval.v_list, 0L);
@@ -5214,7 +5214,7 @@ search_line:
found = true;
if (depth == -1 && lnum == curwin->w_cursor.lnum
&& l_g_do_tagpreview == 0) {
- EMSG(_("E387: Match is on current line"));
+ emsg(_("E387: Match is on current line"));
} else if (action == ACTION_SHOW) {
show_pat_in_path(line, type, did_show, action,
(depth == -1) ? NULL : files[depth].fp,
@@ -5347,11 +5347,11 @@ exit_matched:
} else if (!found
&& action != ACTION_EXPAND) {
if (got_int || compl_interrupted) {
- EMSG(_(e_interr));
+ emsg(_(e_interr));
} else if (type == FIND_DEFINE) {
- EMSG(_("E388: Couldn't find definition"));
+ emsg(_("E388: Couldn't find definition"));
} else {
- EMSG(_("E389: Couldn't find pattern"));
+ emsg(_("E389: Couldn't find pattern"));
}
}
if (action == ACTION_SHOW || action == ACTION_SHOW_ALL) {
diff --git a/src/nvim/shada.c b/src/nvim/shada.c
index 10f93913ad..89f9d3a719 100644
--- a/src/nvim/shada.c
+++ b/src/nvim/shada.c
@@ -713,11 +713,11 @@ static ShaDaReadResult sd_reader_skip(ShaDaReadDef *const sd_reader, const size_
{
if (sd_reader->skip(sd_reader, offset) != OK) {
if (sd_reader->error != NULL) {
- emsgf(_(SERR "System error while skipping in ShaDa file: %s"),
+ semsg(_(SERR "System error while skipping in ShaDa file: %s"),
sd_reader->error);
return kSDReadStatusReadError;
} else if (sd_reader->eof) {
- emsgf(_(RCERR "Error while reading ShaDa file: "
+ semsg(_(RCERR "Error while reading ShaDa file: "
"last entry specified that it occupies %" PRIu64 " bytes, "
"but file ended earlier"),
(uint64_t)offset);
@@ -762,7 +762,7 @@ static void close_file(void *cookie)
{
const int error = file_free(cookie, !!p_fs);
if (error != 0) {
- emsgf(_(SERR "System error while closing ShaDa file: %s"),
+ semsg(_(SERR "System error while closing ShaDa file: %s"),
os_strerror(error));
}
}
@@ -797,7 +797,7 @@ static int msgpack_sd_writer_write(void *data, const char *buf, size_t len)
ShaDaWriteDef *const sd_writer = (ShaDaWriteDef *)data;
ptrdiff_t written_bytes = sd_writer->write(sd_writer, buf, len);
if (written_bytes == -1) {
- emsgf(_(SERR "System error while writing ShaDa file: %s"),
+ semsg(_(SERR "System error while writing ShaDa file: %s"),
sd_writer->error);
return -1;
}
@@ -844,7 +844,7 @@ static int shada_read_file(const char *const file, const int flags)
if (of_ret != 0) {
if (of_ret != UV_ENOENT || (flags & kShaDaMissingError)) {
- emsgf(_(SERR "System error while opening ShaDa file %s for reading: %s"),
+ semsg(_(SERR "System error while opening ShaDa file %s for reading: %s"),
fname, os_strerror(of_ret));
}
xfree(fname);
@@ -1598,7 +1598,7 @@ static ShaDaWriteResult shada_pack_entry(msgpack_packer *const packer, ShadaEntr
if (encode_vim_to_msgpack(spacker, &entry.data.global_var.value, vardesc)
== FAIL) {
ret = kSDWriteIgnError;
- EMSG2(_(WERR "Failed to write variable %s"),
+ semsg(_(WERR "Failed to write variable %s"),
entry.data.global_var.name);
goto shada_pack_entry_error;
}
@@ -1899,7 +1899,7 @@ shada_parse_msgpack_read_next: {}
}
break;
case MSGPACK_UNPACK_PARSE_ERROR:
- emsgf(_(RCERR "Failed to parse ShaDa file due to a msgpack parser error "
+ semsg(_(RCERR "Failed to parse ShaDa file due to a msgpack parser error "
"at position %" PRIu64),
(uint64_t)initial_fpos);
ret = kSDReadStatusNotShaDa;
@@ -1910,18 +1910,18 @@ shada_parse_msgpack_read_next: {}
try_to_free_memory();
goto shada_parse_msgpack_read_next;
}
- EMSG(_(e_outofmem));
+ emsg(_(e_outofmem));
ret = kSDReadStatusReadError;
break;
case MSGPACK_UNPACK_CONTINUE:
- emsgf(_(RCERR "Failed to parse ShaDa file: incomplete msgpack string "
+ semsg(_(RCERR "Failed to parse ShaDa file: incomplete msgpack string "
"at position %" PRIu64),
(uint64_t)initial_fpos);
ret = kSDReadStatusNotShaDa;
break;
case MSGPACK_UNPACK_EXTRA_BYTES:
shada_parse_msgpack_extra_bytes:
- emsgf(_(RCERR "Failed to parse ShaDa file: extra bytes in msgpack string "
+ semsg(_(RCERR "Failed to parse ShaDa file: extra bytes in msgpack string "
"at position %" PRIu64),
(uint64_t)initial_fpos);
ret = kSDReadStatusNotShaDa;
@@ -2949,7 +2949,7 @@ int shada_write_file(const char *const file, bool nomerge)
int error;
if ((error = open_shada_file_for_reading(fname, &sd_reader)) != 0) {
if (error != UV_ENOENT) {
- emsgf(_(SERR "System error while opening ShaDa file %s for reading "
+ semsg(_(SERR "System error while opening ShaDa file %s for reading "
"to merge before writing it: %s"),
fname, os_strerror(error));
// Try writing the file even if opening it emerged any issues besides
@@ -2981,7 +2981,7 @@ shada_write_file_open: {}
if (*wp == 'z') {
// Tried names from .tmp.a to .tmp.z, all failed. Something must be
// wrong then.
- EMSG2(_("E138: All %s.tmp.X files exist, cannot write ShaDa file!"),
+ semsg(_("E138: All %s.tmp.X files exist, cannot write ShaDa file!"),
fname);
xfree(fname);
xfree(tempname);
@@ -2993,7 +2993,7 @@ shada_write_file_open: {}
goto shada_write_file_open;
}
} else {
- emsgf(_(SERR "System error while opening temporary ShaDa file %s "
+ semsg(_(SERR "System error while opening temporary ShaDa file %s "
"for writing: %s"), tempname, os_strerror(error));
}
}
@@ -3008,7 +3008,7 @@ shada_write_file_nomerge: {}
int ret;
char *failed_dir;
if ((ret = os_mkdir_recurse(fname, 0700, &failed_dir)) != 0) {
- EMSG3(_(SERR "Failed to create directory %s "
+ semsg(_(SERR "Failed to create directory %s "
"for writing ShaDa file: %s"),
failed_dir, os_strerror(ret));
xfree(fname);
@@ -3022,7 +3022,7 @@ shada_write_file_nomerge: {}
sd_writer.cookie = file_open_new(&error, fname, kFileCreate|kFileTruncate,
0600);
if (sd_writer.cookie == NULL) {
- emsgf(_(SERR "System error while opening ShaDa file %s for writing: %s"),
+ semsg(_(SERR "System error while opening ShaDa file %s for writing: %s"),
fname, os_strerror(error));
}
}
@@ -3064,7 +3064,7 @@ shada_write_file_nomerge: {}
const int fchown_ret = os_fchown(file_fd(sd_writer.cookie),
old_uid, old_gid);
if (fchown_ret != 0) {
- EMSG3(_(RNERR "Failed setting uid and gid for file %s: %s"),
+ semsg(_(RNERR "Failed setting uid and gid for file %s: %s"),
tempname, os_strerror(fchown_ret));
goto shada_write_file_did_not_remove;
}
@@ -3074,13 +3074,13 @@ shada_write_file_nomerge: {}
: (old_info.stat.st_gid == getgid()
? (old_info.stat.st_mode & 0020)
: (old_info.stat.st_mode & 0002)))) {
- EMSG2(_("E137: ShaDa file is not writable: %s"), fname);
+ semsg(_("E137: ShaDa file is not writable: %s"), fname);
goto shada_write_file_did_not_remove;
}
}
#endif
if (vim_rename((char_u *)tempname, (char_u *)fname) == -1) {
- EMSG3(_(RNERR "Can't rename ShaDa file from %s to %s!"),
+ semsg(_(RNERR "Can't rename ShaDa file from %s to %s!"),
tempname, fname);
} else {
did_remove = true;
@@ -3088,10 +3088,10 @@ shada_write_file_nomerge: {}
}
} else {
if (sw_ret == kSDWriteReadNotShada) {
- EMSG3(_(RNERR "Did not rename %s because %s "
+ semsg(_(RNERR "Did not rename %s because %s "
"does not look like a ShaDa file"), tempname, fname);
} else {
- EMSG3(_(RNERR "Did not rename %s to %s because there were errors "
+ semsg(_(RNERR "Did not rename %s to %s because there were errors "
"during writing it"), tempname, fname);
}
}
@@ -3099,7 +3099,7 @@ shada_write_file_nomerge: {}
#ifdef UNIX
shada_write_file_did_not_remove:
#endif
- EMSG3(_(RNERR "Do not forget to remove %s or rename it manually to %s."),
+ semsg(_(RNERR "Do not forget to remove %s or rename it manually to %s."),
tempname, fname);
}
xfree(tempname);
@@ -3225,11 +3225,11 @@ static ShaDaReadResult fread_len(ShaDaReadDef *const sd_reader, char *const buff
if (read_bytes != (ptrdiff_t)length) {
if (sd_reader->error != NULL) {
- emsgf(_(SERR "System error while reading ShaDa file: %s"),
+ semsg(_(SERR "System error while reading ShaDa file: %s"),
sd_reader->error);
return kSDReadStatusReadError;
} else {
- emsgf(_(RCERR "Error while reading ShaDa file: "
+ semsg(_(RCERR "Error while reading ShaDa file: "
"last entry specified that it occupies %" PRIu64 " bytes, "
"but file ended earlier"),
(uint64_t)length);
@@ -3263,11 +3263,11 @@ static ShaDaReadResult msgpack_read_uint64(ShaDaReadDef *const sd_reader, const
if (first_char == EOF) {
if (sd_reader->error) {
- emsgf(_(SERR "System error while reading integer from ShaDa file: %s"),
+ semsg(_(SERR "System error while reading integer from ShaDa file: %s"),
sd_reader->error);
return kSDReadStatusReadError;
} else if (sd_reader->eof) {
- emsgf(_(RCERR "Error while reading ShaDa file: "
+ semsg(_(RCERR "Error while reading ShaDa file: "
"expected positive integer at position %" PRIu64
", but got nothing"),
(uint64_t)fpos);
@@ -3294,7 +3294,7 @@ static ShaDaReadResult msgpack_read_uint64(ShaDaReadDef *const sd_reader, const
length = 8;
break;
default:
- emsgf(_(RCERR "Error while reading ShaDa file: "
+ semsg(_(RCERR "Error while reading ShaDa file: "
"expected positive integer at position %" PRIu64),
(uint64_t)fpos);
return kSDReadStatusNotShaDa;
@@ -3334,18 +3334,18 @@ static ShaDaReadResult msgpack_read_uint64(ShaDaReadDef *const sd_reader, const
proc) \
do { \
if (!(condition)) { \
- emsgf(_(READERR(entry_name, error_desc)), initial_fpos); \
+ semsg(_(READERR(entry_name, error_desc)), initial_fpos); \
CLEAR_GA_AND_ERROR_OUT(ad_ga); \
} \
tgt = proc(obj.via.attr); \
} while (0)
#define CHECK_KEY_IS_STR(un, entry_name) \
if (un.data.via.map.ptr[i].key.type != MSGPACK_OBJECT_STR) { \
- emsgf(_(READERR(entry_name, "has key which is not a string")), \
+ semsg(_(READERR(entry_name, "has key which is not a string")), \
initial_fpos); \
CLEAR_GA_AND_ERROR_OUT(ad_ga); \
} else if (un.data.via.map.ptr[i].key.via.str.size == 0) { \
- emsgf(_(READERR(entry_name, "has empty key")), initial_fpos); \
+ semsg(_(READERR(entry_name, "has empty key")), initial_fpos); \
CLEAR_GA_AND_ERROR_OUT(ad_ga); \
}
#define CHECKED_KEY(un, entry_name, name, error_desc, tgt, condition, attr, \
@@ -3403,7 +3403,7 @@ static ShaDaReadResult msgpack_read_uint64(ShaDaReadDef *const sd_reader, const
typval_T adtv; \
if (msgpack_to_vim(obj, &adtv) == FAIL \
|| adtv.v_type != VAR_DICT) { \
- emsgf(_(READERR(name, \
+ semsg(_(READERR(name, \
"cannot be converted to a VimL dictionary")), \
initial_fpos); \
ga_clear(&ad_ga); \
@@ -3428,7 +3428,7 @@ static ShaDaReadResult msgpack_read_uint64(ShaDaReadDef *const sd_reader, const
}; \
typval_T aetv; \
if (msgpack_to_vim(obj, &aetv) == FAIL) { \
- emsgf(_(READERR(name, "cannot be converted to a VimL list")), \
+ semsg(_(READERR(name, "cannot be converted to a VimL list")), \
initial_fpos); \
tv_clear(&aetv); \
goto shada_read_next_item_error; \
@@ -3488,7 +3488,7 @@ shada_read_next_item_start:
}
if (length_u64 > PTRDIFF_MAX) {
- emsgf(_(RCERR "Error while reading ShaDa file: "
+ semsg(_(RCERR "Error while reading ShaDa file: "
"there is an item at position %" PRIu64 " "
"that is stated to be too long"),
initial_fpos);
@@ -3502,7 +3502,7 @@ shada_read_next_item_start:
// kSDItemUnknown cannot possibly pass that far because it is -1 and that
// will fail in msgpack_read_uint64. But kSDItemMissing may and it will
// otherwise be skipped because (1 << 0) will never appear in flags.
- emsgf(_(RCERR "Error while reading ShaDa file: "
+ semsg(_(RCERR "Error while reading ShaDa file: "
"there is an item at position %" PRIu64 " "
"that must not be there: Missing items are "
"for internal uses only"),
@@ -3572,13 +3572,13 @@ shada_read_next_item_start:
switch ((ShadaEntryType)type_u64) {
case kSDItemHeader:
if (!msgpack_rpc_to_dictionary(&(unpacked.data), &(entry->data.header))) {
- emsgf(_(READERR("header", "is not a dictionary")), initial_fpos);
+ semsg(_(READERR("header", "is not a dictionary")), initial_fpos);
goto shada_read_next_item_error;
}
break;
case kSDItemSearchPattern: {
if (unpacked.data.type != MSGPACK_OBJECT_MAP) {
- emsgf(_(READERR("search pattern", "is not a dictionary")),
+ semsg(_(READERR("search pattern", "is not a dictionary")),
initial_fpos);
goto shada_read_next_item_error;
}
@@ -3610,7 +3610,7 @@ shada_read_next_item_start:
ADDITIONAL_KEY(unpacked)
}
if (entry->data.search_pattern.pat == NULL) {
- emsgf(_(READERR("search pattern", "has no pattern")), initial_fpos);
+ semsg(_(READERR("search pattern", "has no pattern")), initial_fpos);
CLEAR_GA_AND_ERROR_OUT(ad_ga);
}
SET_ADDITIONAL_DATA(entry->data.search_pattern.additional_data,
@@ -3622,7 +3622,7 @@ shada_read_next_item_start:
case kSDItemGlobalMark:
case kSDItemLocalMark: {
if (unpacked.data.type != MSGPACK_OBJECT_MAP) {
- emsgf(_(READERR("mark", "is not a dictionary")), initial_fpos);
+ semsg(_(READERR("mark", "is not a dictionary")), initial_fpos);
goto shada_read_next_item_error;
}
garray_T ad_ga;
@@ -3631,7 +3631,7 @@ shada_read_next_item_start:
CHECK_KEY_IS_STR(unpacked, "mark")
if (CHECK_KEY(unpacked.data.via.map.ptr[i].key, KEY_NAME_CHAR)) {
if (type_u64 == kSDItemJump || type_u64 == kSDItemChange) {
- emsgf(_(READERR("mark", "has n key which is only valid for "
+ semsg(_(READERR("mark", "has n key which is only valid for "
"local and global mark entries")), initial_fpos);
CLEAR_GA_AND_ERROR_OUT(ad_ga);
}
@@ -3647,15 +3647,15 @@ shada_read_next_item_start:
ADDITIONAL_KEY(unpacked)
}
if (entry->data.filemark.fname == NULL) {
- emsgf(_(READERR("mark", "is missing file name")), initial_fpos);
+ semsg(_(READERR("mark", "is missing file name")), initial_fpos);
CLEAR_GA_AND_ERROR_OUT(ad_ga);
}
if (entry->data.filemark.mark.lnum <= 0) {
- emsgf(_(READERR("mark", "has invalid line number")), initial_fpos);
+ semsg(_(READERR("mark", "has invalid line number")), initial_fpos);
CLEAR_GA_AND_ERROR_OUT(ad_ga);
}
if (entry->data.filemark.mark.col < 0) {
- emsgf(_(READERR("mark", "has invalid column number")), initial_fpos);
+ semsg(_(READERR("mark", "has invalid column number")), initial_fpos);
CLEAR_GA_AND_ERROR_OUT(ad_ga);
}
SET_ADDITIONAL_DATA(entry->data.filemark.additional_data, "mark");
@@ -3663,7 +3663,7 @@ shada_read_next_item_start:
}
case kSDItemRegister: {
if (unpacked.data.type != MSGPACK_OBJECT_MAP) {
- emsgf(_(READERR("register", "is not a dictionary")), initial_fpos);
+ semsg(_(READERR("register", "is not a dictionary")), initial_fpos);
goto shada_read_next_item_error;
}
garray_T ad_ga;
@@ -3673,14 +3673,14 @@ shada_read_next_item_start:
if (CHECK_KEY(unpacked.data.via.map.ptr[i].key,
REG_KEY_CONTENTS)) {
if (unpacked.data.via.map.ptr[i].val.type != MSGPACK_OBJECT_ARRAY) {
- emsgf(_(READERR("register",
+ semsg(_(READERR("register",
"has " REG_KEY_CONTENTS
" key with non-array value")),
initial_fpos);
CLEAR_GA_AND_ERROR_OUT(ad_ga);
}
if (unpacked.data.via.map.ptr[i].val.via.array.size == 0) {
- emsgf(_(READERR("register",
+ semsg(_(READERR("register",
"has " REG_KEY_CONTENTS " key with empty array")),
initial_fpos);
CLEAR_GA_AND_ERROR_OUT(ad_ga);
@@ -3689,7 +3689,7 @@ shada_read_next_item_start:
unpacked.data.via.map.ptr[i].val.via.array;
for (size_t j = 0; j < arr.size; j++) {
if (arr.ptr[j].type != MSGPACK_OBJECT_BIN) {
- emsgf(_(READERR("register", "has " REG_KEY_CONTENTS " array "
+ semsg(_(READERR("register", "has " REG_KEY_CONTENTS " array "
"with non-binary value")), initial_fpos);
CLEAR_GA_AND_ERROR_OUT(ad_ga);
}
@@ -3711,7 +3711,7 @@ shada_read_next_item_start:
ADDITIONAL_KEY(unpacked)
}
if (entry->data.reg.contents == NULL) {
- emsgf(_(READERR("register", "has missing " REG_KEY_CONTENTS " array")),
+ semsg(_(READERR("register", "has missing " REG_KEY_CONTENTS " array")),
initial_fpos);
CLEAR_GA_AND_ERROR_OUT(ad_ga);
}
@@ -3720,29 +3720,29 @@ shada_read_next_item_start:
}
case kSDItemHistoryEntry: {
if (unpacked.data.type != MSGPACK_OBJECT_ARRAY) {
- emsgf(_(READERR("history", "is not an array")), initial_fpos);
+ semsg(_(READERR("history", "is not an array")), initial_fpos);
goto shada_read_next_item_error;
}
if (unpacked.data.via.array.size < 2) {
- emsgf(_(READERR("history", "does not have enough elements")),
+ semsg(_(READERR("history", "does not have enough elements")),
initial_fpos);
goto shada_read_next_item_error;
}
if (unpacked.data.via.array.ptr[0].type
!= MSGPACK_OBJECT_POSITIVE_INTEGER) {
- emsgf(_(READERR("history", "has wrong history type type")),
+ semsg(_(READERR("history", "has wrong history type type")),
initial_fpos);
goto shada_read_next_item_error;
}
if (unpacked.data.via.array.ptr[1].type
!= MSGPACK_OBJECT_BIN) {
- emsgf(_(READERR("history", "has wrong history string type")),
+ semsg(_(READERR("history", "has wrong history string type")),
initial_fpos);
goto shada_read_next_item_error;
}
if (memchr(unpacked.data.via.array.ptr[1].via.bin.ptr, 0,
unpacked.data.via.array.ptr[1].via.bin.size) != NULL) {
- emsgf(_(READERR("history", "contains string with zero byte inside")),
+ semsg(_(READERR("history", "contains string with zero byte inside")),
initial_fpos);
goto shada_read_next_item_error;
}
@@ -3752,13 +3752,13 @@ shada_read_next_item_start:
entry->data.history_item.histtype == HIST_SEARCH;
if (is_hist_search) {
if (unpacked.data.via.array.size < 3) {
- emsgf(_(READERR("search history",
+ semsg(_(READERR("search history",
"does not have separator character")), initial_fpos);
goto shada_read_next_item_error;
}
if (unpacked.data.via.array.ptr[2].type
!= MSGPACK_OBJECT_POSITIVE_INTEGER) {
- emsgf(_(READERR("search history",
+ semsg(_(READERR("search history",
"has wrong history separator type")), initial_fpos);
goto shada_read_next_item_error;
}
@@ -3784,16 +3784,16 @@ shada_read_next_item_start:
}
case kSDItemVariable: {
if (unpacked.data.type != MSGPACK_OBJECT_ARRAY) {
- emsgf(_(READERR("variable", "is not an array")), initial_fpos);
+ semsg(_(READERR("variable", "is not an array")), initial_fpos);
goto shada_read_next_item_error;
}
if (unpacked.data.via.array.size < 2) {
- emsgf(_(READERR("variable", "does not have enough elements")),
+ semsg(_(READERR("variable", "does not have enough elements")),
initial_fpos);
goto shada_read_next_item_error;
}
if (unpacked.data.via.array.ptr[0].type != MSGPACK_OBJECT_BIN) {
- emsgf(_(READERR("variable", "has wrong variable name type")),
+ semsg(_(READERR("variable", "has wrong variable name type")),
initial_fpos);
goto shada_read_next_item_error;
}
@@ -3813,7 +3813,7 @@ shada_read_next_item_start:
const typval_T *type_tv = TV_LIST_ITEM_TV(type_item);
if (type_tv->v_type != VAR_NUMBER
|| type_tv->vval.v_number != VAR_TYPE_BLOB) {
- emsgf(_(READERR("variable", "has wrong variable type")),
+ semsg(_(READERR("variable", "has wrong variable type")),
initial_fpos);
goto shada_read_next_item_error;
}
@@ -3828,7 +3828,7 @@ shada_read_next_item_start:
tv_blob_set_ret(&entry->data.global_var.value, blob);
} else if (msgpack_to_vim(unpacked.data.via.array.ptr[1],
&(entry->data.global_var.value)) == FAIL) {
- emsgf(_(READERR("variable", "has value that cannot "
+ semsg(_(READERR("variable", "has value that cannot "
"be converted to the VimL value")), initial_fpos);
goto shada_read_next_item_error;
}
@@ -3836,16 +3836,16 @@ shada_read_next_item_start:
}
case kSDItemSubString:
if (unpacked.data.type != MSGPACK_OBJECT_ARRAY) {
- emsgf(_(READERR("sub string", "is not an array")), initial_fpos);
+ semsg(_(READERR("sub string", "is not an array")), initial_fpos);
goto shada_read_next_item_error;
}
if (unpacked.data.via.array.size < 1) {
- emsgf(_(READERR("sub string", "does not have enough elements")),
+ semsg(_(READERR("sub string", "does not have enough elements")),
initial_fpos);
goto shada_read_next_item_error;
}
if (unpacked.data.via.array.ptr[0].type != MSGPACK_OBJECT_BIN) {
- emsgf(_(READERR("sub string", "has wrong sub string type")),
+ semsg(_(READERR("sub string", "has wrong sub string type")),
initial_fpos);
goto shada_read_next_item_error;
}
@@ -3857,7 +3857,7 @@ shada_read_next_item_start:
break;
case kSDItemBufferList:
if (unpacked.data.type != MSGPACK_OBJECT_ARRAY) {
- emsgf(_(READERR("buffer list", "is not an array")), initial_fpos);
+ semsg(_(READERR("buffer list", "is not an array")), initial_fpos);
goto shada_read_next_item_error;
}
if (unpacked.data.via.array.size == 0) {
@@ -3873,7 +3873,7 @@ shada_read_next_item_start:
};
{
if (unpacked_2.data.type != MSGPACK_OBJECT_MAP) {
- emsgf(_(RERR "Error while reading ShaDa file: "
+ semsg(_(RERR "Error while reading ShaDa file: "
"buffer list at position %" PRIu64 " "
"contains entry that is not a dictionary"),
initial_fpos);
@@ -3900,21 +3900,21 @@ shada_read_next_item_start:
i = j; // XXX: Restore `i`.
}
if (entry->data.buffer_list.buffers[i].pos.lnum <= 0) {
- emsgf(_(RERR "Error while reading ShaDa file: "
+ semsg(_(RERR "Error while reading ShaDa file: "
"buffer list at position %" PRIu64 " "
"contains entry with invalid line number"),
initial_fpos);
CLEAR_GA_AND_ERROR_OUT(ad_ga);
}
if (entry->data.buffer_list.buffers[i].pos.col < 0) {
- emsgf(_(RERR "Error while reading ShaDa file: "
+ semsg(_(RERR "Error while reading ShaDa file: "
"buffer list at position %" PRIu64 " "
"contains entry with invalid column number"),
initial_fpos);
CLEAR_GA_AND_ERROR_OUT(ad_ga);
}
if (entry->data.buffer_list.buffers[i].fname == NULL) {
- emsgf(_(RERR "Error while reading ShaDa file: "
+ semsg(_(RERR "Error while reading ShaDa file: "
"buffer list at position %" PRIu64 " "
"contains entry that does not have a file name"),
initial_fpos);
@@ -4014,7 +4014,7 @@ static inline size_t shada_init_jumps(PossiblyFreedShadaEntry *jumps,
jump_iter = mark_jumplist_iter(jump_iter, curwin, &fm);
if (fm.fmark.mark.lnum == 0) {
- iemsgf("ShaDa: mark lnum zero (ji:%p, js:%p, len:%i)",
+ siemsg("ShaDa: mark lnum zero (ji:%p, js:%p, len:%i)",
(void *)jump_iter, (void *)&curwin->w_jumplist[0],
curwin->w_jumplistlen);
continue;
diff --git a/src/nvim/sign.c b/src/nvim/sign.c
index bbc4d6a764..1c28c0b218 100644
--- a/src/nvim/sign.c
+++ b/src/nvim/sign.c
@@ -824,7 +824,7 @@ static sign_T *alloc_new_sign(char_u *name)
}
if (next_sign_typenr == start) {
xfree(sp);
- EMSG(_("E612: Too many signs defined"));
+ emsg(_("E612: Too many signs defined"));
return NULL;
}
lp = first_sign; // start all over
@@ -878,7 +878,7 @@ static int sign_define_init_text(sign_T *sp, char_u *text)
}
// Currently must be empty, one or two display cells
if (s != endp || cells > 2) {
- EMSG2(_("E239: Invalid sign text: %s"), text);
+ semsg(_("E239: Invalid sign text: %s"), text);
return FAIL;
}
if (cells < 1) {
@@ -961,7 +961,7 @@ int sign_undefine_by_name(const char_u *name)
sp = sign_find(name, &sp_prev);
if (sp == NULL) {
- EMSG2(_("E155: Unknown sign: %s"), name);
+ semsg(_("E155: Unknown sign: %s"), name);
return FAIL;
}
sign_undefine(sp, sp_prev);
@@ -989,7 +989,7 @@ static void sign_list_by_name(char_u *name)
if (sp != NULL) {
sign_list_defined(sp);
} else {
- EMSG2(_("E155: Unknown sign: %s"), name);
+ semsg(_("E155: Unknown sign: %s"), name);
}
}
@@ -1011,7 +1011,7 @@ int sign_place(int *sign_id, const char_u *sign_group, const char_u *sign_name,
}
}
if (sp == NULL) {
- EMSG2(_("E155: Unknown sign: %s"), sign_name);
+ semsg(_("E155: Unknown sign: %s"), sign_name);
return FAIL;
}
if (*sign_id == 0) {
@@ -1040,7 +1040,7 @@ int sign_place(int *sign_id, const char_u *sign_group, const char_u *sign_name,
// number column is less than 2, then force recomputing the width.
may_force_numberwidth_recompute(buf, false);
} else {
- EMSG2(_("E885: Not possible to change sign %s"), sign_name);
+ semsg(_("E885: Not possible to change sign %s"), sign_name);
return FAIL;
}
@@ -1087,7 +1087,7 @@ static void sign_unplace_at_cursor(char_u *groupname)
if (id > 0) {
sign_unplace(id, groupname, curwin->w_buffer, curwin->w_cursor.lnum);
} else {
- EMSG(_("E159: Missing sign number"));
+ emsg(_("E159: Missing sign number"));
}
}
@@ -1097,7 +1097,7 @@ linenr_T sign_jump(int sign_id, char_u *sign_group, buf_T *buf)
linenr_T lnum;
if ((lnum = buf_findsign(buf, sign_id, sign_group)) <= 0) {
- EMSGN(_("E157: Invalid sign ID: %" PRId64), sign_id);
+ semsg(_("E157: Invalid sign ID: %" PRId64), (int64_t)sign_id);
return -1;
}
@@ -1108,7 +1108,7 @@ linenr_T sign_jump(int sign_id, char_u *sign_group, buf_T *buf)
beginline(BL_WHITE);
} else { // ... not currently in a window
if (buf->b_fname == NULL) {
- EMSG(_("E934: Cannot jump to a buffer that does not have a name"));
+ emsg(_("E934: Cannot jump to a buffer that does not have a name"));
return -1;
}
size_t cmdlen = STRLEN(buf->b_fname) + 24;
@@ -1159,7 +1159,7 @@ static void sign_define_cmd(char_u *sign_name, char_u *cmdline)
arg += 6;
numhl = vim_strnsave(arg, (size_t)(p - arg));
} else {
- EMSG2(_(e_invarg2), arg);
+ semsg(_(e_invarg2), arg);
failed = true;
break;
}
@@ -1193,7 +1193,7 @@ static void sign_place_cmd(buf_T *buf, linenr_T lnum, char_u *sign_name, int id,
// :sign place group=*
if (lnum >= 0 || sign_name != NULL
|| (group != NULL && *group == '\0')) {
- EMSG(_(e_invarg));
+ emsg(_(e_invarg));
} else {
sign_list_placed(buf, group);
}
@@ -1201,7 +1201,7 @@ static void sign_place_cmd(buf_T *buf, linenr_T lnum, char_u *sign_name, int id,
// Place a new sign
if (sign_name == NULL || buf == NULL
|| (group != NULL && *group == '\0')) {
- EMSG(_(e_invarg));
+ emsg(_(e_invarg));
return;
}
@@ -1213,7 +1213,7 @@ static void sign_place_cmd(buf_T *buf, linenr_T lnum, char_u *sign_name, int id,
static void sign_unplace_cmd(buf_T *buf, linenr_T lnum, char_u *sign_name, int id, char_u *group)
{
if (lnum >= 0 || sign_name != NULL || (group != NULL && *group == '\0')) {
- EMSG(_(e_invarg));
+ emsg(_(e_invarg));
return;
}
@@ -1270,7 +1270,7 @@ static void sign_unplace_cmd(buf_T *buf, linenr_T lnum, char_u *sign_name, int i
static void sign_jump_cmd(buf_T *buf, linenr_T lnum, char_u *sign_name, int id, char_u *group)
{
if (sign_name == NULL && group == NULL && id == -1) {
- EMSG(_(e_argreq));
+ emsg(_(e_argreq));
return;
}
@@ -1278,7 +1278,7 @@ static void sign_jump_cmd(buf_T *buf, linenr_T lnum, char_u *sign_name, int id,
|| lnum >= 0 || sign_name != NULL) {
// File or buffer is not specified or an empty group is used
// or a line number or a sign name is specified.
- EMSG(_(e_invarg));
+ emsg(_(e_invarg));
return;
}
@@ -1317,7 +1317,7 @@ static int parse_sign_cmd_args(int cmd, char_u *arg, char_u **sign_name, int *si
lnum_arg = true;
} else if (STRNCMP(arg, "*", 1) == 0 && cmd == SIGNCMD_UNPLACE) {
if (*signid != -1) {
- EMSG(_(e_invarg));
+ emsg(_(e_invarg));
return FAIL;
}
*signid = -2;
@@ -1354,18 +1354,18 @@ static int parse_sign_cmd_args(int cmd, char_u *arg, char_u **sign_name, int *si
filename = arg;
*buf = buflist_findnr(getdigits_int(&arg, true, 0));
if (*skipwhite(arg) != NUL) {
- EMSG(_(e_trailing));
+ emsg(_(e_trailing));
}
break;
} else {
- EMSG(_(e_invarg));
+ emsg(_(e_invarg));
return FAIL;
}
arg = skipwhite(arg);
}
if (filename != NULL && *buf == NULL) {
- EMSG2(_("E158: Invalid buffer name: %s"), filename);
+ semsg(_("E158: Invalid buffer name: %s"), filename);
return FAIL;
}
@@ -1390,7 +1390,7 @@ void ex_sign(exarg_T *eap)
p = skiptowhite(arg);
idx = sign_cmd_idx(arg, p);
if (idx == SIGNCMD_LAST) {
- EMSG2(_("E160: Unknown sign command: %s"), arg);
+ semsg(_("E160: Unknown sign command: %s"), arg);
return;
}
arg = skipwhite(p);
@@ -1403,7 +1403,7 @@ void ex_sign(exarg_T *eap)
sign_list_defined(sp);
}
} else if (*arg == NUL) {
- EMSG(_("E156: Missing sign name"));
+ emsg(_("E156: Missing sign name"));
} else {
char_u *name;
@@ -1897,7 +1897,7 @@ void sign_define_multiple(list_T *l, list_T *retlist)
if (TV_LIST_ITEM_TV(li)->v_type == VAR_DICT) {
retval = sign_define_from_dict(NULL, TV_LIST_ITEM_TV(li)->vval.v_dict);
} else {
- EMSG(_(e_dictreq));
+ emsg(_(e_dictreq));
}
tv_list_append_number(retlist, retval);
});
@@ -1933,7 +1933,7 @@ int sign_place_from_dict(typval_T *id_tv, typval_T *group_tv, typval_T *name_tv,
return -1;
}
if (sign_id < 0) {
- EMSG(_(e_invarg));
+ emsg(_(e_invarg));
return -1;
}
}
@@ -1994,7 +1994,7 @@ int sign_place_from_dict(typval_T *id_tv, typval_T *group_tv, typval_T *name_tv,
if (di != NULL) {
lnum = tv_get_lnum(&di->di_tv);
if (lnum <= 0) {
- EMSG(_(e_invarg));
+ emsg(_(e_invarg));
goto cleanup;
}
}
@@ -2068,7 +2068,7 @@ int sign_unplace_from_dict(typval_T *group_tv, dict_T *dict)
if (tv_dict_find(dict, "id", -1) != NULL) {
sign_id = (int)tv_dict_get_number(dict, "id");
if (sign_id <= 0) {
- EMSG(_(e_invarg));
+ emsg(_(e_invarg));
goto cleanup;
}
}
diff --git a/src/nvim/spell.c b/src/nvim/spell.c
index 4fec82f46b..4f1a296ac4 100644
--- a/src/nvim/spell.c
+++ b/src/nvim/spell.c
@@ -634,7 +634,7 @@ static void find_word(matchinf_T *mip, int mode)
if (byts[arridx] == 0) {
if (endidxcnt == MAXWLEN) {
// Must be a corrupted spell file.
- EMSG(_(e_format));
+ emsg(_(e_format));
return;
}
endlen[endidxcnt] = wlen;
@@ -1386,7 +1386,7 @@ static bool no_spell_checking(win_T *wp)
{
if (!wp->w_p_spell || *wp->w_s->b_p_spl == NUL
|| GA_EMPTY(&wp->w_s->b_langp)) {
- EMSG(_(e_no_spell));
+ emsg(_(e_no_spell));
return true;
}
return false;
@@ -2038,7 +2038,7 @@ static int count_syllables(slang_T *slang, const char_u *word)
// Parse 'spelllang' and set w_s->b_langp accordingly.
// Returns NULL if it's OK, an error message otherwise.
-char_u *did_set_spelllang(win_T *wp)
+char *did_set_spelllang(win_T *wp)
{
garray_T ga;
char_u *splp;
@@ -2059,7 +2059,7 @@ char_u *did_set_spelllang(win_T *wp)
bool nobreak = false;
langp_T *lp, *lp2;
static bool recursive = false;
- char_u *ret_msg = NULL;
+ char *ret_msg = NULL;
char_u *spl_copy;
bufref_T bufref;
@@ -2157,8 +2157,7 @@ char_u *did_set_spelllang(win_T *wp)
// SpellFileMissing autocommands may do anything, including
// 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;
}
}
@@ -2872,7 +2871,7 @@ void spell_suggest(int count)
}
if (*curwin->w_s->b_p_spl == NUL) {
- EMSG(_(e_no_spell));
+ emsg(_(e_no_spell));
return;
}
@@ -3151,7 +3150,7 @@ void ex_spellrepall(exarg_T *eap)
linenr_T prev_lnum = 0;
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));
@@ -3195,7 +3194,7 @@ void ex_spellrepall(exarg_T *eap)
xfree(frompat);
if (sub_nsubs == 0) {
- EMSG2(_("E753: Not found: %s"), repl_from);
+ semsg(_("E753: Not found: %s"), repl_from);
} else {
do_sub_msg(false);
}
@@ -3406,7 +3405,7 @@ static void spell_suggest_file(suginfo_T *su, char_u *fname)
// Open the file.
fd = os_fopen((char *)fname, "r");
if (fd == NULL) {
- EMSG2(_(e_notopen), fname);
+ semsg(_(e_notopen), fname);
return;
}
diff --git a/src/nvim/spellfile.c b/src/nvim/spellfile.c
index d041f2710c..86e426217d 100644
--- a/src/nvim/spellfile.c
+++ b/src/nvim/spellfile.c
@@ -584,7 +584,7 @@ slang_T *spell_load_file(char_u *fname, char_u *lang, slang_T *old_lp, bool sile
fd = os_fopen((char *)fname, "r");
if (fd == NULL) {
if (!silent) {
- EMSG2(_(e_notopen), fname);
+ semsg(_(e_notopen), fname);
} else if (p_verbose > 2) {
verbose_enter();
smsg((char *)e_notopen, fname);
@@ -619,10 +619,10 @@ slang_T *spell_load_file(char_u *fname, char_u *lang, slang_T *old_lp, bool sile
switch (scms_ret) {
case SP_FORMERROR:
case SP_TRUNCERROR:
- emsgf("%s", _("E757: This does not look like a spell file"));
+ semsg("%s", _("E757: This does not look like a spell file"));
goto endFAIL;
case SP_OTHERERROR:
- emsgf(_("E5042: Failed to read spell file %s: %s"),
+ semsg(_("E5042: Failed to read spell file %s: %s"),
fname, strerror(ferror(fd)));
goto endFAIL;
case 0:
@@ -630,10 +630,10 @@ slang_T *spell_load_file(char_u *fname, char_u *lang, slang_T *old_lp, bool sile
}
c = getc(fd); // <versionnr>
if (c < VIMSPELLVERSION) {
- EMSG(_("E771: Old spell file, needs to be updated"));
+ emsg(_("E771: Old spell file, needs to be updated"));
goto endFAIL;
} else if (c > VIMSPELLVERSION) {
- EMSG(_("E772: Spell file is for newer version of Vim"));
+ emsg(_("E772: Spell file is for newer version of Vim"));
goto endFAIL;
}
@@ -742,7 +742,7 @@ slang_T *spell_load_file(char_u *fname, char_u *lang, slang_T *old_lp, bool sile
// Unsupported section. When it's required give an error
// message. When it's not required skip the contents.
if (c & SNF_REQUIRED) {
- EMSG(_("E770: Unsupported section in spell file"));
+ emsg(_("E770: Unsupported section in spell file"));
goto endFAIL;
}
while (--len >= 0) {
@@ -754,12 +754,12 @@ slang_T *spell_load_file(char_u *fname, char_u *lang, slang_T *old_lp, bool sile
}
someerror:
if (res == SP_FORMERROR) {
- EMSG(_(e_format));
+ emsg(_(e_format));
goto endFAIL;
}
if (res == SP_TRUNCERROR) {
truncerr:
- EMSG(_(e_spell_trunc));
+ emsg(_(e_spell_trunc));
goto endFAIL;
}
if (res == SP_OTHERERROR) {
@@ -907,17 +907,17 @@ void suggest_load_files(void)
buf[i] = getc(fd); // <fileID>
}
if (STRNCMP(buf, VIMSUGMAGIC, VIMSUGMAGICL) != 0) {
- EMSG2(_("E778: This does not look like a .sug file: %s"),
+ semsg(_("E778: This does not look like a .sug file: %s"),
slang->sl_fname);
goto nextone;
}
c = getc(fd); // <versionnr>
if (c < VIMSUGVERSION) {
- EMSG2(_("E779: Old .sug file, needs to be updated: %s"),
+ semsg(_("E779: Old .sug file, needs to be updated: %s"),
slang->sl_fname);
goto nextone;
} else if (c > VIMSUGVERSION) {
- EMSG2(_("E780: .sug file is for newer version of Vim: %s"),
+ semsg(_("E780: .sug file is for newer version of Vim: %s"),
slang->sl_fname);
goto nextone;
}
@@ -926,7 +926,7 @@ void suggest_load_files(void)
// the .spl file. Otherwise the word numbers won't match.
timestamp = get8ctime(fd); // <timestamp>
if (timestamp != slang->sl_sugtime) {
- EMSG2(_("E781: .sug file doesn't match .spl file: %s"),
+ semsg(_("E781: .sug file doesn't match .spl file: %s"),
slang->sl_fname);
goto nextone;
}
@@ -936,7 +936,7 @@ void suggest_load_files(void)
if (spell_read_tree(fd, &slang->sl_sbyts, NULL, &slang->sl_sidxs,
false, 0) != 0) {
someerror:
- EMSG2(_("E782: error while reading .sug file: %s"),
+ semsg(_("E782: error while reading .sug file: %s"),
slang->sl_fname);
slang_clear_sug(slang);
goto nextone;
@@ -2042,7 +2042,7 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char_u *fname)
// Open the file.
fd = os_fopen((char *)fname, "r");
if (fd == NULL) {
- EMSG2(_(e_notopen), fname);
+ semsg(_(e_notopen), fname);
return NULL;
}
@@ -3126,7 +3126,7 @@ static int spell_read_dic(spellinfo_T *spin, char_u *fname, afffile_T *affile)
// Open the file.
fd = os_fopen((char *)fname, "r");
if (fd == NULL) {
- EMSG2(_(e_notopen), fname);
+ semsg(_(e_notopen), fname);
return FAIL;
}
@@ -3142,7 +3142,7 @@ static int spell_read_dic(spellinfo_T *spin, char_u *fname, afffile_T *affile)
// Read and ignore the first line: word count.
if (vim_fgets(line, MAXLINELEN, fd) || !ascii_isdigit(*skipwhite(line))) {
- EMSG2(_("E760: No word count in %s"), fname);
+ semsg(_("E760: No word count in %s"), fname);
}
// Read all the lines in the file one by one.
@@ -3684,7 +3684,7 @@ static int spell_read_wordfile(spellinfo_T *spin, char_u *fname)
// Open the file.
fd = os_fopen((char *)fname, "r");
if (fd == NULL) {
- EMSG2(_(e_notopen), fname);
+ semsg(_(e_notopen), fname);
return FAIL;
}
@@ -4352,7 +4352,7 @@ static int write_vim_spell(spellinfo_T *spin, char_u *fname)
FILE *fd = os_fopen((char *)fname, "w");
if (fd == NULL) {
- EMSG2(_(e_notopen), fname);
+ semsg(_(e_notopen), fname);
return FAIL;
}
@@ -4723,7 +4723,7 @@ theend:
retval = FAIL;
}
if (retval == FAIL) {
- EMSG(_(e_write));
+ emsg(_(e_write));
}
return retval;
@@ -4845,7 +4845,7 @@ static int put_node(FILE *fd, wordnode_T *node, int idx, int regionmask, bool pr
if (fd != NULL) {
if (putc(np->wn_byte, fd) == EOF) { // <byte> or <xbyte>
- EMSG(_(e_write));
+ emsg(_(e_write));
return 0;
}
}
@@ -5186,7 +5186,7 @@ static void sug_write(spellinfo_T *spin, char_u *fname)
// Create the file. Note that an existing file is silently overwritten!
FILE *fd = os_fopen((char *)fname, "w");
if (fd == NULL) {
- EMSG2(_(e_notopen), fname);
+ semsg(_(e_notopen), fname);
return;
}
@@ -5196,7 +5196,7 @@ static void sug_write(spellinfo_T *spin, char_u *fname)
// <SUGHEADER>: <fileID> <versionnr> <timestamp>
if (fwrite(VIMSUGMAGIC, VIMSUGMAGICL, (size_t)1, fd) != 1) { // <fileID>
- EMSG(_(e_write));
+ emsg(_(e_write));
goto theend;
}
putc(VIMSUGVERSION, fd); // <versionnr>
@@ -5234,7 +5234,7 @@ static void sug_write(spellinfo_T *spin, char_u *fname)
char_u *line = ml_get_buf(spin->si_spellbuf, lnum, false);
size_t len = STRLEN(line) + 1;
if (fwrite(line, len, 1, fd) == 0) {
- EMSG(_(e_write));
+ emsg(_(e_write));
goto theend;
}
assert((size_t)spin->si_memtot + len <= INT_MAX);
@@ -5243,7 +5243,7 @@ static void sug_write(spellinfo_T *spin, char_u *fname)
// Write another byte to check for errors.
if (putc(0, fd) == EOF) {
- EMSG(_(e_write));
+ emsg(_(e_write));
}
vim_snprintf((char *)IObuff, IOSIZE,
@@ -5331,20 +5331,20 @@ static void mkspell(int fcount, char_u **fnames, bool ascii, bool over_write, bo
}
if (incount <= 0) {
- EMSG(_(e_invarg)); // need at least output and input names
+ emsg(_(e_invarg)); // need at least output and input names
} else if (vim_strchr(path_tail(wfname), '_') != NULL) {
- EMSG(_("E751: Output file name must not have region name"));
+ emsg(_("E751: Output file name must not have region name"));
} else if (incount > MAXREGIONS) {
- emsgf(_("E754: Only up to %d regions supported"), MAXREGIONS);
+ semsg(_("E754: Only up to %d regions supported"), MAXREGIONS);
} else {
// Check for overwriting before doing things that may take a lot of
// time.
if (!over_write && os_path_exists(wfname)) {
- EMSG(_(e_exists));
+ emsg(_(e_exists));
goto theend;
}
if (os_isdir(wfname)) {
- EMSG2(_(e_isadir2), wfname);
+ semsg(_(e_isadir2), wfname);
goto theend;
}
@@ -5359,7 +5359,7 @@ static void mkspell(int fcount, char_u **fnames, bool ascii, bool over_write, bo
len = (int)STRLEN(innames[i]);
if (STRLEN(path_tail(innames[i])) < 5
|| innames[i][len - 3] != '_') {
- EMSG2(_("E755: Invalid region in %s"), innames[i]);
+ semsg(_("E755: Invalid region in %s"), innames[i]);
goto theend;
}
spin.si_region_name[i * 2] = TOLOWER_ASC(innames[i][len - 2]);
@@ -5541,7 +5541,7 @@ void spell_add_word(char_u *word, int len, SpellAddType what, int idx, bool undo
}
if (*curwin->w_s->b_p_spf == NUL) {
- EMSG2(_(e_notset), "spellfile");
+ semsg(_(e_notset), "spellfile");
return;
}
fnamebuf = xmalloc(MAXPATHL);
@@ -5552,7 +5552,7 @@ void spell_add_word(char_u *word, int len, SpellAddType what, int idx, bool undo
break;
}
if (*spf == NUL) {
- EMSGN(_("E765: 'spellfile' does not have %" PRId64 " entries"), idx);
+ semsg(_("E765: 'spellfile' does not have %" PRId64 " entries"), (int64_t)idx);
xfree(fnamebuf);
return;
}
@@ -5564,7 +5564,7 @@ void spell_add_word(char_u *word, int len, SpellAddType what, int idx, bool undo
buf = NULL;
}
if (buf != NULL && bufIsChanged(buf)) {
- EMSG(_(e_bufloaded));
+ emsg(_(e_bufloaded));
xfree(fnamebuf);
return;
}
@@ -5632,7 +5632,7 @@ void spell_add_word(char_u *word, int len, SpellAddType what, int idx, bool undo
}
if (fd == NULL) {
- EMSG2(_(e_notopen), fname);
+ semsg(_(e_notopen), fname);
} else {
if (what == SPELL_ADD_BAD) {
fprintf(fd, "%.*s/!\n", len, word);
@@ -5778,7 +5778,7 @@ static int set_spell_finish(spelltab_T *new_st)
|| spelltab.st_isu[i] != new_st->st_isu[i]
|| spelltab.st_fold[i] != new_st->st_fold[i]
|| spelltab.st_upper[i] != new_st->st_upper[i]) {
- EMSG(_("E763: Word characters differ between spell files"));
+ emsg(_("E763: Word characters differ between spell files"));
return FAIL;
}
}
@@ -5876,7 +5876,7 @@ static void set_map_str(slang_T *lp, char_u *map)
} else {
// This should have been checked when generating the .spl
// file.
- EMSG(_("E783: duplicate char in MAP entry"));
+ emsg(_("E783: duplicate char in MAP entry"));
xfree(b);
}
} else {
diff --git a/src/nvim/strings.c b/src/nvim/strings.c
index b405650b0e..688ac548c0 100644
--- a/src/nvim/strings.c
+++ b/src/nvim/strings.c
@@ -557,7 +557,7 @@ static varnumber_T tv_nr(typval_T *tvs, int *idxp)
varnumber_T n = 0;
if (tvs[idx].v_type == VAR_UNKNOWN) {
- EMSG(_(e_printf));
+ emsg(_(e_printf));
} else {
(*idxp)++;
bool err = false;
@@ -590,7 +590,7 @@ static const char *tv_str(typval_T *tvs, int *idxp, char **const tofree)
const char *s = NULL;
if (tvs[idx].v_type == VAR_UNKNOWN) {
- EMSG(_(e_printf));
+ emsg(_(e_printf));
} else {
(*idxp)++;
if (tvs[idx].v_type == VAR_STRING || tvs[idx].v_type == VAR_NUMBER) {
@@ -627,7 +627,7 @@ static const void *tv_ptr(const typval_T *const tvs, int *const idxp)
#undef OFF
const int idx = *idxp - 1;
if (tvs[idx].v_type == VAR_UNKNOWN) {
- EMSG(_(e_printf));
+ emsg(_(e_printf));
return NULL;
} else {
(*idxp)++;
@@ -652,7 +652,7 @@ static float_T tv_float(typval_T *const tvs, int *const idxp)
float_T f = 0;
if (tvs[idx].v_type == VAR_UNKNOWN) {
- EMSG(_(e_printf));
+ emsg(_(e_printf));
} else {
(*idxp)++;
if (tvs[idx].v_type == VAR_FLOAT) {
@@ -660,7 +660,7 @@ static float_T tv_float(typval_T *const tvs, int *const idxp)
} else if (tvs[idx].v_type == VAR_NUMBER) {
f = (float_T)tvs[idx].vval.v_number;
} else {
- EMSG(_("E807: Expected Float argument for printf()"));
+ emsg(_("E807: Expected Float argument for printf()"));
}
}
return f;
@@ -706,7 +706,7 @@ static float_T tv_float(typval_T *const tvs, int *const idxp)
/// Append a formatted value to the string
///
/// @see vim_vsnprintf_typval().
-int vim_snprintf_add(char *str, size_t str_m, char *fmt, ...)
+int vim_snprintf_add(char *str, size_t str_m, const char *fmt, ...)
FUNC_ATTR_PRINTF(3, 4)
{
const size_t len = strlen(str);
@@ -1456,7 +1456,7 @@ int vim_vsnprintf_typval(char *str, size_t str_m, const char *fmt, va_list ap, t
}
if (tvs && tvs[arg_idx - 1].v_type != VAR_UNKNOWN) {
- EMSG(_("E767: Too many arguments to printf()"));
+ emsg(_("E767: Too many arguments to printf()"));
}
// return the number of characters formatted (excluding trailing nul
diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c
index d4be2b4e34..110c4664ca 100644
--- a/src/nvim/syntax.c
+++ b/src/nvim/syntax.c
@@ -3119,7 +3119,7 @@ static void syn_cmd_conceal(exarg_T *eap, int syncing)
} else if (STRNICMP(arg, "off", 3) == 0 && next - arg == 3) {
curwin->w_s->b_syn_conceal = false;
} else {
- EMSG2(_(e_illegal_arg), arg);
+ semsg(_(e_illegal_arg), arg);
}
}
@@ -3148,7 +3148,7 @@ static void syn_cmd_case(exarg_T *eap, int syncing)
} else if (STRNICMP(arg, "ignore", 6) == 0 && next - arg == 6) {
curwin->w_s->b_syn_ic = true;
} else {
- EMSG2(_(e_illegal_arg), arg);
+ semsg(_(e_illegal_arg), arg);
}
}
@@ -3181,13 +3181,13 @@ static void syn_cmd_foldlevel(exarg_T *eap, int syncing)
} else if (STRNICMP(arg, "minimum", 7) == 0 && arg_end - arg == 7) {
curwin->w_s->b_syn_foldlevel = SYNFLD_MINIMUM;
} else {
- EMSG2(_(e_illegal_arg), arg);
+ semsg(_(e_illegal_arg), arg);
return;
}
arg = skipwhite(arg_end);
if (*arg != NUL) {
- EMSG2(_(e_illegal_arg), arg);
+ semsg(_(e_illegal_arg), arg);
}
}
@@ -3220,7 +3220,7 @@ static void syn_cmd_spell(exarg_T *eap, int syncing)
} else if (STRNICMP(arg, "default", 7) == 0 && next - arg == 7) {
curwin->w_s->b_syn_spell = SYNSPL_DEFAULT;
} else {
- EMSG2(_(e_illegal_arg), arg);
+ semsg(_(e_illegal_arg), arg);
return;
}
@@ -3444,7 +3444,7 @@ static void syn_cmd_clear(exarg_T *eap, int syncing)
if (*arg == '@') {
id = syn_scl_namen2id(arg + 1, (int)(arg_end - arg - 1));
if (id == 0) {
- EMSG2(_("E391: No such syntax cluster: %s"), arg);
+ semsg(_("E391: No such syntax cluster: %s"), arg);
break;
} else {
// We can't physically delete a cluster without changing
@@ -3457,7 +3457,7 @@ static void syn_cmd_clear(exarg_T *eap, int syncing)
} else {
id = syn_name2id_len(arg, (int)(arg_end - arg));
if (id == 0) {
- EMSG2(_(e_nogroup), arg);
+ semsg(_(e_nogroup), arg);
break;
} else {
syn_clear_one(id, syncing);
@@ -3621,14 +3621,14 @@ static void syn_cmd_list(exarg_T *eap, int syncing)
if (*arg == '@') {
int id = syn_scl_namen2id(arg + 1, (int)(arg_end - arg - 1));
if (id == 0) {
- EMSG2(_("E392: No such syntax cluster: %s"), arg);
+ semsg(_("E392: No such syntax cluster: %s"), arg);
} else {
syn_list_cluster(id - SYNID_CLUSTER);
}
} else {
int id = syn_name2id_len(arg, (int)(arg_end - arg));
if (id == 0) {
- EMSG2(_(e_nogroup), arg);
+ semsg(_(e_nogroup), arg);
} else {
syn_list_one(id, syncing, true);
}
@@ -4229,7 +4229,7 @@ static char_u *get_syn_options(char_u *arg, syn_opt_arg_T *opt, int *conceal_cha
if (flagtab[fidx].argtype == 1) {
if (!opt->has_cont_list) {
- EMSG(_("E395: contains argument not accepted here"));
+ emsg(_("E395: contains argument not accepted here"));
return NULL;
}
if (get_id_list(&arg, 8, &opt->cont_list, skip) == FAIL) {
@@ -4248,7 +4248,7 @@ static char_u *get_syn_options(char_u *arg, syn_opt_arg_T *opt, int *conceal_cha
*conceal_char = utf_ptr2char(arg + 6);
arg += mb_ptr2len(arg + 6) - 1;
if (!vim_isprintc_strict(*conceal_char)) {
- EMSG(_("E844: invalid cchar value"));
+ emsg(_("E844: invalid cchar value"));
return NULL;
}
arg = skipwhite(arg + 7);
@@ -4259,7 +4259,7 @@ static char_u *get_syn_options(char_u *arg, syn_opt_arg_T *opt, int *conceal_cha
if (flagtab[fidx].flags == HL_SYNC_HERE
|| flagtab[fidx].flags == HL_SYNC_THERE) {
if (opt->sync_idx == NULL) {
- EMSG(_("E393: group[t]here not accepted here"));
+ emsg(_("E393: group[t]here not accepted here"));
return NULL;
}
gname_start = arg;
@@ -4281,7 +4281,7 @@ static char_u *get_syn_options(char_u *arg, syn_opt_arg_T *opt, int *conceal_cha
}
}
if (i < 0) {
- EMSG2(_("E394: Didn't find region item for %s"), gname);
+ semsg(_("E394: Didn't find region item for %s"), gname);
xfree(gname);
return NULL;
}
@@ -4332,7 +4332,7 @@ static void syn_cmd_include(exarg_T *eap, int syncing)
int sgl_id = 1;
char_u *group_name_end;
char_u *rest;
- char_u *errormsg = NULL;
+ char *errormsg = NULL;
int prev_toplvl_grp;
int prev_syn_inc_tag;
bool source = false;
@@ -4346,7 +4346,7 @@ static void syn_cmd_include(exarg_T *eap, int syncing)
++arg;
rest = get_group_name(arg, &group_name_end);
if (rest == NULL) {
- EMSG((char_u *)_("E397: Filename required"));
+ emsg(_("E397: Filename required"));
return;
}
sgl_id = syn_check_cluster(arg, (int)(group_name_end - arg));
@@ -4370,7 +4370,7 @@ static void syn_cmd_include(exarg_T *eap, int syncing)
source = true;
if (expand_filename(eap, syn_cmdlinep, &errormsg) == FAIL) {
if (errormsg != NULL) {
- EMSG(errormsg);
+ emsg(errormsg);
}
return;
}
@@ -4381,7 +4381,7 @@ static void syn_cmd_include(exarg_T *eap, int syncing)
* include" tag around the actual inclusion.
*/
if (running_syn_inc_tag >= MAX_SYN_INC_TAG) {
- EMSG((char_u *)_("E847: Too many syntax includes"));
+ emsg(_("E847: Too many syntax includes"));
return;
}
prev_syn_inc_tag = current_syn_inc_tag;
@@ -4391,7 +4391,7 @@ static void syn_cmd_include(exarg_T *eap, int syncing)
if (source
? do_source((char *)eap->arg, false, DOSO_NONE) == FAIL
: source_runtime((char *)eap->arg, DIP_ALL) == FAIL) {
- EMSG2(_(e_notopen), eap->arg);
+ semsg(_(e_notopen), eap->arg);
}
curwin->w_s->b_syn_topgrp = prev_toplvl_grp;
current_syn_inc_tag = prev_syn_inc_tag;
@@ -4471,12 +4471,12 @@ static void syn_cmd_keyword(exarg_T *eap, int syncing)
break;
}
if (p[1] == NUL) {
- emsgf(_("E789: Missing ']': %s"), kw);
+ semsg(_("E789: Missing ']': %s"), kw);
goto error;
}
if (p[1] == ']') {
if (p[2] != NUL) {
- emsgf(_("E890: trailing char after ']': %s]%s"),
+ semsg(_("E890: trailing char after ']': %s]%s"),
kw, &p[2]);
goto error;
}
@@ -4501,7 +4501,7 @@ error:
if (rest != NULL) {
eap->nextcmd = check_nextcmd(rest);
} else {
- EMSG2(_(e_invarg2), arg);
+ semsg(_(e_invarg2), arg);
}
redraw_curbuf_later(SOME_VALID);
@@ -4603,7 +4603,7 @@ static void syn_cmd_match(exarg_T *eap, int syncing)
xfree(syn_opt_arg.next_list);
if (rest == NULL) {
- EMSG2(_(e_invarg2), arg);
+ semsg(_(e_invarg2), arg);
}
}
@@ -4691,7 +4691,7 @@ static void syn_cmd_region(exarg_T *eap, int syncing)
rest = skipwhite(key_end);
if (*rest != '=') {
rest = NULL;
- EMSG2(_("E398: Missing '=': %s"), arg);
+ semsg(_("E398: Missing '=': %s"), arg);
break;
}
rest = skipwhite(rest + 1);
@@ -4830,9 +4830,9 @@ static void syn_cmd_region(exarg_T *eap, int syncing)
xfree(syn_opt_arg.cont_in_list);
xfree(syn_opt_arg.next_list);
if (not_enough) {
- EMSG2(_("E399: Not enough arguments: syntax region %s"), arg);
+ semsg(_("E399: Not enough arguments: syntax region %s"), arg);
} else if (illegal || rest == NULL) {
- EMSG2(_(e_invarg2), arg);
+ semsg(_(e_invarg2), arg);
}
}
}
@@ -5029,7 +5029,7 @@ static int syn_add_cluster(char_u *name)
int len = curwin->w_s->b_syn_clusters.ga_len;
if (len >= MAX_CLUSTER_ID) {
- EMSG((char_u *)_("E848: Too many syntax clusters"));
+ emsg(_("E848: Too many syntax clusters"));
xfree(name);
return 0;
}
@@ -5097,7 +5097,7 @@ static void syn_cmd_cluster(exarg_T *eap, int syncing)
int16_t *clstr_list = NULL;
if (get_id_list(&rest, opt_len, &clstr_list, eap->skip) == FAIL) {
- EMSG2(_(e_invarg2), rest);
+ semsg(_(e_invarg2), rest);
break;
}
if (scl_id >= 0) {
@@ -5116,10 +5116,10 @@ static void syn_cmd_cluster(exarg_T *eap, int syncing)
}
if (!got_clstr) {
- EMSG(_("E400: No cluster specified"));
+ emsg(_("E400: No cluster specified"));
}
if (rest == NULL || !ends_excmd(*rest)) {
- EMSG2(_(e_invarg2), arg);
+ semsg(_(e_invarg2), arg);
}
}
@@ -5151,7 +5151,7 @@ static char_u *get_syn_pattern(char_u *arg, synpat_T *ci)
end = skip_regexp(arg + 1, *arg, TRUE, NULL);
if (*end != *arg) { // end delimiter not found
- EMSG2(_("E401: Pattern delimiter not found: %s"), arg);
+ semsg(_("E401: Pattern delimiter not found: %s"), arg);
return NULL;
}
// store the pattern and compiled regexp program
@@ -5223,7 +5223,7 @@ static char_u *get_syn_pattern(char_u *arg, synpat_T *ci)
} while (idx >= 0);
if (!ends_excmd(*end) && !ascii_iswhite(*end)) {
- EMSG2(_("E402: Garbage after pattern: %s"), arg);
+ semsg(_("E402: Garbage after pattern: %s"), arg);
return NULL;
}
return skipwhite(end);
@@ -5302,7 +5302,7 @@ static void syn_cmd_sync(exarg_T *eap, int syncing)
break;
}
if (curwin->w_s->b_syn_linecont_pat != NULL) {
- EMSG(_("E403: syntax sync: line continuations pattern specified twice"));
+ emsg(_("E403: syntax sync: line continuations pattern specified twice"));
finished = TRUE;
break;
}
@@ -5351,7 +5351,7 @@ static void syn_cmd_sync(exarg_T *eap, int syncing)
}
xfree(key);
if (illegal) {
- EMSG2(_("E404: Illegal arguments: %s"), arg_start);
+ semsg(_("E404: Illegal arguments: %s"), arg_start);
} else if (!finished) {
eap->nextcmd = check_nextcmd(arg_start);
redraw_curbuf_later(SOME_VALID);
@@ -5387,12 +5387,12 @@ static int get_id_list(char_u **const arg, const int keylen, int16_t **const lis
// skip "contains"
p = skipwhite(*arg + keylen);
if (*p != '=') {
- EMSG2(_("E405: Missing equal sign: %s"), *arg);
+ semsg(_("E405: Missing equal sign: %s"), *arg);
break;
}
p = skipwhite(p + 1);
if (ends_excmd(*p)) {
- EMSG2(_("E406: Empty argument: %s"), *arg);
+ semsg(_("E406: Empty argument: %s"), *arg);
break;
}
@@ -5408,13 +5408,13 @@ static int get_id_list(char_u **const arg, const int keylen, int16_t **const lis
|| STRCMP(name + 1, "TOP") == 0
|| STRCMP(name + 1, "CONTAINED") == 0) {
if (TOUPPER_ASC(**arg) != 'C') {
- EMSG2(_("E407: %s not allowed here"), name + 1);
+ semsg(_("E407: %s not allowed here"), name + 1);
failed = true;
xfree(name);
break;
}
if (count != 0) {
- EMSG2(_("E408: %s must be first in contains list"),
+ semsg(_("E408: %s must be first in contains list"),
name + 1);
failed = true;
xfree(name);
@@ -5479,7 +5479,7 @@ static int get_id_list(char_u **const arg, const int keylen, int16_t **const lis
}
xfree(name);
if (id == 0) {
- EMSG2(_("E409: Unknown group name: %s"), p);
+ semsg(_("E409: Unknown group name: %s"), p);
failed = true;
break;
}
@@ -5697,7 +5697,7 @@ void ex_syntax(exarg_T *eap)
}
for (int i = 0;; i++) {
if (subcommands[i].name == NULL) {
- EMSG2(_("E410: Invalid :syntax subcommand: %s"), subcmd_name);
+ semsg(_("E410: Invalid :syntax subcommand: %s"), subcmd_name);
break;
}
if (STRCMP(subcmd_name, (char_u *)subcommands[i].name) == 0) {
@@ -6002,7 +6002,7 @@ void ex_syntime(exarg_T *eap)
} else if (STRCMP(eap->arg, "report") == 0) {
syntime_report();
} else {
- EMSG2(_(e_invarg2), eap->arg);
+ semsg(_(e_invarg2), eap->arg);
}
}
@@ -6775,7 +6775,7 @@ void do_highlight(const char *line, const bool forceit, const bool init)
if (!doclear && !dolink && ends_excmd((uint8_t)(*linep))) {
id = syn_name2id_len((const char_u *)line, (int)(name_end - line));
if (id == 0) {
- emsgf(_("E411: highlight group not found: %s"), line);
+ semsg(_("E411: highlight group not found: %s"), line);
} else {
highlight_list_one(id);
}
@@ -6798,13 +6798,13 @@ void do_highlight(const char *line, const bool forceit, const bool init)
if (ends_excmd((uint8_t)(*from_start))
|| ends_excmd((uint8_t)(*to_start))) {
- emsgf(_("E412: Not enough arguments: \":highlight link %s\""),
+ semsg(_("E412: Not enough arguments: \":highlight link %s\""),
from_start);
return;
}
if (!ends_excmd(*skipwhite((const char_u *)to_end))) {
- emsgf(_("E413: Too many arguments: \":highlight link %s\""), from_start);
+ semsg(_("E413: Too many arguments: \":highlight link %s\""), from_start);
return;
}
@@ -6830,7 +6830,7 @@ void do_highlight(const char *line, const bool forceit, const bool init)
if (to_id > 0 && !forceit && !init
&& hl_has_settings(from_id - 1, dodefault)) {
if (sourcing_name == NULL && !dodefault) {
- EMSG(_("E414: group has settings, highlight link ignored"));
+ emsg(_("E414: group has settings, highlight link ignored"));
}
} else if (hlgroup->sg_link != to_id
|| hlgroup->sg_script_ctx.sc_sid != current_sctx.sc_sid
@@ -6902,7 +6902,7 @@ void do_highlight(const char *line, const bool forceit, const bool init)
while (!ends_excmd((uint8_t)(*linep))) {
key_start = linep;
if (*linep == '=') {
- emsgf(_("E415: unexpected equal sign: %s"), key_start);
+ semsg(_("E415: unexpected equal sign: %s"), key_start);
error = true;
break;
}
@@ -6929,7 +6929,7 @@ void do_highlight(const char *line, const bool forceit, const bool init)
// Check for the equal sign.
if (*linep != '=') {
- emsgf(_("E416: missing equal sign: %s"), key_start);
+ semsg(_("E416: missing equal sign: %s"), key_start);
error = true;
break;
}
@@ -6941,7 +6941,7 @@ void do_highlight(const char *line, const bool forceit, const bool init)
arg_start = ++linep;
linep = strchr(linep, '\'');
if (linep == NULL) {
- emsgf(_(e_invarg2), key_start);
+ semsg(_(e_invarg2), key_start);
error = true;
break;
}
@@ -6950,7 +6950,7 @@ void do_highlight(const char *line, const bool forceit, const bool init)
linep = (const char *)skiptowhite((const char_u *)linep);
}
if (linep == arg_start) {
- emsgf(_("E417: missing argument: %s"), key_start);
+ semsg(_("E417: missing argument: %s"), key_start);
error = true;
break;
}
@@ -6977,7 +6977,7 @@ void do_highlight(const char *line, const bool forceit, const bool init)
}
}
if (i < 0) {
- emsgf(_("E418: Illegal value: %s"), arg);
+ semsg(_("E418: Illegal value: %s"), arg);
error = true;
break;
}
@@ -7025,7 +7025,7 @@ void do_highlight(const char *line, const bool forceit, const bool init)
if (cterm_normal_fg_color) {
color = cterm_normal_fg_color - 1;
} else {
- EMSG(_("E419: FG color unknown"));
+ emsg(_("E419: FG color unknown"));
error = true;
break;
}
@@ -7033,7 +7033,7 @@ void do_highlight(const char *line, const bool forceit, const bool init)
if (cterm_normal_bg_color > 0) {
color = cterm_normal_bg_color - 1;
} else {
- EMSG(_("E420: BG color unknown"));
+ emsg(_("E420: BG color unknown"));
error = true;
break;
}
@@ -7047,7 +7047,7 @@ void do_highlight(const char *line, const bool forceit, const bool init)
}
}
if (i < 0) {
- emsgf(_("E421: Color name or number not recognized: %s"),
+ semsg(_("E421: Color name or number not recognized: %s"),
key_start);
error = true;
break;
@@ -7180,7 +7180,7 @@ void do_highlight(const char *line, const bool forceit, const bool init)
HL_TABLE()[idx].sg_blend = -1;
}
} else {
- emsgf(_("E423: Illegal argument: %s"), key_start);
+ semsg(_("E423: Illegal argument: %s"), key_start);
error = true;
break;
}
@@ -7698,7 +7698,7 @@ static int syn_add_group(char_u *name)
// Check that the name is ASCII letters, digits and underscore.
for (p = name; *p != NUL; ++p) {
if (!vim_isprintc(*p)) {
- EMSG(_("E669: Unprintable character in group name"));
+ emsg(_("E669: Unprintable character in group name"));
xfree(name);
return 0;
} else if (!ASCII_ISALNUM(*p) && *p != '_') {
@@ -7719,7 +7719,7 @@ static int syn_add_group(char_u *name)
}
if (highlight_ga.ga_len >= MAX_HL_ID) {
- EMSG(_("E849: Too many highlight and syntax groups"));
+ emsg(_("E849: Too many highlight and syntax groups"));
xfree(name);
return 0;
}
diff --git a/src/nvim/tag.c b/src/nvim/tag.c
index 427bf5b7b6..d1676ec658 100644
--- a/src/nvim/tag.c
+++ b/src/nvim/tag.c
@@ -178,7 +178,7 @@ int do_tag(char_u *tag, int type, int count, int forceit, int verbose)
static int flags;
if (tfu_in_use) {
- EMSG(_(recurmsg));
+ emsg(_(recurmsg));
return false;
}
@@ -271,14 +271,14 @@ int do_tag(char_u *tag, int type, int count, int forceit, int verbose)
g_do_tagpreview != 0 ? ptag_entry.tagname == NULL :
tagstacklen == 0) {
// empty stack
- EMSG(_(e_tagstack));
+ emsg(_(e_tagstack));
goto end_do_tag;
}
if (type == DT_POP) { // go to older position
const bool old_KeyTyped = KeyTyped;
if ((tagstackidx -= count) < 0) {
- EMSG(_(bottommsg));
+ emsg(_(bottommsg));
if (tagstackidx + count == 0) {
// We did [num]^T from the bottom of the stack
tagstackidx = 0;
@@ -288,7 +288,7 @@ int do_tag(char_u *tag, int type, int count, int forceit, int verbose)
// way to the bottom now.
tagstackidx = 0;
} else if (tagstackidx >= tagstacklen) { // count == 0?
- EMSG(_(topmsg));
+ emsg(_(topmsg));
goto end_do_tag;
}
@@ -342,10 +342,10 @@ int do_tag(char_u *tag, int type, int count, int forceit, int verbose)
* position.
*/
tagstackidx = tagstacklen - 1;
- EMSG(_(topmsg));
+ emsg(_(topmsg));
save_pos = false;
} else if (tagstackidx < 0) { // must have been count == 0
- EMSG(_(bottommsg));
+ emsg(_(bottommsg));
tagstackidx = 0;
goto end_do_tag;
}
@@ -383,7 +383,7 @@ int do_tag(char_u *tag, int type, int count, int forceit, int verbose)
if (cur_match >= MAXCOL) {
cur_match = MAXCOL - 1;
} else if (cur_match < 0) {
- EMSG(_("E425: Cannot go before first matching tag"));
+ emsg(_("E425: Cannot go before first matching tag"));
skip_msg = true;
cur_match = 0;
cur_fnum = curbuf->b_fnum;
@@ -519,7 +519,7 @@ int do_tag(char_u *tag, int type, int count, int forceit, int verbose)
if (num_matches <= 0) {
if (verbose) {
- EMSG2(_("E426: tag not found: %s"), name);
+ semsg(_("E426: tag not found: %s"), name);
}
g_do_tagpreview = 0;
} else {
@@ -562,13 +562,13 @@ int do_tag(char_u *tag, int type, int count, int forceit, int verbose)
if (cur_match >= num_matches) {
// Avoid giving this error when a file wasn't found and we're
// looking for a match in another file, which wasn't found.
- // There will be an EMSG("file doesn't exist") below then.
+ // There will be an emsg("file doesn't exist") below then.
if ((type == DT_NEXT || type == DT_FIRST)
&& nofile_fname == NULL) {
if (num_matches == 1) {
- EMSG(_("E427: There is only one matching tag"));
+ emsg(_("E427: There is only one matching tag"));
} else {
- EMSG(_("E428: Cannot go beyond last matching tag"));
+ emsg(_("E428: Cannot go beyond last matching tag"));
}
skip_msg = true;
}
@@ -596,7 +596,7 @@ int do_tag(char_u *tag, int type, int count, int forceit, int verbose)
/*
* Only when going to try the next match, report that the previous
- * file didn't exist. Otherwise an EMSG() is given below.
+ * file didn't exist. Otherwise an emsg() is given below.
*/
if (nofile_fname != NULL && error_cur_match != cur_match) {
smsg(_("File \"%s\" does not exist"), nofile_fname);
@@ -663,7 +663,7 @@ int do_tag(char_u *tag, int type, int count, int forceit, int verbose)
}
continue;
}
- EMSG2(_("E429: File \"%s\" does not exist"), nofile_fname);
+ semsg(_("E429: File \"%s\" does not exist"), nofile_fname);
} else {
// We may have jumped to another window, check that
// tagstackidx is still valid.
@@ -1196,7 +1196,7 @@ static int find_tagfunc_tags(char_u *pat, garray_T *ga, int *match_count, int fl
}
if (rettv.v_type != VAR_LIST || !rettv.vval.v_list) {
tv_clear(&rettv);
- EMSG(_(tfu_inv_ret_msg));
+ emsg(_(tfu_inv_ret_msg));
return FAIL;
}
taglist = rettv.vval.v_list;
@@ -1210,7 +1210,7 @@ static int find_tagfunc_tags(char_u *pat, garray_T *ga, int *match_count, int fl
int name_only = flags & TAG_NAMES;
if (TV_LIST_ITEM_TV(li)->v_type != VAR_DICT) {
- EMSG(_(tfu_inv_ret_msg));
+ emsg(_(tfu_inv_ret_msg));
break;
}
@@ -1256,7 +1256,7 @@ static int find_tagfunc_tags(char_u *pat, garray_T *ga, int *match_count, int fl
}
if (!res_name || !res_fname || !res_cmd) {
- EMSG(_(tfu_inv_ret_msg));
+ emsg(_(tfu_inv_ret_msg));
break;
}
@@ -2193,9 +2193,9 @@ parse_line:
} // forever
if (line_error) {
- EMSG2(_("E431: Format error in tags file \"%s\""), tag_fname);
+ semsg(_("E431: Format error in tags file \"%s\""), tag_fname);
if (!use_cscope) {
- EMSGN(_("Before byte %" PRId64), vim_ftell(fp));
+ semsg(_("Before byte %" PRId64), (int64_t)vim_ftell(fp));
}
stop_searching = true;
line_error = false;
@@ -2210,7 +2210,7 @@ parse_line:
tag_file_sorted = NUL;
if (sort_error) {
- EMSG2(_("E432: Tags file not sorted: %s"), tag_fname);
+ semsg(_("E432: Tags file not sorted: %s"), tag_fname);
sort_error = false;
}
@@ -2244,7 +2244,7 @@ parse_line:
if (!stop_searching) {
if (!did_open && verbose) { // never opened any tags file
- EMSG(_("E433: No tags file"));
+ emsg(_("E433: No tags file"));
}
retval = OK; // It's OK even when no tag found
}
@@ -2881,7 +2881,7 @@ static int jumpto_tag(const char_u *lbuf_arg, int forceit, int keep_help)
*tagp.tagname_end = cc;
}
if (found == 0) {
- EMSG(_("E434: Can't find tag pattern"));
+ emsg(_("E434: Can't find tag pattern"));
curwin->w_cursor.lnum = save_lnum;
} else {
/*
@@ -3454,13 +3454,13 @@ int set_tagstack(win_T *wp, const dict_T *d, int action)
// not allowed to alter the tag stack entries from inside tagfunc
if (tfu_in_use) {
- EMSG(_(recurmsg));
+ emsg(_(recurmsg));
return FAIL;
}
if ((di = tv_dict_find(d, "items", -1)) != NULL) {
if (di->di_tv.v_type != VAR_LIST) {
- EMSG(_(e_listreq));
+ emsg(_(e_listreq));
return FAIL;
}
l = di->di_tv.vval.v_list;
diff --git a/src/nvim/tui/input.c b/src/nvim/tui/input.c
index ec277f7a4e..5bb6059fa7 100644
--- a/src/nvim/tui/input.c
+++ b/src/nvim/tui/input.c
@@ -151,7 +151,7 @@ static void tinput_paste_event(void **argv)
Error err = ERROR_INIT;
nvim_paste(keys, true, phase, &err);
if (ERROR_SET(&err)) {
- emsgf("paste: %s", err.msg);
+ semsg("paste: %s", err.msg);
api_clear_error(&err);
}
diff --git a/src/nvim/undo.c b/src/nvim/undo.c
index 3691a0f2d2..9fd0012aac 100644
--- a/src/nvim/undo.c
+++ b/src/nvim/undo.c
@@ -144,25 +144,25 @@ static void u_check_tree(u_header_T *uhp, u_header_T *exp_uh_next, u_header_T *e
}
++header_count;
if (uhp == curbuf->b_u_curhead && ++seen_b_u_curhead > 1) {
- EMSG("b_u_curhead found twice (looping?)");
+ emsg("b_u_curhead found twice (looping?)");
return;
}
if (uhp == curbuf->b_u_newhead && ++seen_b_u_newhead > 1) {
- EMSG("b_u_newhead found twice (looping?)");
+ emsg("b_u_newhead found twice (looping?)");
return;
}
if (uhp->uh_magic != UH_MAGIC) {
- EMSG("uh_magic wrong (may be using freed memory)");
+ emsg("uh_magic wrong (may be using freed memory)");
} else {
// Check pointers back are correct.
if (uhp->uh_next.ptr != exp_uh_next) {
- EMSG("uh_next wrong");
+ emsg("uh_next wrong");
smsg("expected: 0x%x, actual: 0x%x",
exp_uh_next, uhp->uh_next.ptr);
}
if (uhp->uh_alt_prev.ptr != exp_uh_alt_prev) {
- EMSG("uh_alt_prev wrong");
+ emsg("uh_alt_prev wrong");
smsg("expected: 0x%x, actual: 0x%x",
exp_uh_alt_prev, uhp->uh_alt_prev.ptr);
}
@@ -170,7 +170,7 @@ static void u_check_tree(u_header_T *uhp, u_header_T *exp_uh_next, u_header_T *e
// Check the undo tree at this header.
for (uep = uhp->uh_entry; uep != NULL; uep = uep->ue_next) {
if (uep->ue_magic != UE_MAGIC) {
- EMSG("ue_magic wrong (may be using freed memory)");
+ emsg("ue_magic wrong (may be using freed memory)");
break;
}
}
@@ -193,13 +193,13 @@ static void u_check(int newhead_may_be_NULL)
if (seen_b_u_newhead == 0 && curbuf->b_u_oldhead != NULL
&& !(newhead_may_be_NULL && curbuf->b_u_newhead == NULL)) {
- EMSGN("b_u_newhead invalid: 0x%x", curbuf->b_u_newhead);
+ semsg("b_u_newhead invalid: 0x%x", curbuf->b_u_newhead);
}
if (curbuf->b_u_curhead != NULL && seen_b_u_curhead == 0) {
- EMSGN("b_u_curhead invalid: 0x%x", curbuf->b_u_curhead);
+ semsg("b_u_curhead invalid: 0x%x", curbuf->b_u_curhead);
}
if (header_count != curbuf->b_u_numhead) {
- EMSG("b_u_numhead invalid");
+ emsg("b_u_numhead invalid");
smsg("expected: %" PRId64 ", actual: %" PRId64,
(int64_t)header_count, (int64_t)curbuf->b_u_numhead);
}
@@ -283,20 +283,20 @@ bool undo_allowed(buf_T *buf)
{
// Don't allow changes when 'modifiable' is off.
if (!MODIFIABLE(buf)) {
- EMSG(_(e_modifiable));
+ emsg(_(e_modifiable));
return false;
}
// In the sandbox it's not allowed to change the text.
if (sandbox != 0) {
- EMSG(_(e_sandbox));
+ emsg(_(e_sandbox));
return false;
}
// Don't allow changes in the buffer while editing the cmdline. The
// caller of getcmdline() may get confused.
if (textlock != 0) {
- EMSG(_(e_secure));
+ emsg(_(e_secure));
return false;
}
@@ -357,7 +357,7 @@ int u_savecommon(buf_T *buf, linenr_T top, linenr_T bot, linenr_T newbot, int re
if (bot > buf->b_ml.ml_line_count + 1) {
// This happens when the FileChangedRO autocommand changes the
// file in a way it becomes shorter.
- EMSG(_("E881: Line count changed unexpectedly"));
+ emsg(_("E881: Line count changed unexpectedly"));
return FAIL;
}
}
@@ -721,7 +721,7 @@ char *u_get_undo_file_name(const char *const buf_ffname, const bool reading)
int ret;
char *failed_dir;
if ((ret = os_mkdir_recurse(dir_name, 0755, &failed_dir)) != 0) {
- EMSG3(_("E5003: Unable to create directory \"%s\" for undo file: %s"),
+ semsg(_("E5003: Unable to create directory \"%s\" for undo file: %s"),
failed_dir, os_strerror(ret));
xfree(failed_dir);
} else {
@@ -760,7 +760,7 @@ char *u_get_undo_file_name(const char *const buf_ffname, const bool reading)
static void corruption_error(const char *const mesg, const char *const file_name)
FUNC_ATTR_NONNULL_ALL
{
- EMSG3(_("E825: Corrupted undo file (%s): %s"), mesg, file_name);
+ semsg(_("E825: Corrupted undo file (%s): %s"), mesg, file_name);
}
static void u_free_uhp(u_header_T *uhp)
@@ -1267,7 +1267,7 @@ void u_write_undo(const char *const name, const bool forceit, buf_T *const buf,
fd = os_open(file_name, O_CREAT|O_WRONLY|O_EXCL|O_NOFOLLOW, perm);
if (fd < 0) {
- EMSG2(_(e_not_open), file_name);
+ semsg(_(e_not_open), file_name);
goto theend;
}
(void)os_setperm(file_name, perm);
@@ -1301,7 +1301,7 @@ void u_write_undo(const char *const name, const bool forceit, buf_T *const buf,
fp = fdopen(fd, "w");
if (fp == NULL) {
- EMSG2(_(e_not_open), file_name);
+ semsg(_(e_not_open), file_name);
close(fd);
os_remove(file_name);
goto theend;
@@ -1357,15 +1357,15 @@ void u_write_undo(const char *const name, const bool forceit, buf_T *const buf,
}
#ifdef U_DEBUG
if (headers_written != buf->b_u_numhead) {
- EMSGN("Written %" PRId64 " headers, ...", headers_written);
- EMSGN("... but numhead is %" PRId64, buf->b_u_numhead);
+ semsg("Written %" PRId64 " headers, ...", (int64_t)headers_written);
+ semsg("... but numhead is %" PRId64, (int64_t)buf->b_u_numhead);
}
#endif
write_error:
fclose(fp);
if (!write_ok) {
- EMSG2(_("E829: write error in undo file: %s"), file_name);
+ semsg(_("E829: write error in undo file: %s"), file_name);
}
#ifdef HAVE_ACL
@@ -1434,7 +1434,7 @@ void u_read_undo(char *name, const char_u *hash, const char_u *orig_name FUNC_AT
FILE *fp = os_fopen(file_name, "r");
if (fp == NULL) {
if (name != NULL || p_verbose > 0) {
- EMSG2(_("E822: Cannot open undo file for reading: %s"), file_name);
+ semsg(_("E822: Cannot open undo file for reading: %s"), file_name);
}
goto error;
}
@@ -1447,12 +1447,12 @@ void u_read_undo(char *name, const char_u *hash, const char_u *orig_name FUNC_AT
char_u magic_buf[UF_START_MAGIC_LEN];
if (fread(magic_buf, UF_START_MAGIC_LEN, 1, fp) != 1
|| memcmp(magic_buf, UF_START_MAGIC, UF_START_MAGIC_LEN) != 0) {
- EMSG2(_("E823: Not an undo file: %s"), file_name);
+ semsg(_("E823: Not an undo file: %s"), file_name);
goto error;
}
int version = get2c(fp);
if (version != UF_VERSION) {
- EMSG2(_("E824: Incompatible undo file: %s"), file_name);
+ semsg(_("E824: Incompatible undo file: %s"), file_name);
goto error;
}
@@ -1655,7 +1655,7 @@ void u_read_undo(char *name, const char_u *hash, const char_u *orig_name FUNC_AT
#ifdef U_DEBUG
for (int i = 0; i < num_head; i++) {
if (uhp_table_used[i] == 0) {
- EMSGN("uhp_table entry %" PRId64 " not used, leaking memory", i);
+ semsg("uhp_table entry %" PRId64 " not used, leaking memory", (int64_t)i);
}
}
xfree(uhp_table_used);
@@ -2140,7 +2140,7 @@ void undo_time(long step, bool sec, bool file, bool absolute)
}
if (absolute) {
- EMSGN(_("E830: Undo number %" PRId64 " not found"), step);
+ semsg(_("E830: Undo number %" PRId64 " not found"), (int64_t)step);
return;
}
@@ -2331,7 +2331,7 @@ static void u_undoredo(int undo, bool do_buf_event)
if (top > curbuf->b_ml.ml_line_count || top >= bot
|| bot > curbuf->b_ml.ml_line_count + 1) {
unblock_autocmds();
- IEMSG(_("E438: u_undo: line numbers wrong"));
+ iemsg(_("E438: u_undo: line numbers wrong"));
changed(); // don't want UNCHANGED now
return;
}
@@ -2759,7 +2759,7 @@ void ex_undojoin(exarg_T *eap)
return; // nothing changed before
}
if (curbuf->b_u_curhead != NULL) {
- EMSG(_("E790: undojoin is not allowed after undo"));
+ emsg(_("E790: undojoin is not allowed after undo"));
return;
}
if (!curbuf->b_u_synced) {
@@ -2856,7 +2856,7 @@ static void u_unch_branch(u_header_T *uhp)
static u_entry_T *u_get_headentry(buf_T *buf)
{
if (buf->b_u_newhead == NULL || buf->b_u_newhead->uh_entry == NULL) {
- IEMSG(_("E439: undo list corrupt"));
+ iemsg(_("E439: undo list corrupt"));
return NULL;
}
return buf->b_u_newhead->uh_entry;
@@ -2886,7 +2886,7 @@ static void u_getbot(buf_T *buf)
extra = buf->b_ml.ml_line_count - uep->ue_lcount;
uep->ue_bot = uep->ue_top + uep->ue_size + 1 + extra;
if (uep->ue_bot < 1 || uep->ue_bot > buf->b_ml.ml_line_count) {
- IEMSG(_("E440: undo line missing"));
+ iemsg(_("E440: undo line missing"));
uep->ue_bot = uep->ue_top + 1; // assume all lines deleted, will
// get all the old lines back
// without deleting the current
diff --git a/src/nvim/vim.h b/src/nvim/vim.h
index 7334dfccb7..726670f082 100644
--- a/src/nvim/vim.h
+++ b/src/nvim/vim.h
@@ -254,9 +254,9 @@ enum { FOLD_TEXT_LEN = 51, }; //!< buffer size for get_foldtext()
#include "nvim/message.h"
-// Prefer using emsgf(), because perror() may send the output to the wrong
+// Prefer using semsg(), because perror() may send the output to the wrong
// destination and mess up the screen.
-#define PERROR(msg) (void)emsgf("%s: %s", msg, strerror(errno))
+#define PERROR(msg) (void)semsg("%s: %s", msg, strerror(errno))
#define SHOWCMD_COLS 10 // columns needed by shown command
diff --git a/src/nvim/viml/parser/expressions.h b/src/nvim/viml/parser/expressions.h
index 325df643e7..fe9327b27d 100644
--- a/src/nvim/viml/parser/expressions.h
+++ b/src/nvim/viml/parser/expressions.h
@@ -361,7 +361,7 @@ typedef struct {
typedef struct {
/// When AST is not correct this message will be printed.
///
- /// Uses `emsgf(msg, arg_len, arg);`, `msg` is assumed to contain only `%.*s`.
+ /// Uses `semsg(msg, arg_len, arg);`, `msg` is assumed to contain only `%.*s`.
ExprASTError err;
/// Root node of the AST.
ExprASTNode *root;
diff --git a/src/nvim/window.c b/src/nvim/window.c
index d00f85fa95..8a33525338 100644
--- a/src/nvim/window.c
+++ b/src/nvim/window.c
@@ -92,7 +92,7 @@ void do_window(int nchar, long Prenum, int xchar)
#define CHECK_CMDWIN \
do { \
if (cmdwin_type != 0) { \
- EMSG(_(e_cmdwin)); \
+ emsg(_(e_cmdwin)); \
return; \
} \
} while (0)
@@ -133,9 +133,9 @@ void do_window(int nchar, long Prenum, int xchar)
if (buflist_findnr(Prenum == 0 ? curwin->w_alt_fnum : Prenum) == NULL) {
if (Prenum == 0) {
- EMSG(_(e_noalt));
+ emsg(_(e_noalt));
} else {
- EMSGN(_("E92: Buffer %" PRId64 " not found"), Prenum);
+ semsg(_("E92: Buffer %" PRId64 " not found"), (int64_t)Prenum);
}
break;
}
@@ -199,7 +199,7 @@ newwindow:
}
}
if (wp == NULL) {
- EMSG(_("E441: There is no preview window"));
+ emsg(_("E441: There is no preview window"));
} else {
win_goto(wp);
}
@@ -550,7 +550,7 @@ wingotofile:
config.external = true;
Error err = ERROR_INIT;
if (!win_new_float(curwin, config, &err)) {
- EMSG(err.msg);
+ emsg(err.msg);
api_clear_error(&err);
beep_flush();
}
@@ -916,7 +916,7 @@ int win_split(int size, int flags)
// Add flags from ":vertical", ":topleft" and ":botright".
flags |= cmdmod.split;
if ((flags & WSP_TOP) && (flags & WSP_BOT)) {
- EMSG(_("E442: Can't split topleft and botright at the same time"));
+ emsg(_("E442: Can't split topleft and botright at the same time"));
return FAIL;
}
@@ -969,7 +969,7 @@ int win_split_ins(int size, int flags, win_T *new_wp, int dir)
// add a status line when p_ls == 1 and splitting the first window
if (one_nonfloat() && p_ls == 1 && oldwin->w_status_height == 0) {
if (oldwin->w_height <= p_wmh && new_in_layout) {
- EMSG(_(e_noroom));
+ emsg(_(e_noroom));
return FAIL;
}
need_status = STATUS_HEIGHT;
@@ -1018,7 +1018,7 @@ int win_split_ins(int size, int flags, win_T *new_wp, int dir)
needed += minwidth;
}
if (available < needed && new_in_layout) {
- EMSG(_(e_noroom));
+ emsg(_(e_noroom));
return FAIL;
}
if (new_size == 0) {
@@ -1098,7 +1098,7 @@ int win_split_ins(int size, int flags, win_T *new_wp, int dir)
needed += minheight;
}
if (available < needed && new_in_layout) {
- EMSG(_(e_noroom));
+ emsg(_(e_noroom));
return FAIL;
}
oldwin_height = oldwin->w_height;
@@ -1654,7 +1654,7 @@ static void win_exchange(long Prenum)
int temp;
if (curwin->w_floating) {
- EMSG(e_floatexchange);
+ emsg(e_floatexchange);
return;
}
@@ -1741,7 +1741,7 @@ static void win_rotate(bool upwards, int count)
int n;
if (curwin->w_floating) {
- EMSG(e_floatexchange);
+ emsg(e_floatexchange);
return;
}
@@ -1754,7 +1754,7 @@ static void win_rotate(bool upwards, int count)
// Check if all frames in this row/col have one window.
FOR_ALL_FRAMES(frp, curwin->w_frame->fr_parent->fr_child) {
if (frp->fr_win == NULL) {
- EMSG(_("E443: Cannot rotate when another window is split"));
+ emsg(_("E443: Cannot rotate when another window is split"));
return;
}
}
@@ -2392,7 +2392,7 @@ int win_close(win_T *win, bool free_buf)
const bool had_diffmode = win->w_p_diff;
if (last_window() && !win->w_floating) {
- EMSG(_("E444: Cannot close last window"));
+ emsg(_("E444: Cannot close last window"));
return FAIL;
}
@@ -2401,17 +2401,17 @@ int win_close(win_T *win, bool free_buf)
return FAIL; // window is already being closed
}
if (win == aucmd_win) {
- EMSG(_(e_autocmd_close));
+ emsg(_(e_autocmd_close));
return FAIL;
}
if ((firstwin == aucmd_win || lastwin == aucmd_win) && one_window()) {
- EMSG(_("E814: Cannot close window, only autocmd window would remain"));
+ emsg(_("E814: Cannot close window, only autocmd window would remain"));
return FAIL;
}
if ((firstwin == win && lastwin_nofloating() == win)
&& lastwin->w_floating) {
// TODO(bfredl): we might close the float also instead
- EMSG(e_floatonly);
+ emsg(e_floatonly);
return FAIL;
}
@@ -3521,7 +3521,7 @@ void close_others(int message, int forceit)
if (curwin->w_floating) {
if (message && !autocmd_busy) {
- EMSG(e_floatonly);
+ emsg(e_floatonly);
}
return;
}
@@ -3563,7 +3563,7 @@ void close_others(int message, int forceit)
}
if (message && !ONE_WINDOW) {
- EMSG(_("E445: Other window contains changes"));
+ emsg(_("E445: Other window contains changes"));
}
}
@@ -5515,7 +5515,7 @@ void win_setminheight(void)
}
p_wmh--;
if (first) {
- EMSG(_(e_noroom));
+ emsg(_(e_noroom));
first = false;
}
}
@@ -5535,7 +5535,7 @@ void win_setminwidth(void)
}
p_wmw--;
if (first) {
- EMSG(_(e_noroom));
+ emsg(_(e_noroom));
first = false;
}
}
@@ -6030,7 +6030,7 @@ void command_height(void)
if (p_ch > old_p_ch) { // p_ch got bigger
while (p_ch > old_p_ch) {
if (frp == NULL) {
- EMSG(_(e_noroom));
+ emsg(_(e_noroom));
p_ch = old_p_ch;
curtab->tp_ch_used = p_ch;
cmdline_row = Rows - p_ch;
@@ -6152,7 +6152,7 @@ char_u *file_name_in_line(char_u *line, int col, int options, long count, char_u
}
if (*ptr == NUL) { // nothing found
if (options & FNAME_MESS) {
- EMSG(_("E446: No file name under cursor"));
+ emsg(_("E446: No file name under cursor"));
}
return NULL;
}
@@ -6265,7 +6265,7 @@ static void last_status_rec(frame_T *fr, bool statusline)
fp = fr;
while (fp->fr_height <= frame_minheight(fp, NULL)) {
if (fp == topframe) {
- EMSG(_(e_noroom));
+ emsg(_(e_noroom));
return;
}
// In a column of frames: go to frame above. If already at
@@ -6675,16 +6675,16 @@ int match_add(win_T *wp, const char *const grp, const char *const pat, int prio,
return -1;
}
if (id < -1 || id == 0) {
- EMSGN(_("E799: Invalid ID: %" PRId64
+ semsg(_("E799: Invalid ID: %" PRId64
" (must be greater than or equal to 1)"),
- id);
+ (int64_t)id);
return -1;
}
if (id != -1) {
cur = wp->w_match_head;
while (cur != NULL) {
if (cur->id == id) {
- EMSGN(_("E801: ID already taken: %" PRId64), id);
+ semsg(_("E801: ID already taken: %" PRId64), (int64_t)id);
return -1;
}
cur = cur->next;
@@ -6694,7 +6694,7 @@ int match_add(win_T *wp, const char *const grp, const char *const pat, int prio,
return -1;
}
if (pat != NULL && (regprog = vim_regcomp((char_u *)pat, RE_MAGIC)) == NULL) {
- EMSG2(_(e_invarg2), pat);
+ semsg(_(e_invarg2), pat);
return -1;
}
@@ -6740,7 +6740,7 @@ int match_add(win_T *wp, const char *const grp, const char *const pat, int prio,
const list_T *const subl = TV_LIST_ITEM_TV(li)->vval.v_list;
const listitem_T *subli = tv_list_first(subl);
if (subli == NULL) {
- emsgf(_("E5030: Empty list at position %d"),
+ semsg(_("E5030: Empty list at position %d"),
(int)tv_list_idx_of_item(pos_list, li));
goto fail;
}
@@ -6782,7 +6782,7 @@ int match_add(win_T *wp, const char *const grp, const char *const pat, int prio,
m->pos.pos[i].col = 0;
m->pos.pos[i].len = 0;
} else {
- emsgf(_("E5031: List or number required at position %d"),
+ semsg(_("E5031: List or number required at position %d"),
(int)tv_list_idx_of_item(pos_list, li));
goto fail;
}
@@ -6854,9 +6854,9 @@ int match_delete(win_T *wp, int id, bool perr)
if (id < 1) {
if (perr) {
- EMSGN(_("E802: Invalid ID: %" PRId64
+ semsg(_("E802: Invalid ID: %" PRId64
" (must be greater than or equal to 1)"),
- id);
+ (int64_t)id);
}
return -1;
}
@@ -6866,7 +6866,7 @@ int match_delete(win_T *wp, int id, bool perr)
}
if (cur == NULL) {
if (perr) {
- EMSGN(_("E803: ID not found: %" PRId64), id);
+ semsg(_("E803: ID not found: %" PRId64), (int64_t)id);
}
return -1;
}