From 0967b4b07b65796d2c8b5d5579d790741bae99f1 Mon Sep 17 00:00:00 2001 From: Gerd Moellmann Date: Thu, 5 Jul 2001 09:25:36 +0000 Subject: [PATCH] (specbind): Additionally record the buffer that was current when a buffer-local or frame-local variable was bound. --- src/ChangeLog | 5 +++++ src/eval.c | 22 +++++++++++++--------- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 73f8dd6d165..ea5463c5f0e 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2001-07-05 Gerd Moellmann + + * eval.c (specbind): Additionally record the buffer that was + current when a buffer-local or frame-local variable was bound. + 2001-07-04 Gerd Moellmann * xterm.c (x_produce_glyphs): Don't convert multibyte characters diff --git a/src/eval.c b/src/eval.c index 6ee3d89cb3f..7c423fe9675 100644 --- a/src/eval.c +++ b/src/eval.c @@ -2935,12 +2935,14 @@ specbind (symbol, value) || SOME_BUFFER_LOCAL_VALUEP (valcontents) || BUFFER_OBJFWDP (valcontents)) { - Lisp_Object where; + Lisp_Object where, current_buffer; + + current_buffer = Fcurrent_buffer (); /* For a local variable, record both the symbol and which buffer's or frame's value we are saving. */ if (!NILP (Flocal_variable_p (symbol, Qnil))) - where = Fcurrent_buffer (); + where = current_buffer; else if (!BUFFER_OBJFWDP (valcontents) && XBUFFER_LOCAL_VALUE (valcontents)->found_for_frame) where = XBUFFER_LOCAL_VALUE (valcontents)->frame; @@ -2950,7 +2952,7 @@ specbind (symbol, value) /* We're not using the `unused' slot in the specbinding structure because this would mean we have to do more work for simple variables. */ - specpdl_ptr->symbol = Fcons (symbol, where); + specpdl_ptr->symbol = Fcons (symbol, Fcons (where, current_buffer)); /* If SYMBOL is a per-buffer variable which doesn't have a buffer-local value here, make the `let' change the global @@ -3010,17 +3012,19 @@ 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 . WHERE) where - WHERE is either nil, a buffer, or a frame. If WHERE is a - buffer or frame, this indicates we bound a variable that had - a buffer-local or frmae-local binding.. WHERE nil means that - the variable had the default value when it was bound. */ + /* If the symbol is a list, it is really (SYMBOL WHERE + . CURRENT-BUFFER) where WHERE is either nil, a buffer, or a + frame. If WHERE is a buffer or frame, this indicates we + bound a variable that had a buffer-local or frmae-local + binding.. WHERE nil means that the variable had the default + value when it was bound. CURRENT-BUFFER is the buffer that + was current when the variable was bound. */ else if (CONSP (specpdl_ptr->symbol)) { Lisp_Object symbol, where; symbol = XCAR (specpdl_ptr->symbol); - where = XCDR (specpdl_ptr->symbol); + where = XCAR (XCDR (specpdl_ptr->symbol)); if (NILP (where)) Fset_default (symbol, specpdl_ptr->old_value); -- 2.39.2