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.
diff --git a/src/evalvars.c b/src/evalvars.c
index 28516c1..20223c8 100644
--- a/src/evalvars.c
+++ b/src/evalvars.c
@@ -4761,13 +4761,16 @@
{
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
{