comparison src/fileio.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 3e2e1608efa4
children 41fbbcea0f1b
comparison
equal deleted inserted replaced
15469:bc9b5261ed01 15470:55ccc2d353bd
593 || (using_b_ffname 593 || (using_b_ffname
594 && (old_b_ffname != curbuf->b_ffname)) 594 && (old_b_ffname != curbuf->b_ffname))
595 || (using_b_fname 595 || (using_b_fname
596 && (old_b_fname != curbuf->b_fname))) 596 && (old_b_fname != curbuf->b_fname)))
597 { 597 {
598 EMSG(_(e_auchangedbuf)); 598 emsg(_(e_auchangedbuf));
599 return FAIL; 599 return FAIL;
600 } 600 }
601 } 601 }
602 if (dir_of_file_exists(fname)) 602 if (dir_of_file_exists(fname))
603 filemess(curbuf, sfname, (char_u *)_("[New File]"), 0); 603 filemess(curbuf, sfname, (char_u *)_("[New File]"), 0);
674 check_need_swap(newfile); 674 check_need_swap(newfile);
675 if (!read_stdin && (curbuf != old_curbuf 675 if (!read_stdin && (curbuf != old_curbuf
676 || (using_b_ffname && (old_b_ffname != curbuf->b_ffname)) 676 || (using_b_ffname && (old_b_ffname != curbuf->b_ffname))
677 || (using_b_fname && (old_b_fname != curbuf->b_fname)))) 677 || (using_b_fname && (old_b_fname != curbuf->b_fname))))
678 { 678 {
679 EMSG(_(e_auchangedbuf)); 679 emsg(_(e_auchangedbuf));
680 if (!read_buffer) 680 if (!read_buffer)
681 close(fd); 681 close(fd);
682 return FAIL; 682 return FAIL;
683 } 683 }
684 #ifdef UNIX 684 #ifdef UNIX
796 || (fd = mch_open((char *)fname, O_RDONLY | O_EXTRA, 0)) < 0)) 796 || (fd = mch_open((char *)fname, O_RDONLY | O_EXTRA, 0)) < 0))
797 { 797 {
798 --no_wait_return; 798 --no_wait_return;
799 msg_scroll = msg_save; 799 msg_scroll = msg_save;
800 if (fd < 0) 800 if (fd < 0)
801 EMSG(_("E200: *ReadPre autocommands made the file unreadable")); 801 emsg(_("E200: *ReadPre autocommands made the file unreadable"));
802 else 802 else
803 EMSG(_("E201: *ReadPre autocommands must not change current buffer")); 803 emsg(_("E201: *ReadPre autocommands must not change current buffer"));
804 curbuf->b_p_ro = TRUE; /* must use "w!" now */ 804 curbuf->b_p_ro = TRUE; /* must use "w!" now */
805 return FAIL; 805 return FAIL;
806 } 806 }
807 } 807 }
808 808
1126 /* Conversion failed. Try another one. */ 1126 /* Conversion failed. Try another one. */
1127 advance_fenc = TRUE; 1127 advance_fenc = TRUE;
1128 if (fd < 0) 1128 if (fd < 0)
1129 { 1129 {
1130 /* Re-opening the original file failed! */ 1130 /* Re-opening the original file failed! */
1131 EMSG(_("E202: Conversion made file unreadable!")); 1131 emsg(_("E202: Conversion made file unreadable!"));
1132 error = TRUE; 1132 error = TRUE;
1133 goto failed; 1133 goto failed;
1134 } 1134 }
1135 goto retry; 1135 goto retry;
1136 } 1136 }
2991 { 2991 {
2992 /* When newfile is TRUE, store the typed key in the 'key' 2992 /* When newfile is TRUE, store the typed key in the 'key'
2993 * option and don't free it. bf needs hash of the key saved. 2993 * option and don't free it. bf needs hash of the key saved.
2994 * Don't ask for the key again when first time Enter was hit. 2994 * Don't ask for the key again when first time Enter was hit.
2995 * Happens when retrying to detect encoding. */ 2995 * Happens when retrying to detect encoding. */
2996 smsg((char_u *)_(need_key_msg), fname); 2996 smsg(_(need_key_msg), fname);
2997 msg_scroll = TRUE; 2997 msg_scroll = TRUE;
2998 crypt_check_method(method); 2998 crypt_check_method(method);
2999 cryptkey = crypt_get_key(newfile, FALSE); 2999 cryptkey = crypt_get_key(newfile, FALSE);
3000 *did_ask = TRUE; 3000 *did_ask = TRUE;
3001 3001
3195 return FAIL; 3195 return FAIL;
3196 if (buf->b_ml.ml_mfp == NULL) 3196 if (buf->b_ml.ml_mfp == NULL)
3197 { 3197 {
3198 /* This can happen during startup when there is a stray "w" in the 3198 /* This can happen during startup when there is a stray "w" in the
3199 * vimrc file. */ 3199 * vimrc file. */
3200 EMSG(_(e_emptybuf)); 3200 emsg(_(e_emptybuf));
3201 return FAIL; 3201 return FAIL;
3202 } 3202 }
3203 3203
3204 /* 3204 /*
3205 * Disallow writing from .exrc and .vimrc in current directory for 3205 * Disallow writing from .exrc and .vimrc in current directory for
3209 return FAIL; 3209 return FAIL;
3210 3210
3211 /* Avoid a crash for a long name. */ 3211 /* Avoid a crash for a long name. */
3212 if (STRLEN(fname) >= MAXPATHL) 3212 if (STRLEN(fname) >= MAXPATHL)
3213 { 3213 {
3214 EMSG(_(e_longname)); 3214 emsg(_(e_longname));
3215 return FAIL; 3215 return FAIL;
3216 } 3216 }
3217 3217
3218 #ifdef FEAT_MBYTE 3218 #ifdef FEAT_MBYTE
3219 /* must init bw_conv_buf and bw_iconv_fd before jumping to "fail" */ 3219 /* must init bw_conv_buf and bw_iconv_fd before jumping to "fail" */
3397 ) 3397 )
3398 { 3398 {
3399 --no_wait_return; 3399 --no_wait_return;
3400 msg_scroll = msg_save; 3400 msg_scroll = msg_save;
3401 if (nofile_err) 3401 if (nofile_err)
3402 EMSG(_("E676: No matching autocommands for acwrite buffer")); 3402 emsg(_("E676: No matching autocommands for acwrite buffer"));
3403 3403
3404 if (nofile_err 3404 if (nofile_err
3405 #ifdef FEAT_EVAL 3405 #ifdef FEAT_EVAL
3406 || aborting() 3406 || aborting()
3407 #endif 3407 #endif
3432 return OK; 3432 return OK;
3433 } 3433 }
3434 #ifdef FEAT_EVAL 3434 #ifdef FEAT_EVAL
3435 if (!aborting()) 3435 if (!aborting())
3436 #endif 3436 #endif
3437 EMSG(_("E203: Autocommands deleted or unloaded buffer to be written")); 3437 emsg(_("E203: Autocommands deleted or unloaded buffer to be written"));
3438 return FAIL; 3438 return FAIL;
3439 } 3439 }
3440 3440
3441 /* 3441 /*
3442 * The autocommands may have changed the number of lines in the file. 3442 * The autocommands may have changed the number of lines in the file.
3455 end -= old_line_count - buf->b_ml.ml_line_count; 3455 end -= old_line_count - buf->b_ml.ml_line_count;
3456 if (end < start) 3456 if (end < start)
3457 { 3457 {
3458 --no_wait_return; 3458 --no_wait_return;
3459 msg_scroll = msg_save; 3459 msg_scroll = msg_save;
3460 EMSG(_("E204: Autocommand changed number of lines in unexpected way")); 3460 emsg(_("E204: Autocommand changed number of lines in unexpected way"));
3461 return FAIL; 3461 return FAIL;
3462 } 3462 }
3463 } 3463 }
3464 } 3464 }
3465 3465
5053 /* 5053 /*
5054 * If the original file does not exist yet 5054 * If the original file does not exist yet
5055 * the current backup file becomes the original file 5055 * the current backup file becomes the original file
5056 */ 5056 */
5057 if (org == NULL) 5057 if (org == NULL)
5058 EMSG(_("E205: Patchmode: can't save original file")); 5058 emsg(_("E205: Patchmode: can't save original file"));
5059 else if (mch_stat(org, &st) < 0) 5059 else if (mch_stat(org, &st) < 0)
5060 { 5060 {
5061 vim_rename(backup, (char_u *)org); 5061 vim_rename(backup, (char_u *)org);
5062 VIM_CLEAR(backup); /* don't delete the file */ 5062 VIM_CLEAR(backup); /* don't delete the file */
5063 #ifdef UNIX 5063 #ifdef UNIX
5075 5075
5076 if (org == NULL 5076 if (org == NULL
5077 || (empty_fd = mch_open(org, 5077 || (empty_fd = mch_open(org,
5078 O_CREAT | O_EXTRA | O_EXCL | O_NOFOLLOW, 5078 O_CREAT | O_EXTRA | O_EXCL | O_NOFOLLOW,
5079 perm < 0 ? 0666 : (perm & 0777))) < 0) 5079 perm < 0 ? 0666 : (perm & 0777))) < 0)
5080 EMSG(_("E206: patchmode: can't touch empty original file")); 5080 emsg(_("E206: patchmode: can't touch empty original file"));
5081 else 5081 else
5082 close(empty_fd); 5082 close(empty_fd);
5083 } 5083 }
5084 if (org != NULL) 5084 if (org != NULL)
5085 { 5085 {
5090 5090
5091 /* 5091 /*
5092 * Remove the backup unless 'backup' option is set 5092 * Remove the backup unless 'backup' option is set
5093 */ 5093 */
5094 if (!p_bk && backup != NULL && mch_remove(backup) != 0) 5094 if (!p_bk && backup != NULL && mch_remove(backup) != 0)
5095 EMSG(_("E207: Can't delete backup file")); 5095 emsg(_("E207: Can't delete backup file"));
5096 5096
5097 #ifdef FEAT_SUN_WORKSHOP 5097 #ifdef FEAT_SUN_WORKSHOP
5098 if (usingSunWorkShop) 5098 if (usingSunWorkShop)
5099 workshop_file_saved((char *) ffname); 5099 workshop_file_saved((char *) ffname);
5100 #endif 5100 #endif
5149 { 5149 {
5150 STRMOVE(IObuff + numlen, IObuff); 5150 STRMOVE(IObuff + numlen, IObuff);
5151 mch_memmove(IObuff, errnum, (size_t)numlen); 5151 mch_memmove(IObuff, errnum, (size_t)numlen);
5152 } 5152 }
5153 STRCAT(IObuff, errmsg); 5153 STRCAT(IObuff, errmsg);
5154 emsg(IObuff); 5154 emsg((char *)IObuff);
5155 if (errmsg_allocated) 5155 if (errmsg_allocated)
5156 vim_free(errmsg); 5156 vim_free(errmsg);
5157 5157
5158 retval = FAIL; 5158 retval = FAIL;
5159 if (end == 0) 5159 if (end == 0)
5249 return FAIL; 5249 return FAIL;
5250 #endif 5250 #endif
5251 if (curbuf != buf) 5251 if (curbuf != buf)
5252 { 5252 {
5253 /* We are in another buffer now, don't do the renaming. */ 5253 /* We are in another buffer now, don't do the renaming. */
5254 EMSG(_(e_auchangedbuf)); 5254 emsg(_(e_auchangedbuf));
5255 return FAIL; 5255 return FAIL;
5256 } 5256 }
5257 5257
5258 if (setfname(curbuf, fname, sfname, FALSE) == OK) 5258 if (setfname(curbuf, fname, sfname, FALSE) == OK)
5259 curbuf->b_flags |= BF_NOTEDITED; 5259 curbuf->b_flags |= BF_NOTEDITED;
6730 #if defined(HAVE_SELINUX) || defined(HAVE_SMACK) 6730 #if defined(HAVE_SELINUX) || defined(HAVE_SMACK)
6731 mch_copy_sec(from, to); 6731 mch_copy_sec(from, to);
6732 #endif 6732 #endif
6733 if (errmsg != NULL) 6733 if (errmsg != NULL)
6734 { 6734 {
6735 EMSG2(errmsg, to); 6735 semsg(errmsg, to);
6736 return -1; 6736 return -1;
6737 } 6737 }
6738 mch_remove(from); 6738 mch_remove(from);
6739 return 0; 6739 return 0;
6740 } 6740 }
6870 { 6870 {
6871 stat_T st; 6871 stat_T st;
6872 int stat_res; 6872 int stat_res;
6873 int retval = 0; 6873 int retval = 0;
6874 char_u *path; 6874 char_u *path;
6875 char_u *tbuf; 6875 char *tbuf;
6876 char *mesg = NULL; 6876 char *mesg = NULL;
6877 char *mesg2 = ""; 6877 char *mesg2 = "";
6878 int helpmesg = FALSE; 6878 int helpmesg = FALSE;
6879 int reload = FALSE; 6879 int reload = FALSE;
6880 char *reason; 6880 char *reason;
6981 --allbuf_lock; 6981 --allbuf_lock;
6982 busy = FALSE; 6982 busy = FALSE;
6983 if (n) 6983 if (n)
6984 { 6984 {
6985 if (!bufref_valid(&bufref)) 6985 if (!bufref_valid(&bufref))
6986 EMSG(_("E246: FileChangedShell autocommand deleted buffer")); 6986 emsg(_("E246: FileChangedShell autocommand deleted buffer"));
6987 #ifdef FEAT_EVAL 6987 #ifdef FEAT_EVAL
6988 s = get_vim_var_str(VV_FCS_CHOICE); 6988 s = get_vim_var_str(VV_FCS_CHOICE);
6989 if (STRCMP(s, "reload") == 0 && *reason != 'd') 6989 if (STRCMP(s, "reload") == 0 && *reason != 'd')
6990 reload = TRUE; 6990 reload = TRUE;
6991 else if (STRCMP(s, "ask") == 0) 6991 else if (STRCMP(s, "ask") == 0)
7050 path = home_replace_save(buf, buf->b_fname); 7050 path = home_replace_save(buf, buf->b_fname);
7051 if (path != NULL) 7051 if (path != NULL)
7052 { 7052 {
7053 if (!helpmesg) 7053 if (!helpmesg)
7054 mesg2 = ""; 7054 mesg2 = "";
7055 tbuf = alloc((unsigned)(STRLEN(path) + STRLEN(mesg) 7055 tbuf = (char *)alloc((unsigned)(STRLEN(path) + STRLEN(mesg)
7056 + STRLEN(mesg2) + 2)); 7056 + STRLEN(mesg2) + 2));
7057 sprintf((char *)tbuf, mesg, path); 7057 sprintf(tbuf, mesg, path);
7058 #ifdef FEAT_EVAL 7058 #ifdef FEAT_EVAL
7059 /* Set warningmsg here, before the unimportant and output-specific 7059 /* Set warningmsg here, before the unimportant and output-specific
7060 * mesg2 has been appended. */ 7060 * mesg2 has been appended. */
7061 set_vim_var_string(VV_WARNINGMSG, tbuf, -1); 7061 set_vim_var_string(VV_WARNINGMSG, (char_u *)tbuf, -1);
7062 #endif 7062 #endif
7063 #if defined(FEAT_CON_DIALOG) || defined(FEAT_GUI_DIALOG) 7063 #if defined(FEAT_CON_DIALOG) || defined(FEAT_GUI_DIALOG)
7064 if (can_reload) 7064 if (can_reload)
7065 { 7065 {
7066 if (*mesg2 != NUL) 7066 if (*mesg2 != NUL)
7067 { 7067 {
7068 STRCAT(tbuf, "\n"); 7068 STRCAT(tbuf, "\n");
7069 STRCAT(tbuf, mesg2); 7069 STRCAT(tbuf, mesg2);
7070 } 7070 }
7071 if (do_dialog(VIM_WARNING, (char_u *)_("Warning"), tbuf, 7071 if (do_dialog(VIM_WARNING, (char_u *)_("Warning"),
7072 (char_u *)tbuf,
7072 (char_u *)_("&OK\n&Load File"), 1, NULL, TRUE) == 2) 7073 (char_u *)_("&OK\n&Load File"), 1, NULL, TRUE) == 2)
7073 reload = TRUE; 7074 reload = TRUE;
7074 } 7075 }
7075 else 7076 else
7076 #endif 7077 #endif
7079 if (*mesg2 != NUL) 7080 if (*mesg2 != NUL)
7080 { 7081 {
7081 STRCAT(tbuf, "; "); 7082 STRCAT(tbuf, "; ");
7082 STRCAT(tbuf, mesg2); 7083 STRCAT(tbuf, mesg2);
7083 } 7084 }
7084 EMSG(tbuf); 7085 emsg(tbuf);
7085 retval = 2; 7086 retval = 2;
7086 } 7087 }
7087 else 7088 else
7088 { 7089 {
7089 if (!autocmd_busy) 7090 if (!autocmd_busy)
7090 { 7091 {
7091 msg_start(); 7092 msg_start();
7092 msg_puts_attr(tbuf, HL_ATTR(HLF_E) + MSG_HIST); 7093 msg_puts_attr((char_u *)tbuf, HL_ATTR(HLF_E) + MSG_HIST);
7093 if (*mesg2 != NUL) 7094 if (*mesg2 != NUL)
7094 msg_puts_attr((char_u *)mesg2, 7095 msg_puts_attr((char_u *)mesg2,
7095 HL_ATTR(HLF_W) + MSG_HIST); 7096 HL_ATTR(HLF_W) + MSG_HIST);
7096 msg_clr_eos(); 7097 msg_clr_eos();
7097 (void)msg_end(); 7098 (void)msg_end();
7211 curwin->w_buffer = buf; 7212 curwin->w_buffer = buf;
7212 } 7213 }
7213 if (savebuf == NULL || saved == FAIL || buf != curbuf 7214 if (savebuf == NULL || saved == FAIL || buf != curbuf
7214 || move_lines(buf, savebuf) == FAIL) 7215 || move_lines(buf, savebuf) == FAIL)
7215 { 7216 {
7216 EMSG2(_("E462: Could not prepare for reloading \"%s\""), 7217 semsg(_("E462: Could not prepare for reloading \"%s\""),
7217 buf->b_fname); 7218 buf->b_fname);
7218 saved = FAIL; 7219 saved = FAIL;
7219 } 7220 }
7220 } 7221 }
7221 7222
7228 (linenr_T)MAXLNUM, &ea, flags) != OK) 7229 (linenr_T)MAXLNUM, &ea, flags) != OK)
7229 { 7230 {
7230 #if defined(FEAT_EVAL) 7231 #if defined(FEAT_EVAL)
7231 if (!aborting()) 7232 if (!aborting())
7232 #endif 7233 #endif
7233 EMSG2(_("E321: Could not reload \"%s\""), buf->b_fname); 7234 semsg(_("E321: Could not reload \"%s\""), buf->b_fname);
7234 if (savebuf != NULL && bufref_valid(&bufref) && buf == curbuf) 7235 if (savebuf != NULL && bufref_valid(&bufref) && buf == curbuf)
7235 { 7236 {
7236 /* Put the text back from the save buffer. First 7237 /* Put the text back from the save buffer. First
7237 * delete any lines that readfile() added. */ 7238 * delete any lines that readfile() added. */
7238 while (!BUFEMPTY()) 7239 while (!BUFEMPTY())
8074 { 8075 {
8075 au_remove_pat(ap); 8076 au_remove_pat(ap);
8076 if (p_verbose >= 6) 8077 if (p_verbose >= 6)
8077 { 8078 {
8078 verbose_enter(); 8079 verbose_enter();
8079 smsg((char_u *) 8080 smsg(_("auto-removing autocommand: %s <buffer=%d>"),
8080 _("auto-removing autocommand: %s <buffer=%d>"),
8081 event_nr2name(event), buf->b_fnum); 8081 event_nr2name(event), buf->b_fnum);
8082 verbose_leave(); 8082 verbose_leave();
8083 } 8083 }
8084 } 8084 }
8085 au_cleanup(); 8085 au_cleanup();
8119 { 8119 {
8120 int i; 8120 int i;
8121 8121
8122 i = au_find_group(name); 8122 i = au_find_group(name);
8123 if (i == AUGROUP_ERROR) /* the group doesn't exist */ 8123 if (i == AUGROUP_ERROR) /* the group doesn't exist */
8124 EMSG2(_("E367: No such group: \"%s\""), name); 8124 semsg(_("E367: No such group: \"%s\""), name);
8125 else if (i == current_augroup) 8125 else if (i == current_augroup)
8126 EMSG(_("E936: Cannot delete the current group")); 8126 emsg(_("E936: Cannot delete the current group"));
8127 else 8127 else
8128 { 8128 {
8129 event_T event; 8129 event_T event;
8130 AutoPat *ap; 8130 AutoPat *ap;
8131 int in_use = FALSE; 8131 int in_use = FALSE;
8186 int i; 8186 int i;
8187 8187
8188 if (del_group) 8188 if (del_group)
8189 { 8189 {
8190 if (*arg == NUL) 8190 if (*arg == NUL)
8191 EMSG(_(e_argreq)); 8191 emsg(_(e_argreq));
8192 else 8192 else
8193 au_del_group(arg); 8193 au_del_group(arg);
8194 } 8194 }
8195 else if (STRICMP(arg, "end") == 0) /* ":aug end": back to group 0 */ 8195 else if (STRICMP(arg, "end") == 0) /* ":aug end": back to group 0 */
8196 current_augroup = AUGROUP_DEFAULT; 8196 current_augroup = AUGROUP_DEFAULT;
8293 8293
8294 if (*arg == '*') 8294 if (*arg == '*')
8295 { 8295 {
8296 if (arg[1] && !VIM_ISWHITE(arg[1])) 8296 if (arg[1] && !VIM_ISWHITE(arg[1]))
8297 { 8297 {
8298 EMSG2(_("E215: Illegal character after *: %s"), arg); 8298 semsg(_("E215: Illegal character after *: %s"), arg);
8299 return NULL; 8299 return NULL;
8300 } 8300 }
8301 pat = arg + 1; 8301 pat = arg + 1;
8302 } 8302 }
8303 else 8303 else
8305 for (pat = arg; *pat && *pat != '|' && !VIM_ISWHITE(*pat); pat = p) 8305 for (pat = arg; *pat && *pat != '|' && !VIM_ISWHITE(*pat); pat = p)
8306 { 8306 {
8307 if ((int)event_name2nr(pat, &p) >= (int)NUM_EVENTS) 8307 if ((int)event_name2nr(pat, &p) >= (int)NUM_EVENTS)
8308 { 8308 {
8309 if (have_group) 8309 if (have_group)
8310 EMSG2(_("E216: No such event: %s"), pat); 8310 semsg(_("E216: No such event: %s"), pat);
8311 else 8311 else
8312 EMSG2(_("E216: No such group or event: %s"), pat); 8312 semsg(_("E216: No such group or event: %s"), pat);
8313 return NULL; 8313 return NULL;
8314 } 8314 }
8315 } 8315 }
8316 } 8316 }
8317 return pat; 8317 return pat;
8771 { 8771 {
8772 /* refuse to add buffer-local ap if buffer number is invalid */ 8772 /* refuse to add buffer-local ap if buffer number is invalid */
8773 if (is_buflocal && (buflocal_nr == 0 8773 if (is_buflocal && (buflocal_nr == 0
8774 || buflist_findnr(buflocal_nr) == NULL)) 8774 || buflist_findnr(buflocal_nr) == NULL))
8775 { 8775 {
8776 EMSGN(_("E680: <buffer=%d>: invalid buffer number "), 8776 semsg(_("E680: <buffer=%d>: invalid buffer number "),
8777 buflocal_nr); 8777 buflocal_nr);
8778 return FAIL; 8778 return FAIL;
8779 } 8779 }
8780 8780
8781 ap = (AutoPat *)alloc((unsigned)sizeof(AutoPat)); 8781 ap = (AutoPat *)alloc((unsigned)sizeof(AutoPat));
8874 if (arg == NULL) /* out of memory */ 8874 if (arg == NULL) /* out of memory */
8875 return FAIL; 8875 return FAIL;
8876 8876
8877 if (*arg == '*') 8877 if (*arg == '*')
8878 { 8878 {
8879 EMSG(_("E217: Can't execute autocommands for ALL events")); 8879 emsg(_("E217: Can't execute autocommands for ALL events"));
8880 return FAIL; 8880 return FAIL;
8881 } 8881 }
8882 8882
8883 /* 8883 /*
8884 * Scan over the events. 8884 * Scan over the events.
9459 * Allow nesting of autocommands, but restrict the depth, because it's 9459 * Allow nesting of autocommands, but restrict the depth, because it's
9460 * possible to create an endless loop. 9460 * possible to create an endless loop.
9461 */ 9461 */
9462 if (nesting == 10) 9462 if (nesting == 10)
9463 { 9463 {
9464 EMSG(_("E218: autocommand nesting too deep")); 9464 emsg(_("E218: autocommand nesting too deep"));
9465 goto BYPASS_AU; 9465 goto BYPASS_AU;
9466 } 9466 }
9467 9467
9468 /* 9468 /*
9469 * Check if these autocommands are disabled. Used when doing ":all" or 9469 * Check if these autocommands are disabled. Used when doing ":all" or
9867 sprintf((char *)sourcing_name, s, 9867 sprintf((char *)sourcing_name, s,
9868 (char *)name, (char *)ap->pat); 9868 (char *)name, (char *)ap->pat);
9869 if (p_verbose >= 8) 9869 if (p_verbose >= 8)
9870 { 9870 {
9871 verbose_enter(); 9871 verbose_enter();
9872 smsg((char_u *)_("Executing %s"), sourcing_name); 9872 smsg(_("Executing %s"), sourcing_name);
9873 verbose_leave(); 9873 verbose_leave();
9874 } 9874 }
9875 } 9875 }
9876 9876
9877 apc->curpat = ap; 9877 apc->curpat = ap;
9933 ac = acp->nextcmd; 9933 ac = acp->nextcmd;
9934 9934
9935 if (p_verbose >= 9) 9935 if (p_verbose >= 9)
9936 { 9936 {
9937 verbose_enter_scroll(); 9937 verbose_enter_scroll();
9938 smsg((char_u *)_("autocommand %s"), ac->cmd); 9938 smsg(_("autocommand %s"), ac->cmd);
9939 msg_puts((char_u *)"\n"); /* don't overwrite this either */ 9939 msg_puts((char_u *)"\n"); /* don't overwrite this either */
9940 verbose_leave_scroll(); 9940 verbose_leave_scroll();
9941 } 9941 }
9942 retval = vim_strsave(ac->cmd); 9942 retval = vim_strsave(ac->cmd);
9943 autocmd_nested = ac->nested; 9943 autocmd_nested = ac->nested;
10481 reg_pat[i++] = '$'; 10481 reg_pat[i++] = '$';
10482 reg_pat[i] = NUL; 10482 reg_pat[i] = NUL;
10483 if (nested != 0) 10483 if (nested != 0)
10484 { 10484 {
10485 if (nested < 0) 10485 if (nested < 0)
10486 EMSG(_("E219: Missing {.")); 10486 emsg(_("E219: Missing {."));
10487 else 10487 else
10488 EMSG(_("E220: Missing }.")); 10488 emsg(_("E220: Missing }."));
10489 VIM_CLEAR(reg_pat); 10489 VIM_CLEAR(reg_pat);
10490 } 10490 }
10491 return reg_pat; 10491 return reg_pat;
10492 } 10492 }
10493 10493