diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2019-02-12 16:33:23 -0500 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2019-02-12 16:33:23 -0500 |
commit | 3f4b8e9a299f88a8ea11c0ea6a281a34852e541a (patch) | |
tree | b8e7c1a11db4e76a9ec156b84a41b11288a763c8 /src | |
parent | b384996e86cb5172dd0d5283f178de7f2654a2f4 (diff) | |
download | emacs-3f4b8e9a299f88a8ea11c0ea6a281a34852e541a.tar.gz |
* src/data.c (Fmake_local_variable): Fix bug#34318
Revert part of ed962f2b8a.
* test/src/data-tests.el (data-tests-make-local-forwarded-var):
Add corresponding test.
Diffstat (limited to 'src')
-rw-r--r-- | src/data.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/data.c b/src/data.c index 571114802a1..ed6dedbe243 100644 --- a/src/data.c +++ b/src/data.c @@ -1954,6 +1954,16 @@ Instead, use `add-hook' and specify t for the LOCAL argument. */) (current_buffer, Fcons (Fcons (variable, XCDR (blv->defcell)), BVAR (current_buffer, local_var_alist))); + + /* If the symbol forwards into a C variable, then load the binding + for this buffer now, to preserve the invariant that forwarded + variables must always hold the value corresponding to the + current buffer (they are swapped eagerly). + Otherwise, if C code modifies the variable before we load the + binding in, then that new value would clobber the default binding + the next time we unload it. See bug#34318. */ + if (blv->fwd) + swap_in_symval_forwarding (sym, blv); } return variable; |