Mercurial > emacs
comparison src/data.c @ 86338:cc3ad12e2f26
(set_internal): Set the value in the `cons-cell' (for
Buffer_Local_values) not only for frame-local variables.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Thu, 22 Nov 2007 19:48:57 +0000 |
parents | eba0d96e791f |
children | 4505355014c0 |
comparison
equal
deleted
inserted
replaced
86337:161416156d88 | 86338:cc3ad12e2f26 |
---|---|
1236 wrong one. */ | 1236 wrong one. */ |
1237 if (!BUFFERP (XBUFFER_LOCAL_VALUE (valcontents)->buffer) | 1237 if (!BUFFERP (XBUFFER_LOCAL_VALUE (valcontents)->buffer) |
1238 || buf != XBUFFER (XBUFFER_LOCAL_VALUE (valcontents)->buffer) | 1238 || buf != XBUFFER (XBUFFER_LOCAL_VALUE (valcontents)->buffer) |
1239 || (XBUFFER_LOCAL_VALUE (valcontents)->check_frame | 1239 || (XBUFFER_LOCAL_VALUE (valcontents)->check_frame |
1240 && !EQ (selected_frame, XBUFFER_LOCAL_VALUE (valcontents)->frame)) | 1240 && !EQ (selected_frame, XBUFFER_LOCAL_VALUE (valcontents)->frame)) |
1241 /* Also unload a global binding (if the var is local_if_set). */ | |
1241 || (EQ (XCAR (current_alist_element), | 1242 || (EQ (XCAR (current_alist_element), |
1242 current_alist_element))) | 1243 current_alist_element))) |
1243 { | 1244 { |
1244 /* The currently loaded binding is not necessarily valid. | 1245 /* The currently loaded binding is not necessarily valid. |
1245 We need to unload it, and choose a new binding. */ | 1246 We need to unload it, and choose a new binding. */ |
1255 | 1256 |
1256 if (NILP (tem1)) | 1257 if (NILP (tem1)) |
1257 { | 1258 { |
1258 /* This buffer still sees the default value. */ | 1259 /* This buffer still sees the default value. */ |
1259 | 1260 |
1260 /* If the variable is a Lisp_Some_Buffer_Local_Value, | 1261 /* If the variable is not local_if_set, |
1261 or if this is `let' rather than `set', | 1262 or if this is `let' rather than `set', |
1262 make CURRENT-ALIST-ELEMENT point to itself, | 1263 make CURRENT-ALIST-ELEMENT point to itself, |
1263 indicating that we're seeing the default value. | 1264 indicating that we're seeing the default value. |
1264 Likewise if the variable has been let-bound | 1265 Likewise if the variable has been let-bound |
1265 in the current buffer. */ | 1266 in the current buffer. */ |
1296 /* Set `buffer' and `frame' slots for the binding now loaded. */ | 1297 /* Set `buffer' and `frame' slots for the binding now loaded. */ |
1297 XSETBUFFER (XBUFFER_LOCAL_VALUE (valcontents)->buffer, buf); | 1298 XSETBUFFER (XBUFFER_LOCAL_VALUE (valcontents)->buffer, buf); |
1298 XBUFFER_LOCAL_VALUE (valcontents)->frame = selected_frame; | 1299 XBUFFER_LOCAL_VALUE (valcontents)->frame = selected_frame; |
1299 } | 1300 } |
1300 innercontents = XBUFFER_LOCAL_VALUE (valcontents)->realvalue; | 1301 innercontents = XBUFFER_LOCAL_VALUE (valcontents)->realvalue; |
1302 | |
1303 /* Store the new value in the cons-cell. */ | |
1304 XSETCDR (XCAR (XBUFFER_LOCAL_VALUE (valcontents)->cdr), newval); | |
1301 } | 1305 } |
1302 | 1306 |
1303 /* If storing void (making the symbol void), forward only through | 1307 /* If storing void (making the symbol void), forward only through |
1304 buffer-local indicator, not through Lisp_Objfwd, etc. */ | 1308 buffer-local indicator, not through Lisp_Objfwd, etc. */ |
1305 if (voide) | 1309 if (voide) |
1306 store_symval_forwarding (symbol, Qnil, newval, buf); | 1310 store_symval_forwarding (symbol, Qnil, newval, buf); |
1307 else | 1311 else |
1308 store_symval_forwarding (symbol, innercontents, newval, buf); | 1312 store_symval_forwarding (symbol, innercontents, newval, buf); |
1309 | |
1310 /* If we just set a variable whose current binding is frame-local, | |
1311 store the new value in the frame parameter too. */ | |
1312 | |
1313 if (BUFFER_LOCAL_VALUEP (valcontents)) | |
1314 { | |
1315 /* What binding is loaded right now? */ | |
1316 current_alist_element | |
1317 = XCAR (XBUFFER_LOCAL_VALUE (valcontents)->cdr); | |
1318 | |
1319 /* If the current buffer is not the buffer whose binding is | |
1320 loaded, or if there may be frame-local bindings and the frame | |
1321 isn't the right one, or if it's a Lisp_Buffer_Local_Value and | |
1322 the default binding is loaded, the loaded binding may be the | |
1323 wrong one. */ | |
1324 if (XBUFFER_LOCAL_VALUE (valcontents)->found_for_frame) | |
1325 XSETCDR (current_alist_element, newval); | |
1326 } | |
1327 | 1313 |
1328 return newval; | 1314 return newval; |
1329 } | 1315 } |
1330 | 1316 |
1331 /* Access or set a buffer-local symbol's default value. */ | 1317 /* Access or set a buffer-local symbol's default value. */ |