mirror of
https://github.com/vim/vim.git
synced 2025-10-05 05:34:07 -04:00
updated for version 7.3.442
Problem: Still read modelines for ":doautocmd". Solution: Move check for <nomodeline> to separate function.
This commit is contained in:
@@ -1072,6 +1072,14 @@ option will not cause any commands to be executed.
|
|||||||
argument is included, Vim executes only the matching
|
argument is included, Vim executes only the matching
|
||||||
autocommands for that group. Note: if you use an
|
autocommands for that group. Note: if you use an
|
||||||
undefined group name, Vim gives you an error message.
|
undefined group name, Vim gives you an error message.
|
||||||
|
*<nomodeline>*
|
||||||
|
After applying the autocommands the modelines are
|
||||||
|
processed, so that their settings overrule the
|
||||||
|
settings from autocommands, like what happens when
|
||||||
|
editing a file. This is skipped when the <nomodeline>
|
||||||
|
argument is present. You probably want to use
|
||||||
|
<nomodeline> for events that are not used when loading
|
||||||
|
a buffer, such as |User|.
|
||||||
|
|
||||||
*:doautoa* *:doautoall*
|
*:doautoa* *:doautoall*
|
||||||
:doautoa[ll] [<nomodeline>] [group] {event} [fname]
|
:doautoa[ll] [<nomodeline>] [group] {event} [fname]
|
||||||
@@ -1085,12 +1093,6 @@ option will not cause any commands to be executed.
|
|||||||
This command is intended for autocommands that set
|
This command is intended for autocommands that set
|
||||||
options, change highlighting, and things like that.
|
options, change highlighting, and things like that.
|
||||||
|
|
||||||
After applying the autocommands the modelines are
|
|
||||||
processed, so that their settings overrule the
|
|
||||||
settings from autocommands, like what happens when
|
|
||||||
editing a file. This is skipped when the <nomodeline>
|
|
||||||
argument is present.
|
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
10. Using autocommands *autocmd-use*
|
10. Using autocommands *autocmd-use*
|
||||||
|
|
||||||
|
@@ -4955,7 +4955,7 @@ ex_abclear(eap)
|
|||||||
map_clear(eap->cmd, eap->arg, TRUE, TRUE);
|
map_clear(eap->cmd, eap->arg, TRUE, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef FEAT_AUTOCMD
|
#if defined(FEAT_AUTOCMD) || defined(PROTO)
|
||||||
static void
|
static void
|
||||||
ex_autocmd(eap)
|
ex_autocmd(eap)
|
||||||
exarg_T *eap;
|
exarg_T *eap;
|
||||||
@@ -4982,8 +4982,12 @@ ex_autocmd(eap)
|
|||||||
ex_doautocmd(eap)
|
ex_doautocmd(eap)
|
||||||
exarg_T *eap;
|
exarg_T *eap;
|
||||||
{
|
{
|
||||||
(void)do_doautocmd(eap->arg, TRUE);
|
char_u *arg = eap->arg;
|
||||||
do_modelines(0);
|
int call_do_modelines = check_nomodeline(&arg);
|
||||||
|
|
||||||
|
(void)do_doautocmd(arg, TRUE);
|
||||||
|
if (call_do_modelines) /* Only when there is no <nomodeline>. */
|
||||||
|
do_modelines(0);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
25
src/fileio.c
25
src/fileio.c
@@ -8740,13 +8740,7 @@ ex_doautoall(eap)
|
|||||||
aco_save_T aco;
|
aco_save_T aco;
|
||||||
buf_T *buf;
|
buf_T *buf;
|
||||||
char_u *arg = eap->arg;
|
char_u *arg = eap->arg;
|
||||||
int call_do_modelines = TRUE;
|
int call_do_modelines = check_nomodeline(&arg);
|
||||||
|
|
||||||
if (STRNCMP(arg, "<nomodeline>", 12) == 0)
|
|
||||||
{
|
|
||||||
call_do_modelines = FALSE;
|
|
||||||
arg = skipwhite(arg + 12);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is a bit tricky: For some commands curwin->w_buffer needs to be
|
* This is a bit tricky: For some commands curwin->w_buffer needs to be
|
||||||
@@ -8785,6 +8779,23 @@ ex_doautoall(eap)
|
|||||||
check_cursor(); /* just in case lines got deleted */
|
check_cursor(); /* just in case lines got deleted */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check *argp for <nomodeline>. When it is present return FALSE, otherwise
|
||||||
|
* return TRUE and advance *argp to after it.
|
||||||
|
* Thus return TRUE when do_modelines() should be called.
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
check_nomodeline(argp)
|
||||||
|
char_u **argp;
|
||||||
|
{
|
||||||
|
if (STRNCMP(*argp, "<nomodeline>", 12) == 0)
|
||||||
|
{
|
||||||
|
*argp = skipwhite(*argp + 12);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Prepare for executing autocommands for (hidden) buffer "buf".
|
* Prepare for executing autocommands for (hidden) buffer "buf".
|
||||||
* Search for a visible window containing the current buffer. If there isn't
|
* Search for a visible window containing the current buffer. If there isn't
|
||||||
|
@@ -35,6 +35,7 @@ void au_event_restore __ARGS((char_u *old_ei));
|
|||||||
void do_autocmd __ARGS((char_u *arg, int forceit));
|
void do_autocmd __ARGS((char_u *arg, int forceit));
|
||||||
int do_doautocmd __ARGS((char_u *arg, int do_msg));
|
int do_doautocmd __ARGS((char_u *arg, int do_msg));
|
||||||
void ex_doautoall __ARGS((exarg_T *eap));
|
void ex_doautoall __ARGS((exarg_T *eap));
|
||||||
|
int check_nomodeline __ARGS((char_u **argp));
|
||||||
void aucmd_prepbuf __ARGS((aco_save_T *aco, buf_T *buf));
|
void aucmd_prepbuf __ARGS((aco_save_T *aco, buf_T *buf));
|
||||||
void aucmd_restbuf __ARGS((aco_save_T *aco));
|
void aucmd_restbuf __ARGS((aco_save_T *aco));
|
||||||
int apply_autocmds __ARGS((event_T event, char_u *fname, char_u *fname_io, int force, buf_T *buf));
|
int apply_autocmds __ARGS((event_T event, char_u *fname, char_u *fname_io, int force, buf_T *buf));
|
||||||
|
@@ -714,6 +714,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
442,
|
||||||
/**/
|
/**/
|
||||||
441,
|
441,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user