aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/buffer.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/buffer.c')
-rw-r--r--src/nvim/buffer.c64
1 files changed, 32 insertions, 32 deletions
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;