aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman <[email protected]>2000-02-15 09:58:41 +0000
committerRichard M. Stallman <[email protected]>2000-02-15 09:58:41 +0000
commit27a6c729329e8c934d49f5ec5a9c980807a32eef (patch)
treec4327e53d91512da7d37021b1525ef413d3a6b7d /src
parent1f35ce36c2bac1e11b8dea2d6e39a9dccbc2b17b (diff)
(specbind): For buffer-local value, record the current buffer also.
(unbind_to): Cope with that change.
Diffstat (limited to 'src')
-rw-r--r--src/eval.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/eval.c b/src/eval.c
index ad01cb4f02..b3a8319d9f 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -2768,15 +2768,17 @@ specbind (symbol, value)
|| SOME_BUFFER_LOCAL_VALUEP (XSYMBOL (symbol)->value)
|| BUFFER_OBJFWDP (XSYMBOL (symbol)->value))
{
- Lisp_Object buffer;
+ Lisp_Object current_buffer, binding_buffer;
/* For a local variable, record both the symbol and which
buffer's value we are saving. */
- buffer = Fcurrent_buffer ();
+ current_buffer = Fcurrent_buffer ();
+ binding_buffer = current_buffer;
/* If the variable is not local in this buffer,
we are saving the global value, so restore that. */
- if (NILP (Flocal_variable_p (symbol, buffer)))
- buffer = Qnil;
- specpdl_ptr->symbol = Fcons (symbol, buffer);
+ if (NILP (Flocal_variable_p (symbol, binding_buffer)))
+ binding_buffer = Qnil;
+ specpdl_ptr->symbol
+ = Fcons (symbol, Fcons (binding_buffer, current_buffer));
}
else
specpdl_ptr->symbol = symbol;
@@ -2822,12 +2824,16 @@ unbind_to (count, value)
so in that case the "old value" is a list of forms to evaluate. */
else if (NILP (specpdl_ptr->symbol))
Fprogn (specpdl_ptr->old_value);
+ /* If the symbol is a list, it is really
+ (SYMBOL BINDING_BUFFER . CURRENT_BUFFER)
+ and it indicates we bound a variable that has
+ buffer-local bindings. */
else if (CONSP (specpdl_ptr->symbol))
{
Lisp_Object symbol, buffer;
symbol = XCAR (specpdl_ptr->symbol);
- buffer = XCDR (specpdl_ptr->symbol);
+ buffer = XCAR (XCDR (specpdl_ptr->symbol));
/* Handle restoring a default value. */
if (NILP (buffer))