Mercurial > vim
comparison src/fileio.c @ 661:e93a99ef31d0
updated for version 7.0195
author | vimboss |
---|---|
date | Thu, 09 Feb 2006 23:53:20 +0000 |
parents | 8157079cea85 |
children | db58b9066b21 |
comparison
equal
deleted
inserted
replaced
660:13296f8d1d3d | 661:e93a99ef31d0 |
---|---|
63 static int msg_add_fileformat __ARGS((int eol_type)); | 63 static int msg_add_fileformat __ARGS((int eol_type)); |
64 static void msg_add_eol __ARGS((void)); | 64 static void msg_add_eol __ARGS((void)); |
65 static int check_mtime __ARGS((buf_T *buf, struct stat *s)); | 65 static int check_mtime __ARGS((buf_T *buf, struct stat *s)); |
66 static int time_differs __ARGS((long t1, long t2)); | 66 static int time_differs __ARGS((long t1, long t2)); |
67 #ifdef FEAT_AUTOCMD | 67 #ifdef FEAT_AUTOCMD |
68 static int apply_autocmds_exarg __ARGS((EVENT_T event, char_u *fname, char_u *fname_io, int force, buf_T *buf, exarg_T *eap)); | 68 static int apply_autocmds_exarg __ARGS((event_T event, char_u *fname, char_u *fname_io, int force, buf_T *buf, exarg_T *eap)); |
69 #endif | 69 #endif |
70 | 70 |
71 #if defined(FEAT_CRYPT) || defined(FEAT_MBYTE) | 71 #if defined(FEAT_CRYPT) || defined(FEAT_MBYTE) |
72 # define HAS_BW_FLAGS | 72 # define HAS_BW_FLAGS |
73 # define FIO_LATIN1 0x01 /* convert Latin1 */ | 73 # define FIO_LATIN1 0x01 /* convert Latin1 */ |
6892 } AutoPat; | 6892 } AutoPat; |
6893 | 6893 |
6894 static struct event_name | 6894 static struct event_name |
6895 { | 6895 { |
6896 char *name; /* event name */ | 6896 char *name; /* event name */ |
6897 EVENT_T event; /* event number */ | 6897 event_T event; /* event number */ |
6898 } event_names[] = | 6898 } event_names[] = |
6899 { | 6899 { |
6900 {"BufAdd", EVENT_BUFADD}, | 6900 {"BufAdd", EVENT_BUFADD}, |
6901 {"BufCreate", EVENT_BUFADD}, | 6901 {"BufCreate", EVENT_BUFADD}, |
6902 {"BufDelete", EVENT_BUFDELETE}, | 6902 {"BufDelete", EVENT_BUFDELETE}, |
6920 {"BufWritePre", EVENT_BUFWRITEPRE}, | 6920 {"BufWritePre", EVENT_BUFWRITEPRE}, |
6921 {"BufWriteCmd", EVENT_BUFWRITECMD}, | 6921 {"BufWriteCmd", EVENT_BUFWRITECMD}, |
6922 {"CmdwinEnter", EVENT_CMDWINENTER}, | 6922 {"CmdwinEnter", EVENT_CMDWINENTER}, |
6923 {"CmdwinLeave", EVENT_CMDWINLEAVE}, | 6923 {"CmdwinLeave", EVENT_CMDWINLEAVE}, |
6924 {"ColorScheme", EVENT_COLORSCHEME}, | 6924 {"ColorScheme", EVENT_COLORSCHEME}, |
6925 {"CursorHold", EVENT_CURSORHOLD}, | |
6926 {"CursorHoldI", EVENT_CURSORHOLDI}, | |
6927 {"CursorMoved", EVENT_CURSORMOVED}, | |
6928 {"CursorMovedI", EVENT_CURSORMOVEDI}, | |
6925 {"EncodingChanged", EVENT_ENCODINGCHANGED}, | 6929 {"EncodingChanged", EVENT_ENCODINGCHANGED}, |
6926 {"FileEncoding", EVENT_ENCODINGCHANGED}, | 6930 {"FileEncoding", EVENT_ENCODINGCHANGED}, |
6927 {"CursorHold", EVENT_CURSORHOLD}, | |
6928 {"FileAppendPost", EVENT_FILEAPPENDPOST}, | 6931 {"FileAppendPost", EVENT_FILEAPPENDPOST}, |
6929 {"FileAppendPre", EVENT_FILEAPPENDPRE}, | 6932 {"FileAppendPre", EVENT_FILEAPPENDPRE}, |
6930 {"FileAppendCmd", EVENT_FILEAPPENDCMD}, | 6933 {"FileAppendCmd", EVENT_FILEAPPENDCMD}, |
6931 {"FileChangedShell",EVENT_FILECHANGEDSHELL}, | 6934 {"FileChangedShell",EVENT_FILECHANGEDSHELL}, |
6932 {"FileChangedRO", EVENT_FILECHANGEDRO}, | 6935 {"FileChangedRO", EVENT_FILECHANGEDRO}, |
6964 {"VimEnter", EVENT_VIMENTER}, | 6967 {"VimEnter", EVENT_VIMENTER}, |
6965 {"VimLeave", EVENT_VIMLEAVE}, | 6968 {"VimLeave", EVENT_VIMLEAVE}, |
6966 {"VimLeavePre", EVENT_VIMLEAVEPRE}, | 6969 {"VimLeavePre", EVENT_VIMLEAVEPRE}, |
6967 {"WinEnter", EVENT_WINENTER}, | 6970 {"WinEnter", EVENT_WINENTER}, |
6968 {"WinLeave", EVENT_WINLEAVE}, | 6971 {"WinLeave", EVENT_WINLEAVE}, |
6969 {NULL, (EVENT_T)0} | 6972 {NULL, (event_T)0} |
6970 }; | 6973 }; |
6971 | 6974 |
6972 static AutoPat *first_autopat[NUM_EVENTS] = | 6975 static AutoPat *first_autopat[NUM_EVENTS] = |
6973 { | 6976 { |
6974 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, | 6977 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, |
6988 AutoCmd *nextcmd; /* next AutoCmd to execute */ | 6991 AutoCmd *nextcmd; /* next AutoCmd to execute */ |
6989 int group; /* group being used */ | 6992 int group; /* group being used */ |
6990 char_u *fname; /* fname to match with */ | 6993 char_u *fname; /* fname to match with */ |
6991 char_u *sfname; /* sfname to match with */ | 6994 char_u *sfname; /* sfname to match with */ |
6992 char_u *tail; /* tail of fname */ | 6995 char_u *tail; /* tail of fname */ |
6993 EVENT_T event; /* current event */ | 6996 event_T event; /* current event */ |
6994 int arg_bufnr; /* initially equal to <abuf>, set to zero when | 6997 int arg_bufnr; /* initially equal to <abuf>, set to zero when |
6995 buf is deleted */ | 6998 buf is deleted */ |
6996 struct AutoPatCmd *next; /* chain of active apc-s for auto-invalidation*/ | 6999 struct AutoPatCmd *next; /* chain of active apc-s for auto-invalidation*/ |
6997 } AutoPatCmd; | 7000 } AutoPatCmd; |
6998 | 7001 |
7012 #define AUGROUP_ALL -3 /* all autocmd groups */ | 7015 #define AUGROUP_ALL -3 /* all autocmd groups */ |
7013 static int current_augroup = AUGROUP_DEFAULT; | 7016 static int current_augroup = AUGROUP_DEFAULT; |
7014 | 7017 |
7015 static int au_need_clean = FALSE; /* need to delete marked patterns */ | 7018 static int au_need_clean = FALSE; /* need to delete marked patterns */ |
7016 | 7019 |
7017 static void show_autocmd __ARGS((AutoPat *ap, EVENT_T event)); | 7020 static void show_autocmd __ARGS((AutoPat *ap, event_T event)); |
7018 static void au_remove_pat __ARGS((AutoPat *ap)); | 7021 static void au_remove_pat __ARGS((AutoPat *ap)); |
7019 static void au_remove_cmds __ARGS((AutoPat *ap)); | 7022 static void au_remove_cmds __ARGS((AutoPat *ap)); |
7020 static void au_cleanup __ARGS((void)); | 7023 static void au_cleanup __ARGS((void)); |
7021 static int au_new_group __ARGS((char_u *name)); | 7024 static int au_new_group __ARGS((char_u *name)); |
7022 static void au_del_group __ARGS((char_u *name)); | 7025 static void au_del_group __ARGS((char_u *name)); |
7023 static int au_find_group __ARGS((char_u *name)); | 7026 static int au_find_group __ARGS((char_u *name)); |
7024 static EVENT_T event_name2nr __ARGS((char_u *start, char_u **end)); | 7027 static event_T event_name2nr __ARGS((char_u *start, char_u **end)); |
7025 static char_u *event_nr2name __ARGS((EVENT_T event)); | 7028 static char_u *event_nr2name __ARGS((event_T event)); |
7026 static char_u *find_end_event __ARGS((char_u *arg, int have_group)); | 7029 static char_u *find_end_event __ARGS((char_u *arg, int have_group)); |
7027 static int event_ignored __ARGS((EVENT_T event)); | 7030 static int event_ignored __ARGS((event_T event)); |
7028 static int au_get_grouparg __ARGS((char_u **argp)); | 7031 static int au_get_grouparg __ARGS((char_u **argp)); |
7029 static int do_autocmd_event __ARGS((EVENT_T event, char_u *pat, int nested, char_u *cmd, int forceit, int group)); | 7032 static int do_autocmd_event __ARGS((event_T event, char_u *pat, int nested, char_u *cmd, int forceit, int group)); |
7030 static char_u *getnextac __ARGS((int c, void *cookie, int indent)); | 7033 static char_u *getnextac __ARGS((int c, void *cookie, int indent)); |
7031 static int apply_autocmds_group __ARGS((EVENT_T event, char_u *fname, char_u *fname_io, int force, int group, buf_T *buf, exarg_T *eap)); | 7034 static int apply_autocmds_group __ARGS((event_T event, char_u *fname, char_u *fname_io, int force, int group, buf_T *buf, exarg_T *eap)); |
7032 static void auto_next_pat __ARGS((AutoPatCmd *apc, int stop_at_last)); | 7035 static void auto_next_pat __ARGS((AutoPatCmd *apc, int stop_at_last)); |
7033 | 7036 |
7034 | 7037 |
7035 static EVENT_T last_event; | 7038 static event_T last_event; |
7036 static int last_group; | 7039 static int last_group; |
7037 | 7040 |
7038 /* | 7041 /* |
7039 * Show the autocommands for one AutoPat. | 7042 * Show the autocommands for one AutoPat. |
7040 */ | 7043 */ |
7041 static void | 7044 static void |
7042 show_autocmd(ap, event) | 7045 show_autocmd(ap, event) |
7043 AutoPat *ap; | 7046 AutoPat *ap; |
7044 EVENT_T event; | 7047 event_T event; |
7045 { | 7048 { |
7046 AutoCmd *ac; | 7049 AutoCmd *ac; |
7047 | 7050 |
7048 /* Check for "got_int" (here and at various places below), which is set | 7051 /* Check for "got_int" (here and at various places below), which is set |
7049 * when "q" has been hit for the "--more--" prompt */ | 7052 * when "q" has been hit for the "--more--" prompt */ |
7138 static void | 7141 static void |
7139 au_cleanup() | 7142 au_cleanup() |
7140 { | 7143 { |
7141 AutoPat *ap, **prev_ap; | 7144 AutoPat *ap, **prev_ap; |
7142 AutoCmd *ac, **prev_ac; | 7145 AutoCmd *ac, **prev_ac; |
7143 EVENT_T event; | 7146 event_T event; |
7144 | 7147 |
7145 if (autocmd_busy || !au_need_clean) | 7148 if (autocmd_busy || !au_need_clean) |
7146 return; | 7149 return; |
7147 | 7150 |
7148 /* loop over all events */ | 7151 /* loop over all events */ |
7149 for (event = (EVENT_T)0; (int)event < (int)NUM_EVENTS; | 7152 for (event = (event_T)0; (int)event < (int)NUM_EVENTS; |
7150 event = (EVENT_T)((int)event + 1)) | 7153 event = (event_T)((int)event + 1)) |
7151 { | 7154 { |
7152 /* loop over all autocommand patterns */ | 7155 /* loop over all autocommand patterns */ |
7153 prev_ap = &(first_autopat[(int)event]); | 7156 prev_ap = &(first_autopat[(int)event]); |
7154 for (ap = *prev_ap; ap != NULL; ap = *prev_ap) | 7157 for (ap = *prev_ap; ap != NULL; ap = *prev_ap) |
7155 { | 7158 { |
7191 void | 7194 void |
7192 aubuflocal_remove(buf) | 7195 aubuflocal_remove(buf) |
7193 buf_T *buf; | 7196 buf_T *buf; |
7194 { | 7197 { |
7195 AutoPat *ap; | 7198 AutoPat *ap; |
7196 EVENT_T event; | 7199 event_T event; |
7197 AutoPatCmd *apc; | 7200 AutoPatCmd *apc; |
7198 | 7201 |
7199 /* invalidate currently executing autocommands */ | 7202 /* invalidate currently executing autocommands */ |
7200 for (apc = active_apc_list; apc; apc = apc->next) | 7203 for (apc = active_apc_list; apc; apc = apc->next) |
7201 if (buf->b_fnum == apc->arg_bufnr) | 7204 if (buf->b_fnum == apc->arg_bufnr) |
7202 apc->arg_bufnr = 0; | 7205 apc->arg_bufnr = 0; |
7203 | 7206 |
7204 /* invalidate buflocals looping through events */ | 7207 /* invalidate buflocals looping through events */ |
7205 for (event = (EVENT_T)0; (int)event < (int)NUM_EVENTS; | 7208 for (event = (event_T)0; (int)event < (int)NUM_EVENTS; |
7206 event = (EVENT_T)((int)event + 1)) | 7209 event = (event_T)((int)event + 1)) |
7207 /* loop over all autocommand patterns */ | 7210 /* loop over all autocommand patterns */ |
7208 for (ap = first_autopat[(int)event]; ap != NULL; ap = ap->next) | 7211 for (ap = first_autopat[(int)event]; ap != NULL; ap = ap->next) |
7209 if (ap->buflocal_nr == buf->b_fnum) | 7212 if (ap->buflocal_nr == buf->b_fnum) |
7210 { | 7213 { |
7211 au_remove_pat(ap); | 7214 au_remove_pat(ap); |
7350 /* | 7353 /* |
7351 * Return the event number for event name "start". | 7354 * Return the event number for event name "start". |
7352 * Return NUM_EVENTS if the event name was not found. | 7355 * Return NUM_EVENTS if the event name was not found. |
7353 * Return a pointer to the next event name in "end". | 7356 * Return a pointer to the next event name in "end". |
7354 */ | 7357 */ |
7355 static EVENT_T | 7358 static event_T |
7356 event_name2nr(start, end) | 7359 event_name2nr(start, end) |
7357 char_u *start; | 7360 char_u *start; |
7358 char_u **end; | 7361 char_u **end; |
7359 { | 7362 { |
7360 char_u *p; | 7363 char_u *p; |
7381 /* | 7384 /* |
7382 * Return the name for event "event". | 7385 * Return the name for event "event". |
7383 */ | 7386 */ |
7384 static char_u * | 7387 static char_u * |
7385 event_nr2name(event) | 7388 event_nr2name(event) |
7386 EVENT_T event; | 7389 event_T event; |
7387 { | 7390 { |
7388 int i; | 7391 int i; |
7389 | 7392 |
7390 for (i = 0; event_names[i].name != NULL; ++i) | 7393 for (i = 0; event_names[i].name != NULL; ++i) |
7391 if (event_names[i].event == event) | 7394 if (event_names[i].event == event) |
7433 /* | 7436 /* |
7434 * Return TRUE if "event" is included in 'eventignore'. | 7437 * Return TRUE if "event" is included in 'eventignore'. |
7435 */ | 7438 */ |
7436 static int | 7439 static int |
7437 event_ignored(event) | 7440 event_ignored(event) |
7438 EVENT_T event; | 7441 event_T event; |
7439 { | 7442 { |
7440 char_u *p = p_ei; | 7443 char_u *p = p_ei; |
7441 | 7444 |
7442 if (STRICMP(p_ei, "all") == 0) | 7445 if (STRICMP(p_ei, "all") == 0) |
7443 return TRUE; | 7446 return TRUE; |
7545 int forceit; | 7548 int forceit; |
7546 { | 7549 { |
7547 char_u *pat; | 7550 char_u *pat; |
7548 char_u *envpat = NULL; | 7551 char_u *envpat = NULL; |
7549 char_u *cmd; | 7552 char_u *cmd; |
7550 EVENT_T event; | 7553 event_T event; |
7551 int need_free = FALSE; | 7554 int need_free = FALSE; |
7552 int nested = FALSE; | 7555 int nested = FALSE; |
7553 int group; | 7556 int group; |
7554 | 7557 |
7555 /* | 7558 /* |
7626 } | 7629 } |
7627 | 7630 |
7628 /* | 7631 /* |
7629 * Loop over the events. | 7632 * Loop over the events. |
7630 */ | 7633 */ |
7631 last_event = (EVENT_T)-1; /* for listing the event name */ | 7634 last_event = (event_T)-1; /* for listing the event name */ |
7632 last_group = AUGROUP_ERROR; /* for listing the group name */ | 7635 last_group = AUGROUP_ERROR; /* for listing the group name */ |
7633 if (*arg == '*' || *arg == NUL) | 7636 if (*arg == '*' || *arg == NUL) |
7634 { | 7637 { |
7635 for (event = (EVENT_T)0; (int)event < (int)NUM_EVENTS; | 7638 for (event = (event_T)0; (int)event < (int)NUM_EVENTS; |
7636 event = (EVENT_T)((int)event + 1)) | 7639 event = (event_T)((int)event + 1)) |
7637 if (do_autocmd_event(event, pat, | 7640 if (do_autocmd_event(event, pat, |
7638 nested, cmd, forceit, group) == FAIL) | 7641 nested, cmd, forceit, group) == FAIL) |
7639 break; | 7642 break; |
7640 } | 7643 } |
7641 else | 7644 else |
7689 * If forceit == TRUE delete entries. | 7692 * If forceit == TRUE delete entries. |
7690 * If group is not AUGROUP_ALL, only use this group. | 7693 * If group is not AUGROUP_ALL, only use this group. |
7691 */ | 7694 */ |
7692 static int | 7695 static int |
7693 do_autocmd_event(event, pat, nested, cmd, forceit, group) | 7696 do_autocmd_event(event, pat, nested, cmd, forceit, group) |
7694 EVENT_T event; | 7697 event_T event; |
7695 char_u *pat; | 7698 char_u *pat; |
7696 int nested; | 7699 int nested; |
7697 char_u *cmd; | 7700 char_u *cmd; |
7698 int forceit; | 7701 int forceit; |
7699 int group; | 7702 int group; |
8160 * Execute autocommands for "event" and file name "fname". | 8163 * Execute autocommands for "event" and file name "fname". |
8161 * Return TRUE if some commands were executed. | 8164 * Return TRUE if some commands were executed. |
8162 */ | 8165 */ |
8163 int | 8166 int |
8164 apply_autocmds(event, fname, fname_io, force, buf) | 8167 apply_autocmds(event, fname, fname_io, force, buf) |
8165 EVENT_T event; | 8168 event_T event; |
8166 char_u *fname; /* NULL or empty means use actual file name */ | 8169 char_u *fname; /* NULL or empty means use actual file name */ |
8167 char_u *fname_io; /* fname to use for <afile> on cmdline */ | 8170 char_u *fname_io; /* fname to use for <afile> on cmdline */ |
8168 int force; /* when TRUE, ignore autocmd_busy */ | 8171 int force; /* when TRUE, ignore autocmd_busy */ |
8169 buf_T *buf; /* buffer for <abuf> */ | 8172 buf_T *buf; /* buffer for <abuf> */ |
8170 { | 8173 { |
8176 * Like apply_autocmds(), but with extra "eap" argument. This takes care of | 8179 * Like apply_autocmds(), but with extra "eap" argument. This takes care of |
8177 * setting v:filearg. | 8180 * setting v:filearg. |
8178 */ | 8181 */ |
8179 static int | 8182 static int |
8180 apply_autocmds_exarg(event, fname, fname_io, force, buf, eap) | 8183 apply_autocmds_exarg(event, fname, fname_io, force, buf, eap) |
8181 EVENT_T event; | 8184 event_T event; |
8182 char_u *fname; | 8185 char_u *fname; |
8183 char_u *fname_io; | 8186 char_u *fname_io; |
8184 int force; | 8187 int force; |
8185 buf_T *buf; | 8188 buf_T *buf; |
8186 exarg_T *eap; | 8189 exarg_T *eap; |
8195 * conditional, no autocommands are executed. If otherwise the autocommands | 8198 * conditional, no autocommands are executed. If otherwise the autocommands |
8196 * cause the script to be aborted, retval is set to FAIL. | 8199 * cause the script to be aborted, retval is set to FAIL. |
8197 */ | 8200 */ |
8198 int | 8201 int |
8199 apply_autocmds_retval(event, fname, fname_io, force, buf, retval) | 8202 apply_autocmds_retval(event, fname, fname_io, force, buf, retval) |
8200 EVENT_T event; | 8203 event_T event; |
8201 char_u *fname; /* NULL or empty means use actual file name */ | 8204 char_u *fname; /* NULL or empty means use actual file name */ |
8202 char_u *fname_io; /* fname to use for <afile> on cmdline */ | 8205 char_u *fname_io; /* fname to use for <afile> on cmdline */ |
8203 int force; /* when TRUE, ignore autocmd_busy */ | 8206 int force; /* when TRUE, ignore autocmd_busy */ |
8204 buf_T *buf; /* buffer for <abuf> */ | 8207 buf_T *buf; /* buffer for <abuf> */ |
8205 int *retval; /* pointer to caller's retval */ | 8208 int *retval; /* pointer to caller's retval */ |
8220 ) | 8223 ) |
8221 *retval = FAIL; | 8224 *retval = FAIL; |
8222 return did_cmd; | 8225 return did_cmd; |
8223 } | 8226 } |
8224 | 8227 |
8225 #if defined(FEAT_AUTOCMD) || defined(PROTO) | |
8226 /* | 8228 /* |
8227 * Return TRUE when there is a CursorHold autocommand defined. | 8229 * Return TRUE when there is a CursorHold autocommand defined. |
8228 */ | 8230 */ |
8229 int | 8231 int |
8230 has_cursorhold() | 8232 has_cursorhold() |
8231 { | 8233 { |
8232 return (first_autopat[(int)EVENT_CURSORHOLD] != NULL); | 8234 return (first_autopat[(int)(get_real_state() == NORMAL_BUSY |
8235 ? EVENT_CURSORHOLD : EVENT_CURSORHOLDI)] != NULL); | |
8233 } | 8236 } |
8234 | 8237 |
8235 /* | 8238 /* |
8236 * Return TRUE if the CursorHold event can be triggered. | 8239 * Return TRUE if the CursorHold event can be triggered. |
8237 */ | 8240 */ |
8238 int | 8241 int |
8239 trigger_cursorhold() | 8242 trigger_cursorhold() |
8240 { | 8243 { |
8241 return (!did_cursorhold | 8244 int state; |
8242 && has_cursorhold() | 8245 |
8243 && !Recording | 8246 if (!did_cursorhold && has_cursorhold() && !Recording) |
8244 && get_real_state() == NORMAL_BUSY); | 8247 { |
8248 state = get_real_state(); | |
8249 if (state == NORMAL_BUSY || (state & INSERT) != 0) | |
8250 return TRUE; | |
8251 } | |
8252 return FALSE; | |
8245 } | 8253 } |
8246 #endif | 8254 |
8255 /* | |
8256 * Return TRUE when there is a CursorMoved autocommand defined. | |
8257 */ | |
8258 int | |
8259 has_cursormoved() | |
8260 { | |
8261 return (first_autopat[(int)EVENT_CURSORMOVED] != NULL); | |
8262 } | |
8263 | |
8264 /* | |
8265 * Return TRUE when there is a CursorMovedI autocommand defined. | |
8266 */ | |
8267 int | |
8268 has_cursormovedI() | |
8269 { | |
8270 return (first_autopat[(int)EVENT_CURSORMOVEDI] != NULL); | |
8271 } | |
8247 | 8272 |
8248 static int | 8273 static int |
8249 apply_autocmds_group(event, fname, fname_io, force, group, buf, eap) | 8274 apply_autocmds_group(event, fname, fname_io, force, group, buf, eap) |
8250 EVENT_T event; | 8275 event_T event; |
8251 char_u *fname; /* NULL or empty means use actual file name */ | 8276 char_u *fname; /* NULL or empty means use actual file name */ |
8252 char_u *fname_io; /* fname to use for <afile> on cmdline, NULL means | 8277 char_u *fname_io; /* fname to use for <afile> on cmdline, NULL means |
8253 use fname */ | 8278 use fname */ |
8254 int force; /* when TRUE, ignore autocmd_busy */ | 8279 int force; /* when TRUE, ignore autocmd_busy */ |
8255 int group; /* group ID, or AUGROUP_ALL */ | 8280 int group; /* group ID, or AUGROUP_ALL */ |
8733 * To account for buffer-local autocommands, function needs to know | 8758 * To account for buffer-local autocommands, function needs to know |
8734 * in which buffer the file will be opened. | 8759 * in which buffer the file will be opened. |
8735 */ | 8760 */ |
8736 int | 8761 int |
8737 has_autocmd(event, sfname, buf) | 8762 has_autocmd(event, sfname, buf) |
8738 EVENT_T event; | 8763 event_T event; |
8739 char_u *sfname; | 8764 char_u *sfname; |
8740 buf_T *buf; | 8765 buf_T *buf; |
8741 { | 8766 { |
8742 AutoPat *ap; | 8767 AutoPat *ap; |
8743 char_u *fname; | 8768 char_u *fname; |
8900 { | 8925 { |
8901 char_u *arg_save; | 8926 char_u *arg_save; |
8902 char_u *pattern = NULL; | 8927 char_u *pattern = NULL; |
8903 char_u *event_name; | 8928 char_u *event_name; |
8904 char_u *p; | 8929 char_u *p; |
8905 EVENT_T event; | 8930 event_T event; |
8906 AutoPat *ap; | 8931 AutoPat *ap; |
8907 buf_T *buflocal_buf = NULL; | 8932 buf_T *buflocal_buf = NULL; |
8908 int group; | 8933 int group; |
8909 int retval = FALSE; | 8934 int retval = FALSE; |
8910 | 8935 |