mirror of
https://github.com/neovim/neovim.git
synced 2025-09-27 13:38:34 +00:00
fix(filetype): avoid recursive FileType autocmds (#22813)
This commit is contained in:
@@ -111,15 +111,15 @@ static buf_T *do_ft_buf(char *filetype, aco_save_T *aco, Error *err)
|
||||
|
||||
// Set curwin/curbuf to buf and save a few things.
|
||||
aucmd_prepbuf(aco, ftbuf);
|
||||
set_option_value("bufhidden", 0L, "hide", OPT_LOCAL);
|
||||
set_option_value("buftype", 0L, "nofile", OPT_LOCAL);
|
||||
set_option_value("swapfile", 0L, NULL, OPT_LOCAL);
|
||||
set_option_value("modeline", 0L, NULL, OPT_LOCAL); // 'nomodeline'
|
||||
|
||||
ftbuf->b_p_ft = xstrdup(filetype);
|
||||
|
||||
TRY_WRAP(err, {
|
||||
apply_autocmds(EVENT_FILETYPE, ftbuf->b_p_ft, ftbuf->b_fname, true, ftbuf);
|
||||
set_option_value("bufhidden", 0L, "hide", OPT_LOCAL);
|
||||
set_option_value("buftype", 0L, "nofile", OPT_LOCAL);
|
||||
set_option_value("swapfile", 0L, NULL, OPT_LOCAL);
|
||||
set_option_value("modeline", 0L, NULL, OPT_LOCAL); // 'nomodeline'
|
||||
|
||||
ftbuf->b_p_ft = xstrdup(filetype);
|
||||
do_filetype_autocmd(ftbuf, false);
|
||||
});
|
||||
|
||||
return ftbuf;
|
||||
|
Reference in New Issue
Block a user