patch 7.4.1913
Problem: When ":doautocmd" is used modelines are used even when no
autocommands were executed. (Daniel Hahler)
Solution: Skip processing modelines. (closes #854)
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index 4f501aa..55c093f 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -5449,9 +5449,11 @@
{
char_u *arg = eap->arg;
int call_do_modelines = check_nomodeline(&arg);
+ int did_aucmd;
- (void)do_doautocmd(arg, TRUE);
- if (call_do_modelines) /* Only when there is no <nomodeline>. */
+ (void)do_doautocmd(arg, TRUE, &did_aucmd);
+ /* Only when there is no <nomodeline>. */
+ if (call_do_modelines && did_aucmd)
do_modelines(0);
}
#endif
@@ -11896,7 +11898,7 @@
}
if (*arg == 'd')
{
- (void)do_doautocmd((char_u *)"filetypedetect BufRead", TRUE);
+ (void)do_doautocmd((char_u *)"filetypedetect BufRead", TRUE, NULL);
do_modelines(0);
}
}