#ifdef FEAT_AUTOCMD
/* Set filetype to "help" if still needed. */
if (STRCMP(curbuf->b_p_ft, "help") != 0)
+ {
+ ++curbuf_lock;
set_option_value((char_u *)"ft", 0L, (char_u *)"help", OPT_LOCAL);
+ --curbuf_lock;
+ }
#endif
#ifdef FEAT_SYN_HL
# ifdef FEAT_AUTOCMD
/* Do execute autocommands for setting the filetype (load syntax). */
unblock_autocmds();
+ /* But don't allow switching to another buffer. */
+ ++curbuf_lock;
# endif
/* Showing the prompt may have set need_wait_return, reset it. */
}
set_option_value((char_u *)"ft", 0L, (char_u *)"vim", OPT_LOCAL);
}
+# ifdef FEAT_AUTOCMD
+ --curbuf_lock;
+# endif
/* Reset 'textwidth' after setting 'filetype' (the Vim filetype plugin
* sets 'textwidth' to 78). */
/* Set the 'filetype' to "qf" each time after filling the buffer.
* This resembles reading a file into a buffer, it's more logical when
* using autocommands. */
+#ifdef FEAT_AUTOCMD
+ ++curbuf_lock;
+#endif
set_option_value((char_u *)"ft", 0L, (char_u *)"qf", OPT_LOCAL);
curbuf->b_p_ma = FALSE;
apply_autocmds(EVENT_BUFWINENTER, (char_u *)"quickfix", NULL,
FALSE, curbuf);
keep_filetype = FALSE;
+ --curbuf_lock;
#endif
/* make sure it will be redrawn */
redraw_curbuf_later(NOT_VALID);
func Test_cclose_from_copen()
augroup QF_Test
au!
- au FileType qf :cclose
+ au FileType qf :call assert_fails(':cclose', 'E788')
augroup END
copen
augroup QF_Test
call XsizeTests('c')
call XsizeTests('l')
endfunc
+
+func Test_cclose_in_autocmd()
+ " Problem is only triggered if "starting" is zero, so that the OptionsSet
+ " event will be triggered.
+ call test_override('starting', 1)
+ augroup QF_Test
+ au!
+ au FileType qf :call assert_fails(':cclose', 'E788')
+ augroup END
+ copen
+ augroup QF_Test
+ au!
+ augroup END
+ augroup! QF_Test
+ call test_override('starting', 0)
+endfunc
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 677,
/**/
676,
/**/