aboutsummaryrefslogtreecommitdiffstats
path: root/src/data.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/data.c')
-rw-r--r--src/data.c85
1 files changed, 42 insertions, 43 deletions
diff --git a/src/data.c b/src/data.c
index d0ef5734abc..f812c280b40 100644
--- a/src/data.c
+++ b/src/data.c
@@ -543,7 +543,7 @@ DEFUN ("boundp", Fboundp, Sboundp, 1, 1, 0,
543 else 543 else
544 { 544 {
545 swap_in_symval_forwarding (sym, blv); 545 swap_in_symval_forwarding (sym, blv);
546 valcontents = BLV_VALUE (blv); 546 valcontents = blv_value (blv);
547 } 547 }
548 break; 548 break;
549 } 549 }
@@ -847,7 +847,7 @@ do_symval_forwarding (register union Lisp_Fwd *valcontents)
847 return *XOBJFWD (valcontents)->objvar; 847 return *XOBJFWD (valcontents)->objvar;
848 848
849 case Lisp_Fwd_Buffer_Obj: 849 case Lisp_Fwd_Buffer_Obj:
850 return PER_BUFFER_VALUE (current_buffer, 850 return per_buffer_value (current_buffer,
851 XBUFFER_OBJFWD (valcontents)->offset); 851 XBUFFER_OBJFWD (valcontents)->offset);
852 852
853 case Lisp_Fwd_Kboard_Obj: 853 case Lisp_Fwd_Kboard_Obj:
@@ -919,7 +919,7 @@ store_symval_forwarding (union Lisp_Fwd *valcontents, register Lisp_Object newva
919 b = XBUFFER (lbuf); 919 b = XBUFFER (lbuf);
920 920
921 if (! PER_BUFFER_VALUE_P (b, idx)) 921 if (! PER_BUFFER_VALUE_P (b, idx))
922 PER_BUFFER_VALUE (b, offset) = newval; 922 set_per_buffer_value (b, offset, newval);
923 } 923 }
924 } 924 }
925 break; 925 break;
@@ -937,7 +937,7 @@ store_symval_forwarding (union Lisp_Fwd *valcontents, register Lisp_Object newva
937 937
938 if (buf == NULL) 938 if (buf == NULL)
939 buf = current_buffer; 939 buf = current_buffer;
940 PER_BUFFER_VALUE (buf, offset) = newval; 940 set_per_buffer_value (buf, offset, newval);
941 } 941 }
942 break; 942 break;
943 943
@@ -964,16 +964,16 @@ swap_in_global_binding (struct Lisp_Symbol *symbol)
964 964
965 /* Unload the previously loaded binding. */ 965 /* Unload the previously loaded binding. */
966 if (blv->fwd) 966 if (blv->fwd)
967 SET_BLV_VALUE (blv, do_symval_forwarding (blv->fwd)); 967 set_blv_value (blv, do_symval_forwarding (blv->fwd));
968 968
969 /* Select the global binding in the symbol. */ 969 /* Select the global binding in the symbol. */
970 blv->valcell = blv->defcell; 970 set_blv_valcell (blv, blv->defcell);
971 if (blv->fwd) 971 if (blv->fwd)
972 store_symval_forwarding (blv->fwd, XCDR (blv->defcell), NULL); 972 store_symval_forwarding (blv->fwd, XCDR (blv->defcell), NULL);
973 973
974 /* Indicate that the global binding is set up now. */ 974 /* Indicate that the global binding is set up now. */
975 blv->where = Qnil; 975 set_blv_where (blv, Qnil);
976 SET_BLV_FOUND (blv, 0); 976 set_blv_found (blv, 0);
977} 977}
978 978
979/* Set up the buffer-local symbol SYMBOL for validity in the current buffer. 979/* Set up the buffer-local symbol SYMBOL for validity in the current buffer.
@@ -1001,7 +1001,7 @@ swap_in_symval_forwarding (struct Lisp_Symbol *symbol, struct Lisp_Buffer_Local_
1001 /* Unload the previously loaded binding. */ 1001 /* Unload the previously loaded binding. */
1002 tem1 = blv->valcell; 1002 tem1 = blv->valcell;
1003 if (blv->fwd) 1003 if (blv->fwd)
1004 SET_BLV_VALUE (blv, do_symval_forwarding (blv->fwd)); 1004 set_blv_value (blv, do_symval_forwarding (blv->fwd));
1005 /* Choose the new binding. */ 1005 /* Choose the new binding. */
1006 { 1006 {
1007 Lisp_Object var; 1007 Lisp_Object var;
@@ -1009,7 +1009,7 @@ swap_in_symval_forwarding (struct Lisp_Symbol *symbol, struct Lisp_Buffer_Local_
1009 if (blv->frame_local) 1009 if (blv->frame_local)
1010 { 1010 {
1011 tem1 = assq_no_quit (var, XFRAME (selected_frame)->param_alist); 1011 tem1 = assq_no_quit (var, XFRAME (selected_frame)->param_alist);
1012 blv->where = selected_frame; 1012 set_blv_where (blv, selected_frame);
1013 } 1013 }
1014 else 1014 else
1015 { 1015 {
@@ -1021,9 +1021,9 @@ swap_in_symval_forwarding (struct Lisp_Symbol *symbol, struct Lisp_Buffer_Local_
1021 tem1 = blv->defcell; 1021 tem1 = blv->defcell;
1022 1022
1023 /* Load the new binding. */ 1023 /* Load the new binding. */
1024 blv->valcell = tem1; 1024 set_blv_valcell (blv, tem1);
1025 if (blv->fwd) 1025 if (blv->fwd)
1026 store_symval_forwarding (blv->fwd, BLV_VALUE (blv), NULL); 1026 store_symval_forwarding (blv->fwd, blv_value (blv), NULL);
1027 } 1027 }
1028} 1028}
1029 1029
@@ -1050,7 +1050,7 @@ find_symbol_value (Lisp_Object symbol)
1050 { 1050 {
1051 struct Lisp_Buffer_Local_Value *blv = SYMBOL_BLV (sym); 1051 struct Lisp_Buffer_Local_Value *blv = SYMBOL_BLV (sym);
1052 swap_in_symval_forwarding (sym, blv); 1052 swap_in_symval_forwarding (sym, blv);
1053 return blv->fwd ? do_symval_forwarding (blv->fwd) : BLV_VALUE (blv); 1053 return blv->fwd ? do_symval_forwarding (blv->fwd) : blv_value (blv);
1054 } 1054 }
1055 /* FALLTHROUGH */ 1055 /* FALLTHROUGH */
1056 case SYMBOL_FORWARDED: 1056 case SYMBOL_FORWARDED:
@@ -1175,7 +1175,7 @@ set_internal (register Lisp_Object symbol, register Lisp_Object newval, register
1175 1175
1176 /* Write out `realvalue' to the old loaded binding. */ 1176 /* Write out `realvalue' to the old loaded binding. */
1177 if (blv->fwd) 1177 if (blv->fwd)
1178 SET_BLV_VALUE (blv, do_symval_forwarding (blv->fwd)); 1178 set_blv_value (blv, do_symval_forwarding (blv->fwd));
1179 1179
1180 /* Find the new binding. */ 1180 /* Find the new binding. */
1181 XSETSYMBOL (symbol, sym); /* May have changed via aliasing. */ 1181 XSETSYMBOL (symbol, sym); /* May have changed via aliasing. */
@@ -1183,7 +1183,7 @@ set_internal (register Lisp_Object symbol, register Lisp_Object newval, register
1183 (blv->frame_local 1183 (blv->frame_local
1184 ? XFRAME (where)->param_alist 1184 ? XFRAME (where)->param_alist
1185 : BVAR (XBUFFER (where), local_var_alist))); 1185 : BVAR (XBUFFER (where), local_var_alist)));
1186 blv->where = where; 1186 set_blv_where (blv, where);
1187 blv->found = 1; 1187 blv->found = 1;
1188 1188
1189 if (NILP (tem1)) 1189 if (NILP (tem1))
@@ -1213,17 +1213,18 @@ set_internal (register Lisp_Object symbol, register Lisp_Object newval, register
1213 bindings, not for frame-local bindings. */ 1213 bindings, not for frame-local bindings. */
1214 eassert (!blv->frame_local); 1214 eassert (!blv->frame_local);
1215 tem1 = Fcons (symbol, XCDR (blv->defcell)); 1215 tem1 = Fcons (symbol, XCDR (blv->defcell));
1216 BSET (XBUFFER (where), local_var_alist, 1216 bset_local_var_alist
1217 Fcons (tem1, BVAR (XBUFFER (where), local_var_alist))); 1217 (XBUFFER (where),
1218 Fcons (tem1, BVAR (XBUFFER (where), local_var_alist)));
1218 } 1219 }
1219 } 1220 }
1220 1221
1221 /* Record which binding is now loaded. */ 1222 /* Record which binding is now loaded. */
1222 blv->valcell = tem1; 1223 set_blv_valcell (blv, tem1);
1223 } 1224 }
1224 1225
1225 /* Store the new value in the cons cell. */ 1226 /* Store the new value in the cons cell. */
1226 SET_BLV_VALUE (blv, newval); 1227 set_blv_value (blv, newval);
1227 1228
1228 if (blv->fwd) 1229 if (blv->fwd)
1229 { 1230 {
@@ -1308,7 +1309,7 @@ default_value (Lisp_Object symbol)
1308 { 1309 {
1309 int offset = XBUFFER_OBJFWD (valcontents)->offset; 1310 int offset = XBUFFER_OBJFWD (valcontents)->offset;
1310 if (PER_BUFFER_IDX (offset) != 0) 1311 if (PER_BUFFER_IDX (offset) != 0)
1311 return PER_BUFFER_DEFAULT (offset); 1312 return per_buffer_default (offset);
1312 } 1313 }
1313 1314
1314 /* For other variables, get the current value. */ 1315 /* For other variables, get the current value. */
@@ -1395,7 +1396,7 @@ for this variable. */)
1395 int offset = XBUFFER_OBJFWD (valcontents)->offset; 1396 int offset = XBUFFER_OBJFWD (valcontents)->offset;
1396 int idx = PER_BUFFER_IDX (offset); 1397 int idx = PER_BUFFER_IDX (offset);
1397 1398
1398 PER_BUFFER_DEFAULT (offset) = value; 1399 set_per_buffer_default (offset, value);
1399 1400
1400 /* If this variable is not always local in all buffers, 1401 /* If this variable is not always local in all buffers,
1401 set it in the buffers that don't nominally have a local value. */ 1402 set it in the buffers that don't nominally have a local value. */
@@ -1405,7 +1406,7 @@ for this variable. */)
1405 1406
1406 FOR_EACH_BUFFER (b) 1407 FOR_EACH_BUFFER (b)
1407 if (!PER_BUFFER_VALUE_P (b, idx)) 1408 if (!PER_BUFFER_VALUE_P (b, idx))
1408 PER_BUFFER_VALUE (b, offset) = value; 1409 set_per_buffer_value (b, offset, value);
1409 } 1410 }
1410 return value; 1411 return value;
1411 } 1412 }
@@ -1479,12 +1480,12 @@ make_blv (struct Lisp_Symbol *sym, int forwarded, union Lisp_Val_Fwd valcontents
1479 eassert (!(forwarded && BUFFER_OBJFWDP (valcontents.fwd))); 1480 eassert (!(forwarded && BUFFER_OBJFWDP (valcontents.fwd)));
1480 eassert (!(forwarded && KBOARD_OBJFWDP (valcontents.fwd))); 1481 eassert (!(forwarded && KBOARD_OBJFWDP (valcontents.fwd)));
1481 blv->fwd = forwarded ? valcontents.fwd : NULL; 1482 blv->fwd = forwarded ? valcontents.fwd : NULL;
1482 blv->where = Qnil; 1483 set_blv_where (blv, Qnil);
1483 blv->frame_local = 0; 1484 blv->frame_local = 0;
1484 blv->local_if_set = 0; 1485 blv->local_if_set = 0;
1485 blv->defcell = tem; 1486 set_blv_defcell (blv, tem);
1486 blv->valcell = tem; 1487 set_blv_valcell (blv, tem);
1487 SET_BLV_FOUND (blv, 0); 1488 set_blv_found (blv, 0);
1488 return blv; 1489 return blv;
1489} 1490}
1490 1491
@@ -1653,17 +1654,16 @@ Instead, use `add-hook' and specify t for the LOCAL argument. */)
1653 default value. */ 1654 default value. */
1654 find_symbol_value (variable); 1655 find_symbol_value (variable);
1655 1656
1656 BSET (current_buffer, local_var_alist, 1657 bset_local_var_alist
1657 Fcons (Fcons (variable, XCDR (blv->defcell)), 1658 (current_buffer,
1658 BVAR (current_buffer, local_var_alist))); 1659 Fcons (Fcons (variable, XCDR (blv->defcell)),
1660 BVAR (current_buffer, local_var_alist)));
1659 1661
1660 /* Make sure symbol does not think it is set up for this buffer; 1662 /* Make sure symbol does not think it is set up for this buffer;
1661 force it to look once again for this buffer's value. */ 1663 force it to look once again for this buffer's value. */
1662 if (current_buffer == XBUFFER (blv->where)) 1664 if (current_buffer == XBUFFER (blv->where))
1663 blv->where = Qnil; 1665 set_blv_where (blv, Qnil);
1664 /* blv->valcell = blv->defcell; 1666 set_blv_found (blv, 0);
1665 * SET_BLV_FOUND (blv, 0); */
1666 blv->found = 0;
1667 } 1667 }
1668 1668
1669 /* If the symbol forwards into a C variable, then load the binding 1669 /* If the symbol forwards into a C variable, then load the binding
@@ -1705,8 +1705,8 @@ From now on the default value will apply in this buffer. Return VARIABLE. */)
1705 if (idx > 0) 1705 if (idx > 0)
1706 { 1706 {
1707 SET_PER_BUFFER_VALUE_P (current_buffer, idx, 0); 1707 SET_PER_BUFFER_VALUE_P (current_buffer, idx, 0);
1708 PER_BUFFER_VALUE (current_buffer, offset) 1708 set_per_buffer_value (current_buffer, offset,
1709 = PER_BUFFER_DEFAULT (offset); 1709 per_buffer_default (offset));
1710 } 1710 }
1711 } 1711 }
1712 return variable; 1712 return variable;
@@ -1723,8 +1723,9 @@ From now on the default value will apply in this buffer. Return VARIABLE. */)
1723 XSETSYMBOL (variable, sym); /* Propagate variable indirection. */ 1723 XSETSYMBOL (variable, sym); /* Propagate variable indirection. */
1724 tem = Fassq (variable, BVAR (current_buffer, local_var_alist)); 1724 tem = Fassq (variable, BVAR (current_buffer, local_var_alist));
1725 if (!NILP (tem)) 1725 if (!NILP (tem))
1726 BSET (current_buffer, local_var_alist, 1726 bset_local_var_alist
1727 Fdelq (tem, BVAR (current_buffer, local_var_alist))); 1727 (current_buffer,
1728 Fdelq (tem, BVAR (current_buffer, local_var_alist)));
1728 1729
1729 /* If the symbol is set up with the current buffer's binding 1730 /* If the symbol is set up with the current buffer's binding
1730 loaded, recompute its value. We have to do it now, or else 1731 loaded, recompute its value. We have to do it now, or else
@@ -1733,9 +1734,7 @@ From now on the default value will apply in this buffer. Return VARIABLE. */)
1733 Lisp_Object buf; XSETBUFFER (buf, current_buffer); 1734 Lisp_Object buf; XSETBUFFER (buf, current_buffer);
1734 if (EQ (buf, blv->where)) 1735 if (EQ (buf, blv->where))
1735 { 1736 {
1736 blv->where = Qnil; 1737 set_blv_where (blv, Qnil);
1737 /* blv->valcell = blv->defcell;
1738 * SET_BLV_FOUND (blv, 0); */
1739 blv->found = 0; 1738 blv->found = 0;
1740 find_symbol_value (variable); 1739 find_symbol_value (variable);
1741 } 1740 }
@@ -1857,11 +1856,11 @@ BUFFER defaults to the current buffer. */)
1857 if (EQ (variable, XCAR (elt))) 1856 if (EQ (variable, XCAR (elt)))
1858 { 1857 {
1859 eassert (!blv->frame_local); 1858 eassert (!blv->frame_local);
1860 eassert (BLV_FOUND (blv) || !EQ (blv->where, tmp)); 1859 eassert (blv_found (blv) || !EQ (blv->where, tmp));
1861 return Qt; 1860 return Qt;
1862 } 1861 }
1863 } 1862 }
1864 eassert (!BLV_FOUND (blv) || !EQ (blv->where, tmp)); 1863 eassert (!blv_found (blv) || !EQ (blv->where, tmp));
1865 return Qnil; 1864 return Qnil;
1866 } 1865 }
1867 case SYMBOL_FORWARDED: 1866 case SYMBOL_FORWARDED:
@@ -1951,7 +1950,7 @@ If the current binding is global (the default), the value is nil. */)
1951 if (!NILP (Flocal_variable_p (variable, Qnil))) 1950 if (!NILP (Flocal_variable_p (variable, Qnil)))
1952 return Fcurrent_buffer (); 1951 return Fcurrent_buffer ();
1953 else if (sym->redirect == SYMBOL_LOCALIZED 1952 else if (sym->redirect == SYMBOL_LOCALIZED
1954 && BLV_FOUND (SYMBOL_BLV (sym))) 1953 && blv_found (SYMBOL_BLV (sym)))
1955 return SYMBOL_BLV (sym)->where; 1954 return SYMBOL_BLV (sym)->where;
1956 else 1955 else
1957 return Qnil; 1956 return Qnil;