aboutsummaryrefslogtreecommitdiffstats
path: root/src/data.c
diff options
context:
space:
mode:
authorTom Tromey2012-08-20 07:34:41 -0600
committerTom Tromey2012-08-20 07:34:41 -0600
commit49bc1a9dfc6e81a370bf12157c3c573743ee200a (patch)
tree24df8b040aff367adc11a2c676334ec238651e1d /src/data.c
parentb94de893429bbfbb27572c8c3118fcc876957adb (diff)
parenta05731a0cc2553af0469bd9b7d6ac10cd2e6a817 (diff)
downloademacs-49bc1a9dfc6e81a370bf12157c3c573743ee200a.tar.gz
emacs-49bc1a9dfc6e81a370bf12157c3c573743ee200a.zip
Merge from trunk
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 e6342caadf1..fa40f14ccba 100644
--- a/src/data.c
+++ b/src/data.c
@@ -580,7 +580,7 @@ DEFUN ("boundp", Fboundp, Sboundp, 1, 1, 0,
580 else 580 else
581 { 581 {
582 swap_in_symval_forwarding (sym, blv); 582 swap_in_symval_forwarding (sym, blv);
583 valcontents = BLV_VALUE (blv); 583 valcontents = blv_value (blv);
584 } 584 }
585 break; 585 break;
586 } 586 }
@@ -884,7 +884,7 @@ do_symval_forwarding (register union Lisp_Fwd *valcontents)
884 return *XOBJFWD (valcontents)->objvar; 884 return *XOBJFWD (valcontents)->objvar;
885 885
886 case Lisp_Fwd_Buffer_Obj: 886 case Lisp_Fwd_Buffer_Obj:
887 return PER_BUFFER_VALUE (current_buffer, 887 return per_buffer_value (current_buffer,
888 XBUFFER_OBJFWD (valcontents)->offset); 888 XBUFFER_OBJFWD (valcontents)->offset);
889 889
890 case Lisp_Fwd_Kboard_Obj: 890 case Lisp_Fwd_Kboard_Obj:
@@ -956,7 +956,7 @@ store_symval_forwarding (union Lisp_Fwd *valcontents, register Lisp_Object newva
956 b = XBUFFER (lbuf); 956 b = XBUFFER (lbuf);
957 957
958 if (! PER_BUFFER_VALUE_P (b, idx)) 958 if (! PER_BUFFER_VALUE_P (b, idx))
959 PER_BUFFER_VALUE (b, offset) = newval; 959 set_per_buffer_value (b, offset, newval);
960 } 960 }
961 } 961 }
962 break; 962 break;
@@ -974,7 +974,7 @@ store_symval_forwarding (union Lisp_Fwd *valcontents, register Lisp_Object newva
974 974
975 if (buf == NULL) 975 if (buf == NULL)
976 buf = current_buffer; 976 buf = current_buffer;
977 PER_BUFFER_VALUE (buf, offset) = newval; 977 set_per_buffer_value (buf, offset, newval);
978 } 978 }
979 break; 979 break;
980 980
@@ -1001,16 +1001,16 @@ swap_in_global_binding (struct Lisp_Symbol *symbol)
1001 1001
1002 /* Unload the previously loaded binding. */ 1002 /* Unload the previously loaded binding. */
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 1005
1006 /* Select the global binding in the symbol. */ 1006 /* Select the global binding in the symbol. */
1007 blv->valcell = blv->defcell; 1007 set_blv_valcell (blv, blv->defcell);
1008 if (blv->fwd) 1008 if (blv->fwd)
1009 store_symval_forwarding (blv->fwd, XCDR (blv->defcell), NULL); 1009 store_symval_forwarding (blv->fwd, XCDR (blv->defcell), NULL);
1010 1010
1011 /* Indicate that the global binding is set up now. */ 1011 /* Indicate that the global binding is set up now. */
1012 blv->where = Qnil; 1012 set_blv_where (blv, Qnil);
1013 SET_BLV_FOUND (blv, 0); 1013 set_blv_found (blv, 0);
1014} 1014}
1015 1015
1016/* Set up the buffer-local symbol SYMBOL for validity in the current buffer. 1016/* Set up the buffer-local symbol SYMBOL for validity in the current buffer.
@@ -1038,7 +1038,7 @@ swap_in_symval_forwarding (struct Lisp_Symbol *symbol, struct Lisp_Buffer_Local_
1038 /* Unload the previously loaded binding. */ 1038 /* Unload the previously loaded binding. */
1039 tem1 = blv->valcell; 1039 tem1 = blv->valcell;
1040 if (blv->fwd) 1040 if (blv->fwd)
1041 SET_BLV_VALUE (blv, do_symval_forwarding (blv->fwd)); 1041 set_blv_value (blv, do_symval_forwarding (blv->fwd));
1042 /* Choose the new binding. */ 1042 /* Choose the new binding. */
1043 { 1043 {
1044 Lisp_Object var; 1044 Lisp_Object var;
@@ -1046,7 +1046,7 @@ swap_in_symval_forwarding (struct Lisp_Symbol *symbol, struct Lisp_Buffer_Local_
1046 if (blv->frame_local) 1046 if (blv->frame_local)
1047 { 1047 {
1048 tem1 = assq_no_quit (var, XFRAME (selected_frame)->param_alist); 1048 tem1 = assq_no_quit (var, XFRAME (selected_frame)->param_alist);
1049 blv->where = selected_frame; 1049 set_blv_where (blv, selected_frame);
1050 } 1050 }
1051 else 1051 else
1052 { 1052 {
@@ -1058,9 +1058,9 @@ swap_in_symval_forwarding (struct Lisp_Symbol *symbol, struct Lisp_Buffer_Local_
1058 tem1 = blv->defcell; 1058 tem1 = blv->defcell;
1059 1059
1060 /* Load the new binding. */ 1060 /* Load the new binding. */
1061 blv->valcell = tem1; 1061 set_blv_valcell (blv, tem1);
1062 if (blv->fwd) 1062 if (blv->fwd)
1063 store_symval_forwarding (blv->fwd, BLV_VALUE (blv), NULL); 1063 store_symval_forwarding (blv->fwd, blv_value (blv), NULL);
1064 } 1064 }
1065} 1065}
1066 1066
@@ -1087,7 +1087,7 @@ find_symbol_value (Lisp_Object symbol)
1087 { 1087 {
1088 struct Lisp_Buffer_Local_Value *blv = SYMBOL_BLV (sym); 1088 struct Lisp_Buffer_Local_Value *blv = SYMBOL_BLV (sym);
1089 swap_in_symval_forwarding (sym, blv); 1089 swap_in_symval_forwarding (sym, blv);
1090 return blv->fwd ? do_symval_forwarding (blv->fwd) : BLV_VALUE (blv); 1090 return blv->fwd ? do_symval_forwarding (blv->fwd) : blv_value (blv);
1091 } 1091 }
1092 /* FALLTHROUGH */ 1092 /* FALLTHROUGH */
1093 case SYMBOL_FORWARDED: 1093 case SYMBOL_FORWARDED:
@@ -1212,7 +1212,7 @@ set_internal (register Lisp_Object symbol, register Lisp_Object newval, register
1212 1212
1213 /* Write out `realvalue' to the old loaded binding. */ 1213 /* Write out `realvalue' to the old loaded binding. */
1214 if (blv->fwd) 1214 if (blv->fwd)
1215 SET_BLV_VALUE (blv, do_symval_forwarding (blv->fwd)); 1215 set_blv_value (blv, do_symval_forwarding (blv->fwd));
1216 1216
1217 /* Find the new binding. */ 1217 /* Find the new binding. */
1218 XSETSYMBOL (symbol, sym); /* May have changed via aliasing. */ 1218 XSETSYMBOL (symbol, sym); /* May have changed via aliasing. */
@@ -1220,7 +1220,7 @@ set_internal (register Lisp_Object symbol, register Lisp_Object newval, register
1220 (blv->frame_local 1220 (blv->frame_local
1221 ? XFRAME (where)->param_alist 1221 ? XFRAME (where)->param_alist
1222 : BVAR (XBUFFER (where), local_var_alist))); 1222 : BVAR (XBUFFER (where), local_var_alist)));
1223 blv->where = where; 1223 set_blv_where (blv, where);
1224 blv->found = 1; 1224 blv->found = 1;
1225 1225
1226 if (NILP (tem1)) 1226 if (NILP (tem1))
@@ -1250,17 +1250,18 @@ set_internal (register Lisp_Object symbol, register Lisp_Object newval, register
1250 bindings, not for frame-local bindings. */ 1250 bindings, not for frame-local bindings. */
1251 eassert (!blv->frame_local); 1251 eassert (!blv->frame_local);
1252 tem1 = Fcons (symbol, XCDR (blv->defcell)); 1252 tem1 = Fcons (symbol, XCDR (blv->defcell));
1253 BSET (XBUFFER (where), local_var_alist, 1253 bset_local_var_alist
1254 Fcons (tem1, BVAR (XBUFFER (where), local_var_alist))); 1254 (XBUFFER (where),
1255 Fcons (tem1, BVAR (XBUFFER (where), local_var_alist)));
1255 } 1256 }
1256 } 1257 }
1257 1258
1258 /* Record which binding is now loaded. */ 1259 /* Record which binding is now loaded. */
1259 blv->valcell = tem1; 1260 set_blv_valcell (blv, tem1);
1260 } 1261 }
1261 1262
1262 /* Store the new value in the cons cell. */ 1263 /* Store the new value in the cons cell. */
1263 SET_BLV_VALUE (blv, newval); 1264 set_blv_value (blv, newval);
1264 1265
1265 if (blv->fwd) 1266 if (blv->fwd)
1266 { 1267 {
@@ -1345,7 +1346,7 @@ default_value (Lisp_Object symbol)
1345 { 1346 {
1346 int offset = XBUFFER_OBJFWD (valcontents)->offset; 1347 int offset = XBUFFER_OBJFWD (valcontents)->offset;
1347 if (PER_BUFFER_IDX (offset) != 0) 1348 if (PER_BUFFER_IDX (offset) != 0)
1348 return PER_BUFFER_DEFAULT (offset); 1349 return per_buffer_default (offset);
1349 } 1350 }
1350 1351
1351 /* For other variables, get the current value. */ 1352 /* For other variables, get the current value. */
@@ -1432,7 +1433,7 @@ for this variable. */)
1432 int offset = XBUFFER_OBJFWD (valcontents)->offset; 1433 int offset = XBUFFER_OBJFWD (valcontents)->offset;
1433 int idx = PER_BUFFER_IDX (offset); 1434 int idx = PER_BUFFER_IDX (offset);
1434 1435
1435 PER_BUFFER_DEFAULT (offset) = value; 1436 set_per_buffer_default (offset, value);
1436 1437
1437 /* If this variable is not always local in all buffers, 1438 /* If this variable is not always local in all buffers,
1438 set it in the buffers that don't nominally have a local value. */ 1439 set it in the buffers that don't nominally have a local value. */
@@ -1442,7 +1443,7 @@ for this variable. */)
1442 1443
1443 FOR_EACH_BUFFER (b) 1444 FOR_EACH_BUFFER (b)
1444 if (!PER_BUFFER_VALUE_P (b, idx)) 1445 if (!PER_BUFFER_VALUE_P (b, idx))
1445 PER_BUFFER_VALUE (b, offset) = value; 1446 set_per_buffer_value (b, offset, value);
1446 } 1447 }
1447 return value; 1448 return value;
1448 } 1449 }
@@ -1516,12 +1517,12 @@ make_blv (struct Lisp_Symbol *sym, int forwarded, union Lisp_Val_Fwd valcontents
1516 eassert (!(forwarded && BUFFER_OBJFWDP (valcontents.fwd))); 1517 eassert (!(forwarded && BUFFER_OBJFWDP (valcontents.fwd)));
1517 eassert (!(forwarded && KBOARD_OBJFWDP (valcontents.fwd))); 1518 eassert (!(forwarded && KBOARD_OBJFWDP (valcontents.fwd)));
1518 blv->fwd = forwarded ? valcontents.fwd : NULL; 1519 blv->fwd = forwarded ? valcontents.fwd : NULL;
1519 blv->where = Qnil; 1520 set_blv_where (blv, Qnil);
1520 blv->frame_local = 0; 1521 blv->frame_local = 0;
1521 blv->local_if_set = 0; 1522 blv->local_if_set = 0;
1522 blv->defcell = tem; 1523 set_blv_defcell (blv, tem);
1523 blv->valcell = tem; 1524 set_blv_valcell (blv, tem);
1524 SET_BLV_FOUND (blv, 0); 1525 set_blv_found (blv, 0);
1525 return blv; 1526 return blv;
1526} 1527}
1527 1528
@@ -1690,17 +1691,16 @@ Instead, use `add-hook' and specify t for the LOCAL argument. */)
1690 default value. */ 1691 default value. */
1691 find_symbol_value (variable); 1692 find_symbol_value (variable);
1692 1693
1693 BSET (current_buffer, local_var_alist, 1694 bset_local_var_alist
1694 Fcons (Fcons (variable, XCDR (blv->defcell)), 1695 (current_buffer,
1695 BVAR (current_buffer, local_var_alist))); 1696 Fcons (Fcons (variable, XCDR (blv->defcell)),
1697 BVAR (current_buffer, local_var_alist)));
1696 1698
1697 /* Make sure symbol does not think it is set up for this buffer; 1699 /* Make sure symbol does not think it is set up for this buffer;
1698 force it to look once again for this buffer's value. */ 1700 force it to look once again for this buffer's value. */
1699 if (current_buffer == XBUFFER (blv->where)) 1701 if (current_buffer == XBUFFER (blv->where))
1700 blv->where = Qnil; 1702 set_blv_where (blv, Qnil);
1701 /* blv->valcell = blv->defcell; 1703 set_blv_found (blv, 0);
1702 * SET_BLV_FOUND (blv, 0); */
1703 blv->found = 0;
1704 } 1704 }
1705 1705
1706 /* If the symbol forwards into a C variable, then load the binding 1706 /* If the symbol forwards into a C variable, then load the binding
@@ -1742,8 +1742,8 @@ From now on the default value will apply in this buffer. Return VARIABLE. */)
1742 if (idx > 0) 1742 if (idx > 0)
1743 { 1743 {
1744 SET_PER_BUFFER_VALUE_P (current_buffer, idx, 0); 1744 SET_PER_BUFFER_VALUE_P (current_buffer, idx, 0);
1745 PER_BUFFER_VALUE (current_buffer, offset) 1745 set_per_buffer_value (current_buffer, offset,
1746 = PER_BUFFER_DEFAULT (offset); 1746 per_buffer_default (offset));
1747 } 1747 }
1748 } 1748 }
1749 return variable; 1749 return variable;
@@ -1760,8 +1760,9 @@ From now on the default value will apply in this buffer. Return VARIABLE. */)
1760 XSETSYMBOL (variable, sym); /* Propagate variable indirection. */ 1760 XSETSYMBOL (variable, sym); /* Propagate variable indirection. */
1761 tem = Fassq (variable, BVAR (current_buffer, local_var_alist)); 1761 tem = Fassq (variable, BVAR (current_buffer, local_var_alist));
1762 if (!NILP (tem)) 1762 if (!NILP (tem))
1763 BSET (current_buffer, local_var_alist, 1763 bset_local_var_alist
1764 Fdelq (tem, BVAR (current_buffer, local_var_alist))); 1764 (current_buffer,
1765 Fdelq (tem, BVAR (current_buffer, local_var_alist)));
1765 1766
1766 /* If the symbol is set up with the current buffer's binding 1767 /* If the symbol is set up with the current buffer's binding
1767 loaded, recompute its value. We have to do it now, or else 1768 loaded, recompute its value. We have to do it now, or else
@@ -1770,9 +1771,7 @@ From now on the default value will apply in this buffer. Return VARIABLE. */)
1770 Lisp_Object buf; XSETBUFFER (buf, current_buffer); 1771 Lisp_Object buf; XSETBUFFER (buf, current_buffer);
1771 if (EQ (buf, blv->where)) 1772 if (EQ (buf, blv->where))
1772 { 1773 {
1773 blv->where = Qnil; 1774 set_blv_where (blv, Qnil);
1774 /* blv->valcell = blv->defcell;
1775 * SET_BLV_FOUND (blv, 0); */
1776 blv->found = 0; 1775 blv->found = 0;
1777 find_symbol_value (variable); 1776 find_symbol_value (variable);
1778 } 1777 }
@@ -1894,11 +1893,11 @@ BUFFER defaults to the current buffer. */)
1894 if (EQ (variable, XCAR (elt))) 1893 if (EQ (variable, XCAR (elt)))
1895 { 1894 {
1896 eassert (!blv->frame_local); 1895 eassert (!blv->frame_local);
1897 eassert (BLV_FOUND (blv) || !EQ (blv->where, tmp)); 1896 eassert (blv_found (blv) || !EQ (blv->where, tmp));
1898 return Qt; 1897 return Qt;
1899 } 1898 }
1900 } 1899 }
1901 eassert (!BLV_FOUND (blv) || !EQ (blv->where, tmp)); 1900 eassert (!blv_found (blv) || !EQ (blv->where, tmp));
1902 return Qnil; 1901 return Qnil;
1903 } 1902 }
1904 case SYMBOL_FORWARDED: 1903 case SYMBOL_FORWARDED:
@@ -1988,7 +1987,7 @@ If the current binding is global (the default), the value is nil. */)
1988 if (!NILP (Flocal_variable_p (variable, Qnil))) 1987 if (!NILP (Flocal_variable_p (variable, Qnil)))
1989 return Fcurrent_buffer (); 1988 return Fcurrent_buffer ();
1990 else if (sym->redirect == SYMBOL_LOCALIZED 1989 else if (sym->redirect == SYMBOL_LOCALIZED
1991 && BLV_FOUND (SYMBOL_BLV (sym))) 1990 && blv_found (SYMBOL_BLV (sym)))
1992 return SYMBOL_BLV (sym)->where; 1991 return SYMBOL_BLV (sym)->where;
1993 else 1992 else
1994 return Qnil; 1993 return Qnil;