From 06bccf8e72074e260935af63e05079c7f53ff5f3 Mon Sep 17 00:00:00 2001 From: Gerd Moellmann Date: Thu, 18 Jan 2001 13:21:51 +0000 Subject: [PATCH] (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. --- src/ChangeLog | 6 ++++++ src/eval.c | 15 +++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/src/ChangeLog b/src/ChangeLog index f30ccf975b2..affd55502de 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,11 @@ 2001-01-18 Gerd Moellmann + * eval.c (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. + * xterm.c (x_initialize): Set char_ins_del_ok to 1. * xdisp.c (forward_to_next_line_start): Stop at end of buffer diff --git a/src/eval.c b/src/eval.c index 8d8b9b14d42..41085cdef5c 100644 --- a/src/eval.c +++ b/src/eval.c @@ -2899,16 +2899,31 @@ specbind (symbol, value) || 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; -- 2.11.4.GIT