Mercurial > emacs
comparison src/data.c @ 29735:ab56f683df46
(set_internal): If variable is frame-local,
store the new value immediately into the frame parameter alist.
author | Gerd Moellmann <gerd@gnu.org> |
---|---|
date | Mon, 19 Jun 2000 12:12:35 +0000 |
parents | e522fcce15e8 |
children | b600a31684db |
comparison
equal
deleted
inserted
replaced
29734:afc9d8eb0666 | 29735:ab56f683df46 |
---|---|
1022 struct buffer *buf; | 1022 struct buffer *buf; |
1023 int bindflag; | 1023 int bindflag; |
1024 { | 1024 { |
1025 int voide = EQ (newval, Qunbound); | 1025 int voide = EQ (newval, Qunbound); |
1026 | 1026 |
1027 register Lisp_Object valcontents, tem1, current_alist_element; | 1027 register Lisp_Object valcontents, innercontents, tem1, current_alist_element; |
1028 | 1028 |
1029 if (buf == 0) | 1029 if (buf == 0) |
1030 buf = current_buffer; | 1030 buf = current_buffer; |
1031 | 1031 |
1032 /* If restoring in a dead buffer, do nothing. */ | 1032 /* If restoring in a dead buffer, do nothing. */ |
1037 if (NILP (symbol) || EQ (symbol, Qt) | 1037 if (NILP (symbol) || EQ (symbol, Qt) |
1038 || (XSYMBOL (symbol)->name->data[0] == ':' | 1038 || (XSYMBOL (symbol)->name->data[0] == ':' |
1039 && EQ (XSYMBOL (symbol)->obarray, initial_obarray) | 1039 && EQ (XSYMBOL (symbol)->obarray, initial_obarray) |
1040 && !EQ (newval, symbol))) | 1040 && !EQ (newval, symbol))) |
1041 return Fsignal (Qsetting_constant, Fcons (symbol, Qnil)); | 1041 return Fsignal (Qsetting_constant, Fcons (symbol, Qnil)); |
1042 valcontents = XSYMBOL (symbol)->value; | 1042 |
1043 innercontents = valcontents = XSYMBOL (symbol)->value; | |
1043 | 1044 |
1044 if (BUFFER_OBJFWDP (valcontents)) | 1045 if (BUFFER_OBJFWDP (valcontents)) |
1045 { | 1046 { |
1046 int offset = XBUFFER_OBJFWD (valcontents)->offset; | 1047 int offset = XBUFFER_OBJFWD (valcontents)->offset; |
1047 int idx = PER_BUFFER_IDX (offset); | 1048 int idx = PER_BUFFER_IDX (offset); |
1128 | 1129 |
1129 /* Set `buffer' and `frame' slots for thebinding now loaded. */ | 1130 /* Set `buffer' and `frame' slots for thebinding now loaded. */ |
1130 XSETBUFFER (XBUFFER_LOCAL_VALUE (valcontents)->buffer, buf); | 1131 XSETBUFFER (XBUFFER_LOCAL_VALUE (valcontents)->buffer, buf); |
1131 XBUFFER_LOCAL_VALUE (valcontents)->frame = selected_frame; | 1132 XBUFFER_LOCAL_VALUE (valcontents)->frame = selected_frame; |
1132 } | 1133 } |
1133 valcontents = XBUFFER_LOCAL_VALUE (valcontents)->realvalue; | 1134 innercontents = XBUFFER_LOCAL_VALUE (valcontents)->realvalue; |
1134 } | 1135 } |
1135 | 1136 |
1136 /* If storing void (making the symbol void), forward only through | 1137 /* If storing void (making the symbol void), forward only through |
1137 buffer-local indicator, not through Lisp_Objfwd, etc. */ | 1138 buffer-local indicator, not through Lisp_Objfwd, etc. */ |
1138 if (voide) | 1139 if (voide) |
1139 store_symval_forwarding (symbol, Qnil, newval); | 1140 store_symval_forwarding (symbol, Qnil, newval); |
1140 else | 1141 else |
1141 store_symval_forwarding (symbol, valcontents, newval); | 1142 store_symval_forwarding (symbol, innercontents, newval); |
1143 | |
1144 /* If we just set a variable whose current binding is frame-local, | |
1145 store the new value in the frame parameter too. */ | |
1146 | |
1147 if (BUFFER_LOCAL_VALUEP (valcontents) | |
1148 || SOME_BUFFER_LOCAL_VALUEP (valcontents)) | |
1149 { | |
1150 /* What binding is loaded right now? */ | |
1151 current_alist_element | |
1152 = XCAR (XBUFFER_LOCAL_VALUE (valcontents)->cdr); | |
1153 | |
1154 /* If the current buffer is not the buffer whose binding is | |
1155 loaded, or if there may be frame-local bindings and the frame | |
1156 isn't the right one, or if it's a Lisp_Buffer_Local_Value and | |
1157 the default binding is loaded, the loaded binding may be the | |
1158 wrong one. */ | |
1159 if (XBUFFER_LOCAL_VALUE (valcontents)->found_for_frame) | |
1160 XCDR (current_alist_element) = newval; | |
1161 } | |
1142 | 1162 |
1143 return newval; | 1163 return newval; |
1144 } | 1164 } |
1145 | 1165 |
1146 /* Access or set a buffer-local symbol's default value. */ | 1166 /* Access or set a buffer-local symbol's default value. */ |