summaryrefslogtreecommitdiffstats
path: root/src/if_py_both.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/if_py_both.h')
-rw-r--r--src/if_py_both.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/if_py_both.h b/src/if_py_both.h
index d6cb13b831..0cde18d051 100644
--- a/src/if_py_both.h
+++ b/src/if_py_both.h
@@ -5283,8 +5283,11 @@ BufferSetattr(BufferObject *self, char *name, PyObject *valObject)
VimTryStart();
// Using aucmd_*: autocommands will be executed by rename_buffer
aucmd_prepbuf(&aco, self->buf);
- ren_ret = rename_buffer(val);
- aucmd_restbuf(&aco);
+ if (curbuf == self->buf)
+ {
+ ren_ret = rename_buffer(val);
+ aucmd_restbuf(&aco);
+ }
Py_XDECREF(todecref);
if (VimTryEnd())
return -1;