From 3173d07564e7cdf0834099a379f0faf480c76224 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Tue, 29 Nov 2022 18:20:11 +0800 Subject: vim-patch:9.0.0965: using one window for executing autocommands is insufficient Problem: Using one window for executing autocommands is insufficient. Solution: Use up to five windows for executing autocommands. https://github.com/vim/vim/commit/e76062c078debed0df818f70e4db14ad7a7cb53a N/A patches for version.c: vim-patch:9.0.0966: some compilers don't allow a declaration after a label Problem: Some compilers don't allow a declaration after a label. Solution: Move the declaration to the start of the block. (John Marriott) https://github.com/vim/vim/commit/f86490ed4fdab213a28f667abd055c023a73d645 Co-authored-by: Bram Moolenaar --- src/nvim/eval/vars.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/nvim/eval/vars.c') diff --git a/src/nvim/eval/vars.c b/src/nvim/eval/vars.c index 5459eac5bf..f002071ad2 100644 --- a/src/nvim/eval/vars.c +++ b/src/nvim/eval/vars.c @@ -1800,13 +1800,15 @@ void f_setbufvar(typval_T *argvars, typval_T *rettv, EvalFuncData fptr) if (*varname == '&') { aco_save_T aco; - // set curbuf to be our buf, temporarily + // Set curbuf to be our buf, temporarily. aucmd_prepbuf(&aco, buf); + if (curbuf == buf) { + // Only when it worked to set "curbuf". + set_option_from_tv(varname + 1, varp); - set_option_from_tv(varname + 1, varp); - - // reset notion of buffer - aucmd_restbuf(&aco); + // reset notion of buffer + aucmd_restbuf(&aco); + } } else { const size_t varname_len = strlen(varname); char *const bufvarname = xmalloc(varname_len + 3); -- cgit