Mercurial > emacs
comparison src/buffer.c @ 86230:79043dac5524
(Fbuffer_local_value): Remove redundant test.
(swap_out_buffer_local_variables): Swap out binding in `buffer' rather
than in `current-buffer' to match the comment.
Do the swap using swap_in_global_binding.
| author | Stefan Monnier <monnier@iro.umontreal.ca> |
|---|---|
| date | Mon, 19 Nov 2007 07:44:30 +0000 |
| parents | d0d527210b0c |
| children | 59344cb482f3 |
comparison
equal
deleted
inserted
replaced
| 86229:0ec5ce87b9e0 | 86230:79043dac5524 |
|---|---|
| 893 | 893 |
| 894 CHECK_SYMBOL (variable); | 894 CHECK_SYMBOL (variable); |
| 895 CHECK_BUFFER (buffer); | 895 CHECK_BUFFER (buffer); |
| 896 buf = XBUFFER (buffer); | 896 buf = XBUFFER (buffer); |
| 897 | 897 |
| 898 if (SYMBOLP (variable)) | 898 variable = indirect_variable (variable); |
| 899 variable = indirect_variable (variable); | |
| 900 | 899 |
| 901 /* Look in local_var_list */ | 900 /* Look in local_var_list */ |
| 902 result = Fassoc (variable, buf->local_var_alist); | 901 result = Fassoc (variable, buf->local_var_alist); |
| 903 if (NILP (result)) | 902 if (NILP (result)) |
| 904 { | 903 { |
| 2516 { | 2515 { |
| 2517 sym = XCAR (XCAR (alist)); | 2516 sym = XCAR (XCAR (alist)); |
| 2518 | 2517 |
| 2519 /* Need not do anything if some other buffer's binding is now encached. */ | 2518 /* Need not do anything if some other buffer's binding is now encached. */ |
| 2520 tem = XBUFFER_LOCAL_VALUE (SYMBOL_VALUE (sym))->buffer; | 2519 tem = XBUFFER_LOCAL_VALUE (SYMBOL_VALUE (sym))->buffer; |
| 2521 if (BUFFERP (tem) && XBUFFER (tem) == current_buffer) | 2520 if (EQ (tem, buffer)) |
| 2522 { | 2521 { |
| 2523 /* Symbol is set up for this buffer's old local value. | 2522 /* Symbol is set up for this buffer's old local value: |
| 2524 Set it up for the current buffer with the default value. */ | 2523 swap it out! */ |
| 2525 | 2524 swap_in_global_binding (sym); |
| 2526 tem = XBUFFER_LOCAL_VALUE (SYMBOL_VALUE (sym))->cdr; | |
| 2527 /* Store the symbol's current value into the alist entry | |
| 2528 it is currently set up for. This is so that, if the | |
| 2529 local is marked permanent, and we make it local again | |
| 2530 later in Fkill_all_local_variables, we don't lose the value. */ | |
| 2531 XSETCDR (XCAR (tem), | |
| 2532 do_symval_forwarding (XBUFFER_LOCAL_VALUE (SYMBOL_VALUE (sym))->realvalue)); | |
| 2533 /* Switch to the symbol's default-value alist entry. */ | |
| 2534 XSETCAR (tem, tem); | |
| 2535 /* Mark it as current for buffer B. */ | |
| 2536 XBUFFER_LOCAL_VALUE (SYMBOL_VALUE (sym))->buffer = buffer; | |
| 2537 /* Store the current value into any forwarding in the symbol. */ | |
| 2538 store_symval_forwarding (sym, | |
| 2539 XBUFFER_LOCAL_VALUE (SYMBOL_VALUE (sym))->realvalue, | |
| 2540 XCDR (tem), NULL); | |
| 2541 } | 2525 } |
| 2542 } | 2526 } |
| 2543 } | 2527 } |
| 2544 | 2528 |
| 2545 /* Find all the overlays in the current buffer that contain position POS. | 2529 /* Find all the overlays in the current buffer that contain position POS. |
