diff options
| author | Gerd Moellmann | 2001-07-05 09:25:36 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 2001-07-05 09:25:36 +0000 |
| commit | 0967b4b07b65796d2c8b5d5579d790741bae99f1 (patch) | |
| tree | 82ab6aa247e6abd707286ad497e4ad56d20674fd /src | |
| parent | 2d160521efe9fd61406c5ba7e38d1e8a51f579a5 (diff) | |
| download | emacs-0967b4b07b65796d2c8b5d5579d790741bae99f1.tar.gz emacs-0967b4b07b65796d2c8b5d5579d790741bae99f1.zip | |
(specbind): Additionally record the buffer that was
current when a buffer-local or frame-local variable was bound.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 5 | ||||
| -rw-r--r-- | 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 @@ | |||
| 1 | 2001-07-05 Gerd Moellmann <gerd@gnu.org> | ||
| 2 | |||
| 3 | * eval.c (specbind): Additionally record the buffer that was | ||
| 4 | current when a buffer-local or frame-local variable was bound. | ||
| 5 | |||
| 1 | 2001-07-04 Gerd Moellmann <gerd@gnu.org> | 6 | 2001-07-04 Gerd Moellmann <gerd@gnu.org> |
| 2 | 7 | ||
| 3 | * xterm.c (x_produce_glyphs): Don't convert multibyte characters | 8 | * 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) | |||
| 2935 | || SOME_BUFFER_LOCAL_VALUEP (valcontents) | 2935 | || SOME_BUFFER_LOCAL_VALUEP (valcontents) |
| 2936 | || BUFFER_OBJFWDP (valcontents)) | 2936 | || BUFFER_OBJFWDP (valcontents)) |
| 2937 | { | 2937 | { |
| 2938 | Lisp_Object where; | 2938 | Lisp_Object where, current_buffer; |
| 2939 | |||
| 2940 | current_buffer = Fcurrent_buffer (); | ||
| 2939 | 2941 | ||
| 2940 | /* For a local variable, record both the symbol and which | 2942 | /* For a local variable, record both the symbol and which |
| 2941 | buffer's or frame's value we are saving. */ | 2943 | buffer's or frame's value we are saving. */ |
| 2942 | if (!NILP (Flocal_variable_p (symbol, Qnil))) | 2944 | if (!NILP (Flocal_variable_p (symbol, Qnil))) |
| 2943 | where = Fcurrent_buffer (); | 2945 | where = current_buffer; |
| 2944 | else if (!BUFFER_OBJFWDP (valcontents) | 2946 | else if (!BUFFER_OBJFWDP (valcontents) |
| 2945 | && XBUFFER_LOCAL_VALUE (valcontents)->found_for_frame) | 2947 | && XBUFFER_LOCAL_VALUE (valcontents)->found_for_frame) |
| 2946 | where = XBUFFER_LOCAL_VALUE (valcontents)->frame; | 2948 | where = XBUFFER_LOCAL_VALUE (valcontents)->frame; |
| @@ -2950,7 +2952,7 @@ specbind (symbol, value) | |||
| 2950 | /* We're not using the `unused' slot in the specbinding | 2952 | /* We're not using the `unused' slot in the specbinding |
| 2951 | structure because this would mean we have to do more | 2953 | structure because this would mean we have to do more |
| 2952 | work for simple variables. */ | 2954 | work for simple variables. */ |
| 2953 | specpdl_ptr->symbol = Fcons (symbol, where); | 2955 | specpdl_ptr->symbol = Fcons (symbol, Fcons (where, current_buffer)); |
| 2954 | 2956 | ||
| 2955 | /* If SYMBOL is a per-buffer variable which doesn't have a | 2957 | /* If SYMBOL is a per-buffer variable which doesn't have a |
| 2956 | buffer-local value here, make the `let' change the global | 2958 | buffer-local value here, make the `let' change the global |
| @@ -3010,17 +3012,19 @@ unbind_to (count, value) | |||
| 3010 | so in that case the "old value" is a list of forms to evaluate. */ | 3012 | so in that case the "old value" is a list of forms to evaluate. */ |
| 3011 | else if (NILP (specpdl_ptr->symbol)) | 3013 | else if (NILP (specpdl_ptr->symbol)) |
| 3012 | Fprogn (specpdl_ptr->old_value); | 3014 | Fprogn (specpdl_ptr->old_value); |
| 3013 | /* If the symbol is a list, it is really (SYMBOL . WHERE) where | 3015 | /* If the symbol is a list, it is really (SYMBOL WHERE |
| 3014 | WHERE is either nil, a buffer, or a frame. If WHERE is a | 3016 | . CURRENT-BUFFER) where WHERE is either nil, a buffer, or a |
| 3015 | buffer or frame, this indicates we bound a variable that had | 3017 | frame. If WHERE is a buffer or frame, this indicates we |
| 3016 | a buffer-local or frmae-local binding.. WHERE nil means that | 3018 | bound a variable that had a buffer-local or frmae-local |
| 3017 | the variable had the default value when it was bound. */ | 3019 | binding.. WHERE nil means that the variable had the default |
| 3020 | value when it was bound. CURRENT-BUFFER is the buffer that | ||
| 3021 | was current when the variable was bound. */ | ||
| 3018 | else if (CONSP (specpdl_ptr->symbol)) | 3022 | else if (CONSP (specpdl_ptr->symbol)) |
| 3019 | { | 3023 | { |
| 3020 | Lisp_Object symbol, where; | 3024 | Lisp_Object symbol, where; |
| 3021 | 3025 | ||
| 3022 | symbol = XCAR (specpdl_ptr->symbol); | 3026 | symbol = XCAR (specpdl_ptr->symbol); |
| 3023 | where = XCDR (specpdl_ptr->symbol); | 3027 | where = XCAR (XCDR (specpdl_ptr->symbol)); |
| 3024 | 3028 | ||
| 3025 | if (NILP (where)) | 3029 | if (NILP (where)) |
| 3026 | Fset_default (symbol, specpdl_ptr->old_value); | 3030 | Fset_default (symbol, specpdl_ptr->old_value); |