aboutsummaryrefslogtreecommitdiffstats
path: root/src/eval.c
diff options
context:
space:
mode:
authorStefan Monnier2010-05-14 13:53:42 -0400
committerStefan Monnier2010-05-14 13:53:42 -0400
commit4e2db1fe4be382f540f175316f3608fe4a9a93ae (patch)
tree4ada7b168ba7a0e9c459becfb2676a63bb8a6d46 /src/eval.c
parent10dcc5612a47d4a6ab9f05c1e8f39993b16bb634 (diff)
downloademacs-4e2db1fe4be382f540f175316f3608fe4a9a93ae.tar.gz
emacs-4e2db1fe4be382f540f175316f3608fe4a9a93ae.zip
* eval.c (specbind): Disallow let-binding frame-local vars.
Remove left-over duplicate test. Add comment.
Diffstat (limited to 'src/eval.c')
-rw-r--r--src/eval.c32
1 files changed, 24 insertions, 8 deletions
diff --git a/src/eval.c b/src/eval.c
index 2a0330acc38..199c4705736 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -3308,6 +3308,21 @@ grow_specpdl ()
3308 specpdl_ptr = specpdl + count; 3308 specpdl_ptr = specpdl + count;
3309} 3309}
3310 3310
3311/* specpdl_ptr->symbol is a field which describes which variable is
3312 let-bound, so it can be properly undone when we unbind_to.
3313 It can have the following two shapes:
3314 - SYMBOL : if it's a plain symbol, it means that we have let-bound
3315 a symbol that is not buffer-local (at least at the time
3316 the let binding started). Note also that it should not be
3317 aliased (i.e. when let-binding V1 that's aliased to V2, we want
3318 to record V2 here).
3319 - (SYMBOL WHERE . BUFFER) : this means that it is a let-binding for
3320 variable SYMBOL which can be buffer-local. WHERE tells us
3321 which buffer is affected (or nil if the let-binding affects the
3322 global value of the variable) and BUFFER tells us which buffer was
3323 current (i.e. if WHERE is non-nil, then BUFFER==WHERE, otherwise
3324 BUFFER did not yet have a buffer-local value). */
3325
3311void 3326void
3312specbind (symbol, value) 3327specbind (symbol, value)
3313 Lisp_Object symbol, value; 3328 Lisp_Object symbol, value;
@@ -3339,7 +3354,10 @@ specbind (symbol, value)
3339 set_internal (symbol, value, Qnil, 1); 3354 set_internal (symbol, value, Qnil, 1);
3340 break; 3355 break;
3341 } 3356 }
3342 case SYMBOL_LOCALIZED: case SYMBOL_FORWARDED: 3357 case SYMBOL_LOCALIZED:
3358 if (SYMBOL_BLV (sym)->frame_local)
3359 error ("Frame-local vars cannot be let-bound");
3360 case SYMBOL_FORWARDED:
3343 { 3361 {
3344 Lisp_Object ovalue = find_symbol_value (symbol); 3362 Lisp_Object ovalue = find_symbol_value (symbol);
3345 specpdl_ptr->func = 0; 3363 specpdl_ptr->func = 0;
@@ -3376,6 +3394,7 @@ specbind (symbol, value)
3376 /* FIXME: The third value `current_buffer' is only used in 3394 /* FIXME: The third value `current_buffer' is only used in
3377 let_shadows_buffer_binding_p which is itself only used 3395 let_shadows_buffer_binding_p which is itself only used
3378 in set_internal for local_if_set. */ 3396 in set_internal for local_if_set. */
3397 eassert (NILP (where) || EQ (where, cur_buf));
3379 specpdl_ptr->symbol = Fcons (symbol, Fcons (where, cur_buf)); 3398 specpdl_ptr->symbol = Fcons (symbol, Fcons (where, cur_buf));
3380 3399
3381 /* If SYMBOL is a per-buffer variable which doesn't have a 3400 /* If SYMBOL is a per-buffer variable which doesn't have a
@@ -3460,13 +3479,10 @@ unbind_to (count, value)
3460 Fset_default (symbol, this_binding.old_value); 3479 Fset_default (symbol, this_binding.old_value);
3461 /* If `where' is non-nil, reset the value in the appropriate 3480 /* If `where' is non-nil, reset the value in the appropriate
3462 local binding, but only if that binding still exists. */ 3481 local binding, but only if that binding still exists. */
3463 else if (BUFFERP (where)) 3482 else if (BUFFERP (where)
3464 { 3483 ? !NILP (Flocal_variable_p (symbol, where))
3465 if (BUFFERP (where) 3484 : !NILP (Fassq (symbol, XFRAME (where)->param_alist)))
3466 ? !NILP (Flocal_variable_p (symbol, where)) 3485 set_internal (symbol, this_binding.old_value, where, 1);
3467 : !NILP (Fassq (symbol, XFRAME (where)->param_alist)))
3468 set_internal (symbol, this_binding.old_value, where, 1);
3469 }
3470 } 3486 }
3471 /* If variable has a trivial value (no forwarding), we can 3487 /* If variable has a trivial value (no forwarding), we can
3472 just set it. No need to check for constant symbols here, 3488 just set it. No need to check for constant symbols here,