comparison src/edit.c @ 15470:55ccc2d353bd v8.1.0743

patch 8.1.0743: giving error messages is not flexible commit https://github.com/vim/vim/commit/f9e3e09fdc93be9f0d47afbc6c7df1188c2a5a0d Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jan 13 23:38:42 2019 +0100 patch 8.1.0743: giving error messages is not flexible Problem: Giving error messages is not flexible. Solution: Add semsg(). Change argument from "char_u *" to "char *", also for msg() and get rid of most MSG macros. (Ozaki Kiichi, closes #3302) Also make emsg() accept a "char *" argument. Get rid of an enormous number of type casts.
author Bram Moolenaar <Bram@vim.org>
date Sun, 13 Jan 2019 23:45:08 +0100
parents 5ecac7734184
children 6d949e552e99
comparison
equal deleted inserted replaced
15469:bc9b5261ed01 15470:55ccc2d353bd
358 358
359 #ifdef HAVE_SANDBOX 359 #ifdef HAVE_SANDBOX
360 /* Don't allow inserting in the sandbox. */ 360 /* Don't allow inserting in the sandbox. */
361 if (sandbox != 0) 361 if (sandbox != 0)
362 { 362 {
363 EMSG(_(e_sandbox)); 363 emsg(_(e_sandbox));
364 return FALSE; 364 return FALSE;
365 } 365 }
366 #endif 366 #endif
367 /* Don't allow changes in the buffer while editing the cmdline. The 367 /* Don't allow changes in the buffer while editing the cmdline. The
368 * caller of getcmdline() may get confused. */ 368 * caller of getcmdline() may get confused. */
369 if (textlock != 0) 369 if (textlock != 0)
370 { 370 {
371 EMSG(_(e_secure)); 371 emsg(_(e_secure));
372 return FALSE; 372 return FALSE;
373 } 373 }
374 374
375 #ifdef FEAT_INS_EXPAND 375 #ifdef FEAT_INS_EXPAND
376 /* Don't allow recursive insert mode when busy with completion. */ 376 /* Don't allow recursive insert mode when busy with completion. */
377 if (compl_started || compl_busy || pum_visible()) 377 if (compl_started || compl_busy || pum_visible())
378 { 378 {
379 EMSG(_(e_secure)); 379 emsg(_(e_secure));
380 return FALSE; 380 return FALSE;
381 } 381 }
382 ins_compl_clear(); /* clear stuff for CTRL-X mode */ 382 ins_compl_clear(); /* clear stuff for CTRL-X mode */
383 #endif 383 #endif
384 384
474 { 474 {
475 #ifdef FEAT_FKMAP 475 #ifdef FEAT_FKMAP
476 if (p_fkmap && p_ri) 476 if (p_fkmap && p_ri)
477 { 477 {
478 beep_flush(); 478 beep_flush();
479 EMSG(farsi_text_3); /* encoded in Farsi */ 479 emsg(farsi_text_3); /* encoded in Farsi */
480 State = INSERT; 480 State = INSERT;
481 } 481 }
482 else 482 else
483 #endif 483 #endif
484 State = REPLACE; 484 State = REPLACE;
4260 } 4260 }
4261 } 4261 }
4262 4262
4263 if (curwin_save != curwin || curbuf_save != curbuf) 4263 if (curwin_save != curwin || curbuf_save != curbuf)
4264 { 4264 {
4265 EMSG(_(e_complwin)); 4265 emsg(_(e_complwin));
4266 goto theend; 4266 goto theend;
4267 } 4267 }
4268 curwin->w_cursor = pos; /* restore the cursor position */ 4268 curwin->w_cursor = pos; /* restore the cursor position */
4269 validate_cursor(); 4269 validate_cursor();
4270 if (!EQUAL_POS(curwin->w_cursor, pos)) 4270 if (!EQUAL_POS(curwin->w_cursor, pos))
4271 { 4271 {
4272 EMSG(_(e_compldel)); 4272 emsg(_(e_compldel));
4273 goto theend; 4273 goto theend;
4274 } 4274 }
4275 4275
4276 if (matchlist != NULL) 4276 if (matchlist != NULL)
4277 ins_compl_add_list(matchlist); 4277 ins_compl_add_list(matchlist);
5565 * string */ 5565 * string */
5566 funcname = ctrl_x_mode == CTRL_X_FUNCTION 5566 funcname = ctrl_x_mode == CTRL_X_FUNCTION
5567 ? curbuf->b_p_cfu : curbuf->b_p_ofu; 5567 ? curbuf->b_p_cfu : curbuf->b_p_ofu;
5568 if (*funcname == NUL) 5568 if (*funcname == NUL)
5569 { 5569 {
5570 EMSG2(_(e_notset), ctrl_x_mode == CTRL_X_FUNCTION 5570 semsg(_(e_notset), ctrl_x_mode == CTRL_X_FUNCTION
5571 ? "completefunc" : "omnifunc"); 5571 ? "completefunc" : "omnifunc");
5572 /* restore did_ai, so that adding comment leader works */ 5572 /* restore did_ai, so that adding comment leader works */
5573 did_ai = save_did_ai; 5573 did_ai = save_did_ai;
5574 return FAIL; 5574 return FAIL;
5575 } 5575 }
5585 col = call_func_retnr(funcname, 2, args); 5585 col = call_func_retnr(funcname, 2, args);
5586 5586
5587 State = save_State; 5587 State = save_State;
5588 if (curwin_save != curwin || curbuf_save != curbuf) 5588 if (curwin_save != curwin || curbuf_save != curbuf)
5589 { 5589 {
5590 EMSG(_(e_complwin)); 5590 emsg(_(e_complwin));
5591 return FAIL; 5591 return FAIL;
5592 } 5592 }
5593 curwin->w_cursor = pos; /* restore the cursor position */ 5593 curwin->w_cursor = pos; /* restore the cursor position */
5594 validate_cursor(); 5594 validate_cursor();
5595 if (!EQUAL_POS(curwin->w_cursor, pos)) 5595 if (!EQUAL_POS(curwin->w_cursor, pos))
5596 { 5596 {
5597 EMSG(_(e_compldel)); 5597 emsg(_(e_compldel));
5598 return FAIL; 5598 return FAIL;
5599 } 5599 }
5600 5600
5601 /* Return value -2 means the user complete function wants to 5601 /* Return value -2 means the user complete function wants to
5602 * cancel the complete without an error. 5602 * cancel the complete without an error.
7676 char_u last = NUL; 7676 char_u last = NUL;
7677 7677
7678 ptr = get_last_insert(); 7678 ptr = get_last_insert();
7679 if (ptr == NULL) 7679 if (ptr == NULL)
7680 { 7680 {
7681 EMSG(_(e_noinstext)); 7681 emsg(_(e_noinstext));
7682 return FAIL; 7682 return FAIL;
7683 } 7683 }
7684 7684
7685 /* may want to stuff the command character, to start Insert mode */ 7685 /* may want to stuff the command character, to start Insert mode */
7686 if (c != NUL) 7686 if (c != NUL)
8967 { 8967 {
8968 #ifdef FEAT_FKMAP 8968 #ifdef FEAT_FKMAP
8969 if (p_fkmap && p_ri) 8969 if (p_fkmap && p_ri)
8970 { 8970 {
8971 beep_flush(); 8971 beep_flush();
8972 EMSG(farsi_text_3); /* encoded in Farsi */ 8972 emsg(farsi_text_3); /* encoded in Farsi */
8973 return; 8973 return;
8974 } 8974 }
8975 #endif 8975 #endif
8976 8976
8977 # ifdef FEAT_EVAL 8977 # ifdef FEAT_EVAL