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)
Files: src/fileio.c, src/ex_cmds.c, src/ex_docmd.c, src/proto/fileio.pro
*** ../vim-7.4.1912/src/fileio.c 2016-06-04 14:51:56.434265908 +0200
--- src/fileio.c 2016-06-09 22:45:06.339932877 +0200
***************
*** 5162,5168 ****
if (*curbuf->b_p_ft == NUL)
{
if (au_has_group((char_u *)"filetypedetect"))
! (void)do_doautocmd((char_u *)"filetypedetect BufRead", FALSE);
do_modelines(0);
}
#endif
--- 5162,5168 ----
if (*curbuf->b_p_ft == NUL)
{
if (au_has_group((char_u *)"filetypedetect"))
! (void)do_doautocmd((char_u *)"filetypedetect BufRead", FALSE, NULL);
do_modelines(0);
}
#endif
***************
*** 8688,8699 ****
int
do_doautocmd(
char_u *arg,
! int do_msg) /* give message for no matching autocmds? */
{
char_u *fname;
int nothing_done = TRUE;
int group;
/*
* Check for a legal group name. If not, use AUGROUP_ALL.
*/
--- 8688,8703 ----
int
do_doautocmd(
char_u *arg,
! int do_msg, /* give message for no matching autocmds? */
! int *did_something)
{
char_u *fname;
int nothing_done = TRUE;
int group;
+ if (did_something != NULL)
+ did_something = FALSE;
+
/*
* Check for a legal group name. If not, use AUGROUP_ALL.
*/
***************
*** 8727,8732 ****
--- 8731,8738 ----
if (nothing_done && do_msg)
MSG(_("No matching autocommands"));
+ if (did_something != NULL)
+ *did_something = !nothing_done;
#ifdef FEAT_EVAL
return aborting() ? FAIL : OK;
***************
*** 8746,8751 ****
--- 8752,8758 ----
buf_T *buf;
char_u *arg = eap->arg;
int call_do_modelines = check_nomodeline(&arg);
+ int did_aucmd;
/*
* This is a bit tricky: For some commands curwin->w_buffer needs to be
***************
*** 8762,8770 ****
aucmd_prepbuf(&aco, buf);
/* execute the autocommands for this buffer */
! retval = do_doautocmd(arg, FALSE);
! if (call_do_modelines)
{
/* Execute the modeline settings, but don't set window-local
* options if we are using the current window for another
--- 8769,8777 ----
aucmd_prepbuf(&aco, buf);
/* execute the autocommands for this buffer */
! retval = do_doautocmd(arg, FALSE, &did_aucmd);
! if (call_do_modelines && did_aucmd)
{
/* Execute the modeline settings, but don't set window-local
* options if we are using the current window for another
*** ../vim-7.4.1912/src/ex_cmds.c 2016-06-09 20:24:24.312049004 +0200
--- src/ex_cmds.c 2016-06-09 22:45:24.007932634 +0200
***************
*** 3096,3102 ****
{
if (au_has_group((char_u *)"filetypedetect"))
(void)do_doautocmd((char_u *)"filetypedetect BufRead",
! TRUE);
do_modelines(0);
}
--- 3096,3102 ----
{
if (au_has_group((char_u *)"filetypedetect"))
(void)do_doautocmd((char_u *)"filetypedetect BufRead",
! TRUE, NULL);
do_modelines(0);
}
*** ../vim-7.4.1912/src/ex_docmd.c 2016-06-04 22:08:38.877905472 +0200
--- src/ex_docmd.c 2016-06-09 22:46:27.571931759 +0200
***************
*** 5449,5457 ****
{
char_u *arg = eap->arg;
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
--- 5449,5459 ----
{
char_u *arg = eap->arg;
int call_do_modelines = check_nomodeline(&arg);
+ int did_aucmd;
! (void)do_doautocmd(arg, TRUE, &did_aucmd);
! /* Only when there is no <nomodeline>. */
! if (call_do_modelines && did_aucmd)
do_modelines(0);
}
#endif
***************
*** 11896,11902 ****
}
if (*arg == 'd')
{
! (void)do_doautocmd((char_u *)"filetypedetect BufRead", TRUE);
do_modelines(0);
}
}
--- 11898,11904 ----
}
if (*arg == 'd')
{
! (void)do_doautocmd((char_u *)"filetypedetect BufRead", TRUE, NULL);
do_modelines(0);
}
}
*** ../vim-7.4.1912/src/proto/fileio.pro 2016-01-19 13:21:55.837334377
+0100
--- src/proto/fileio.pro 2016-06-09 22:46:47.075931491 +0200
***************
*** 34,40 ****
char_u *au_event_disable(char *what);
void au_event_restore(char_u *old_ei);
void do_autocmd(char_u *arg, int forceit);
! int do_doautocmd(char_u *arg, int do_msg);
void ex_doautoall(exarg_T *eap);
int check_nomodeline(char_u **argp);
void aucmd_prepbuf(aco_save_T *aco, buf_T *buf);
--- 34,40 ----
char_u *au_event_disable(char *what);
void au_event_restore(char_u *old_ei);
void do_autocmd(char_u *arg, int forceit);
! int do_doautocmd(char_u *arg, int do_msg, int *did_something);
void ex_doautoall(exarg_T *eap);
int check_nomodeline(char_u **argp);
void aucmd_prepbuf(aco_save_T *aco, buf_T *buf);
*** ../vim-7.4.1912/src/version.c 2016-06-09 22:17:18.059955825 +0200
--- src/version.c 2016-06-09 22:51:04.579927949 +0200
***************
*** 755,756 ****
--- 755,758 ----
{ /* Add new patch number below this line */
+ /**/
+ 1913,
/**/
--
hundred-and-one symptoms of being an internet addict:
85. Choice between paying Compuserve bill and paying for kids education
is a no brainer -- although a bit painful for your kids.
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.