# HG changeset patch # User Gerd Moellmann # Date 979824086 0 # Node ID 0936433023f5df832809c646a25d33918b533a6b # Parent 2470cdee5ed8d6a74109af7055d41d7666be6021 (specbind): If binding a per-buffer variable which doesn't have a buffer-local value in the current buffer, change the global value by changing the value of the symbol bound in all buffers not having their own value, to make it consistent with what happens with other buffer-local variables. diff -r 2470cdee5ed8 -r 0936433023f5 src/eval.c --- a/src/eval.c Thu Jan 18 12:30:25 2001 +0000 +++ b/src/eval.c Thu Jan 18 13:21:26 2001 +0000 @@ -2899,16 +2899,31 @@ || BUFFER_OBJFWDP (XSYMBOL (symbol)->value)) { Lisp_Object current_buffer, binding_buffer; + /* For a local variable, record both the symbol and which buffer's value we are saving. */ 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, binding_buffer))) binding_buffer = Qnil; specpdl_ptr->symbol = Fcons (symbol, Fcons (binding_buffer, current_buffer)); + + /* If SYMBOL is a per-buffer variable which doesn't have a + buffer-local value here, make the `let' change the global + value by changing the value of SYMBOL in all buffers not + having their own value. This is consistent with what + happens with other buffer-local variables. */ + if (NILP (binding_buffer) + && BUFFER_OBJFWDP (XSYMBOL (symbol)->value)) + { + ++specpdl_ptr; + Fset_default (symbol, value); + return; + } } else specpdl_ptr->symbol = symbol;