aboutsummaryrefslogtreecommitdiffstats
path: root/src/data.c
diff options
context:
space:
mode:
authorMiles Bader2007-10-19 00:00:21 +0000
committerMiles Bader2007-10-19 00:00:21 +0000
commit9c8020a8df03dc67a56d7df15664dcf7ace54bf0 (patch)
tree09b0646addff3c39f9e96ba89c04bdcc038a87a7 /src/data.c
parentdfc3268dfa133a2e0a677f1af7c1ee548eae065d (diff)
parentbd3164743080f3eb5fc316aca7cc5322ca58fe33 (diff)
downloademacs-9c8020a8df03dc67a56d7df15664dcf7ace54bf0.tar.gz
emacs-9c8020a8df03dc67a56d7df15664dcf7ace54bf0.zip
Merge from emacs--devo--0
Patches applied: * emacs--devo--0 (patch 890-898) - Update from CVS - Merge from emacs--rel--22 * emacs--rel--22 (patch 122-128) - Update from CVS - Merge from gnus--rel--5.10 * gnus--rel--5.10 (patch 257-258) - Merge from emacs--rel--22 - Update from CVS Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-270
Diffstat (limited to 'src/data.c')
-rw-r--r--src/data.c99
1 files changed, 45 insertions, 54 deletions
diff --git a/src/data.c b/src/data.c
index 81cffcb38de..3139af1e001 100644
--- a/src/data.c
+++ b/src/data.c
@@ -584,8 +584,7 @@ DEFUN ("boundp", Fboundp, Sboundp, 1, 1, 0,
584 584
585 valcontents = SYMBOL_VALUE (symbol); 585 valcontents = SYMBOL_VALUE (symbol);
586 586
587 if (BUFFER_LOCAL_VALUEP (valcontents) 587 if (BUFFER_LOCAL_VALUEP (valcontents))
588 || SOME_BUFFER_LOCAL_VALUEP (valcontents))
589 valcontents = swap_in_symval_forwarding (symbol, valcontents); 588 valcontents = swap_in_symval_forwarding (symbol, valcontents);
590 589
591 return (EQ (valcontents, Qunbound) ? Qnil : Qt); 590 return (EQ (valcontents, Qunbound) ? Qnil : Qt);
@@ -998,8 +997,7 @@ store_symval_forwarding (symbol, valcontents, newval, buf)
998 default: 997 default:
999 def: 998 def:
1000 valcontents = SYMBOL_VALUE (symbol); 999 valcontents = SYMBOL_VALUE (symbol);
1001 if (BUFFER_LOCAL_VALUEP (valcontents) 1000 if (BUFFER_LOCAL_VALUEP (valcontents))
1002 || SOME_BUFFER_LOCAL_VALUEP (valcontents))
1003 XBUFFER_LOCAL_VALUE (valcontents)->realvalue = newval; 1001 XBUFFER_LOCAL_VALUE (valcontents)->realvalue = newval;
1004 else 1002 else
1005 SET_SYMBOL_VALUE (symbol, newval); 1003 SET_SYMBOL_VALUE (symbol, newval);
@@ -1016,8 +1014,7 @@ swap_in_global_binding (symbol)
1016 Lisp_Object valcontents, cdr; 1014 Lisp_Object valcontents, cdr;
1017 1015
1018 valcontents = SYMBOL_VALUE (symbol); 1016 valcontents = SYMBOL_VALUE (symbol);
1019 if (!BUFFER_LOCAL_VALUEP (valcontents) 1017 if (!BUFFER_LOCAL_VALUEP (valcontents))
1020 && !SOME_BUFFER_LOCAL_VALUEP (valcontents))
1021 abort (); 1018 abort ();
1022 cdr = XBUFFER_LOCAL_VALUE (valcontents)->cdr; 1019 cdr = XBUFFER_LOCAL_VALUE (valcontents)->cdr;
1023 1020
@@ -1106,8 +1103,7 @@ find_symbol_value (symbol)
1106 CHECK_SYMBOL (symbol); 1103 CHECK_SYMBOL (symbol);
1107 valcontents = SYMBOL_VALUE (symbol); 1104 valcontents = SYMBOL_VALUE (symbol);
1108 1105
1109 if (BUFFER_LOCAL_VALUEP (valcontents) 1106 if (BUFFER_LOCAL_VALUEP (valcontents))
1110 || SOME_BUFFER_LOCAL_VALUEP (valcontents))
1111 valcontents = swap_in_symval_forwarding (symbol, valcontents); 1107 valcontents = swap_in_symval_forwarding (symbol, valcontents);
1112 1108
1113 if (MISCP (valcontents)) 1109 if (MISCP (valcontents))
@@ -1225,8 +1221,7 @@ set_internal (symbol, newval, buf, bindflag)
1225 && !let_shadows_buffer_binding_p (symbol)) 1221 && !let_shadows_buffer_binding_p (symbol))
1226 SET_PER_BUFFER_VALUE_P (buf, idx, 1); 1222 SET_PER_BUFFER_VALUE_P (buf, idx, 1);
1227 } 1223 }
1228 else if (BUFFER_LOCAL_VALUEP (valcontents) 1224 else if (BUFFER_LOCAL_VALUEP (valcontents))
1229 || SOME_BUFFER_LOCAL_VALUEP (valcontents))
1230 { 1225 {
1231 /* valcontents is a struct Lisp_Buffer_Local_Value. */ 1226 /* valcontents is a struct Lisp_Buffer_Local_Value. */
1232 if (XSYMBOL (symbol)->indirect_variable) 1227 if (XSYMBOL (symbol)->indirect_variable)
@@ -1271,7 +1266,7 @@ set_internal (symbol, newval, buf, bindflag)
1271 indicating that we're seeing the default value. 1266 indicating that we're seeing the default value.
1272 Likewise if the variable has been let-bound 1267 Likewise if the variable has been let-bound
1273 in the current buffer. */ 1268 in the current buffer. */
1274 if (bindflag || SOME_BUFFER_LOCAL_VALUEP (valcontents) 1269 if (bindflag || !XBUFFER_LOCAL_VALUE (valcontents)->local_if_set
1275 || let_shadows_buffer_binding_p (symbol)) 1270 || let_shadows_buffer_binding_p (symbol))
1276 { 1271 {
1277 XBUFFER_LOCAL_VALUE (valcontents)->found_for_buffer = 0; 1272 XBUFFER_LOCAL_VALUE (valcontents)->found_for_buffer = 0;
@@ -1299,8 +1294,7 @@ set_internal (symbol, newval, buf, bindflag)
1299 } 1294 }
1300 1295
1301 /* Record which binding is now loaded. */ 1296 /* Record which binding is now loaded. */
1302 XSETCAR (XBUFFER_LOCAL_VALUE (valcontents)->cdr, 1297 XSETCAR (XBUFFER_LOCAL_VALUE (valcontents)->cdr, tem1);
1303 tem1);
1304 1298
1305 /* Set `buffer' and `frame' slots for the binding now loaded. */ 1299 /* Set `buffer' and `frame' slots for the binding now loaded. */
1306 XSETBUFFER (XBUFFER_LOCAL_VALUE (valcontents)->buffer, buf); 1300 XSETBUFFER (XBUFFER_LOCAL_VALUE (valcontents)->buffer, buf);
@@ -1319,8 +1313,7 @@ set_internal (symbol, newval, buf, bindflag)
1319 /* If we just set a variable whose current binding is frame-local, 1313 /* If we just set a variable whose current binding is frame-local,
1320 store the new value in the frame parameter too. */ 1314 store the new value in the frame parameter too. */
1321 1315
1322 if (BUFFER_LOCAL_VALUEP (valcontents) 1316 if (BUFFER_LOCAL_VALUEP (valcontents))
1323 || SOME_BUFFER_LOCAL_VALUEP (valcontents))
1324 { 1317 {
1325 /* What binding is loaded right now? */ 1318 /* What binding is loaded right now? */
1326 current_alist_element 1319 current_alist_element
@@ -1362,8 +1355,7 @@ default_value (symbol)
1362 } 1355 }
1363 1356
1364 /* Handle user-created local variables. */ 1357 /* Handle user-created local variables. */
1365 if (BUFFER_LOCAL_VALUEP (valcontents) 1358 if (BUFFER_LOCAL_VALUEP (valcontents))
1366 || SOME_BUFFER_LOCAL_VALUEP (valcontents))
1367 { 1359 {
1368 /* If var is set up for a buffer that lacks a local value for it, 1360 /* If var is set up for a buffer that lacks a local value for it,
1369 the current value is nominally the default value. 1361 the current value is nominally the default value.
@@ -1447,8 +1439,7 @@ for this variable. */)
1447 return value; 1439 return value;
1448 } 1440 }
1449 1441
1450 if (!BUFFER_LOCAL_VALUEP (valcontents) 1442 if (!BUFFER_LOCAL_VALUEP (valcontents))
1451 && !SOME_BUFFER_LOCAL_VALUEP (valcontents))
1452 return Fset (symbol, value); 1443 return Fset (symbol, value);
1453 1444
1454 /* Store new value into the DEFAULT-VALUE slot. */ 1445 /* Store new value into the DEFAULT-VALUE slot. */
@@ -1533,27 +1524,28 @@ The function `default-value' gets the default value and `set-default' sets it.
1533 if (EQ (variable, Qnil) || EQ (variable, Qt) || KBOARD_OBJFWDP (valcontents)) 1524 if (EQ (variable, Qnil) || EQ (variable, Qt) || KBOARD_OBJFWDP (valcontents))
1534 error ("Symbol %s may not be buffer-local", SDATA (SYMBOL_NAME (variable))); 1525 error ("Symbol %s may not be buffer-local", SDATA (SYMBOL_NAME (variable)));
1535 1526
1536 if (BUFFER_LOCAL_VALUEP (valcontents) || BUFFER_OBJFWDP (valcontents)) 1527 if (BUFFER_OBJFWDP (valcontents))
1537 return variable; 1528 return variable;
1538 if (SOME_BUFFER_LOCAL_VALUEP (valcontents)) 1529 else if (BUFFER_LOCAL_VALUEP (valcontents))
1530 newval = valcontents;
1531 else
1539 { 1532 {
1540 XMISCTYPE (SYMBOL_VALUE (variable)) = Lisp_Misc_Buffer_Local_Value; 1533 if (EQ (valcontents, Qunbound))
1541 return variable; 1534 SET_SYMBOL_VALUE (variable, Qnil);
1535 tem = Fcons (Qnil, Fsymbol_value (variable));
1536 XSETCAR (tem, tem);
1537 newval = allocate_misc ();
1538 XMISCTYPE (newval) = Lisp_Misc_Buffer_Local_Value;
1539 XBUFFER_LOCAL_VALUE (newval)->realvalue = SYMBOL_VALUE (variable);
1540 XBUFFER_LOCAL_VALUE (newval)->buffer = Fcurrent_buffer ();
1541 XBUFFER_LOCAL_VALUE (newval)->frame = Qnil;
1542 XBUFFER_LOCAL_VALUE (newval)->found_for_buffer = 0;
1543 XBUFFER_LOCAL_VALUE (newval)->found_for_frame = 0;
1544 XBUFFER_LOCAL_VALUE (newval)->check_frame = 0;
1545 XBUFFER_LOCAL_VALUE (newval)->cdr = tem;
1546 SET_SYMBOL_VALUE (variable, newval);
1542 } 1547 }
1543 if (EQ (valcontents, Qunbound)) 1548 XBUFFER_LOCAL_VALUE (newval)->local_if_set = 1;
1544 SET_SYMBOL_VALUE (variable, Qnil);
1545 tem = Fcons (Qnil, Fsymbol_value (variable));
1546 XSETCAR (tem, tem);
1547 newval = allocate_misc ();
1548 XMISCTYPE (newval) = Lisp_Misc_Buffer_Local_Value;
1549 XBUFFER_LOCAL_VALUE (newval)->realvalue = SYMBOL_VALUE (variable);
1550 XBUFFER_LOCAL_VALUE (newval)->buffer = Fcurrent_buffer ();
1551 XBUFFER_LOCAL_VALUE (newval)->frame = Qnil;
1552 XBUFFER_LOCAL_VALUE (newval)->found_for_buffer = 0;
1553 XBUFFER_LOCAL_VALUE (newval)->found_for_frame = 0;
1554 XBUFFER_LOCAL_VALUE (newval)->check_frame = 0;
1555 XBUFFER_LOCAL_VALUE (newval)->cdr = tem;
1556 SET_SYMBOL_VALUE (variable, newval);
1557 return variable; 1549 return variable;
1558} 1550}
1559 1551
@@ -1589,7 +1581,9 @@ Instead, use `add-hook' and specify t for the LOCAL argument. */)
1589 if (EQ (variable, Qnil) || EQ (variable, Qt) || KBOARD_OBJFWDP (valcontents)) 1581 if (EQ (variable, Qnil) || EQ (variable, Qt) || KBOARD_OBJFWDP (valcontents))
1590 error ("Symbol %s may not be buffer-local", SDATA (SYMBOL_NAME (variable))); 1582 error ("Symbol %s may not be buffer-local", SDATA (SYMBOL_NAME (variable)));
1591 1583
1592 if (BUFFER_LOCAL_VALUEP (valcontents) || BUFFER_OBJFWDP (valcontents)) 1584 if ((BUFFER_LOCAL_VALUEP (valcontents)
1585 && XBUFFER_LOCAL_VALUE (valcontents)->local_if_set)
1586 || BUFFER_OBJFWDP (valcontents))
1593 { 1587 {
1594 tem = Fboundp (variable); 1588 tem = Fboundp (variable);
1595 1589
@@ -1599,16 +1593,17 @@ Instead, use `add-hook' and specify t for the LOCAL argument. */)
1599 return variable; 1593 return variable;
1600 } 1594 }
1601 /* Make sure symbol is set up to hold per-buffer values. */ 1595 /* Make sure symbol is set up to hold per-buffer values. */
1602 if (!SOME_BUFFER_LOCAL_VALUEP (valcontents)) 1596 if (!BUFFER_LOCAL_VALUEP (valcontents))
1603 { 1597 {
1604 Lisp_Object newval; 1598 Lisp_Object newval;
1605 tem = Fcons (Qnil, do_symval_forwarding (valcontents)); 1599 tem = Fcons (Qnil, do_symval_forwarding (valcontents));
1606 XSETCAR (tem, tem); 1600 XSETCAR (tem, tem);
1607 newval = allocate_misc (); 1601 newval = allocate_misc ();
1608 XMISCTYPE (newval) = Lisp_Misc_Some_Buffer_Local_Value; 1602 XMISCTYPE (newval) = Lisp_Misc_Buffer_Local_Value;
1609 XBUFFER_LOCAL_VALUE (newval)->realvalue = SYMBOL_VALUE (variable); 1603 XBUFFER_LOCAL_VALUE (newval)->realvalue = SYMBOL_VALUE (variable);
1610 XBUFFER_LOCAL_VALUE (newval)->buffer = Qnil; 1604 XBUFFER_LOCAL_VALUE (newval)->buffer = Qnil;
1611 XBUFFER_LOCAL_VALUE (newval)->frame = Qnil; 1605 XBUFFER_LOCAL_VALUE (newval)->frame = Qnil;
1606 XBUFFER_LOCAL_VALUE (newval)->local_if_set = 0;
1612 XBUFFER_LOCAL_VALUE (newval)->found_for_buffer = 0; 1607 XBUFFER_LOCAL_VALUE (newval)->found_for_buffer = 0;
1613 XBUFFER_LOCAL_VALUE (newval)->found_for_frame = 0; 1608 XBUFFER_LOCAL_VALUE (newval)->found_for_frame = 0;
1614 XBUFFER_LOCAL_VALUE (newval)->check_frame = 0; 1609 XBUFFER_LOCAL_VALUE (newval)->check_frame = 0;
@@ -1681,8 +1676,7 @@ From now on the default value will apply in this buffer. Return VARIABLE. */)
1681 return variable; 1676 return variable;
1682 } 1677 }
1683 1678
1684 if (!BUFFER_LOCAL_VALUEP (valcontents) 1679 if (!BUFFER_LOCAL_VALUEP (valcontents))
1685 && !SOME_BUFFER_LOCAL_VALUEP (valcontents))
1686 return variable; 1680 return variable;
1687 1681
1688 /* Get rid of this buffer's alist element, if any. */ 1682 /* Get rid of this buffer's alist element, if any. */
@@ -1743,8 +1737,7 @@ Buffer-local bindings take precedence over frame-local bindings. */)
1743 || BUFFER_OBJFWDP (valcontents)) 1737 || BUFFER_OBJFWDP (valcontents))
1744 error ("Symbol %s may not be frame-local", SDATA (SYMBOL_NAME (variable))); 1738 error ("Symbol %s may not be frame-local", SDATA (SYMBOL_NAME (variable)));
1745 1739
1746 if (BUFFER_LOCAL_VALUEP (valcontents) 1740 if (BUFFER_LOCAL_VALUEP (valcontents))
1747 || SOME_BUFFER_LOCAL_VALUEP (valcontents))
1748 { 1741 {
1749 XBUFFER_LOCAL_VALUE (valcontents)->check_frame = 1; 1742 XBUFFER_LOCAL_VALUE (valcontents)->check_frame = 1;
1750 return variable; 1743 return variable;
@@ -1755,10 +1748,11 @@ Buffer-local bindings take precedence over frame-local bindings. */)
1755 tem = Fcons (Qnil, Fsymbol_value (variable)); 1748 tem = Fcons (Qnil, Fsymbol_value (variable));
1756 XSETCAR (tem, tem); 1749 XSETCAR (tem, tem);
1757 newval = allocate_misc (); 1750 newval = allocate_misc ();
1758 XMISCTYPE (newval) = Lisp_Misc_Some_Buffer_Local_Value; 1751 XMISCTYPE (newval) = Lisp_Misc_Buffer_Local_Value;
1759 XBUFFER_LOCAL_VALUE (newval)->realvalue = SYMBOL_VALUE (variable); 1752 XBUFFER_LOCAL_VALUE (newval)->realvalue = SYMBOL_VALUE (variable);
1760 XBUFFER_LOCAL_VALUE (newval)->buffer = Qnil; 1753 XBUFFER_LOCAL_VALUE (newval)->buffer = Qnil;
1761 XBUFFER_LOCAL_VALUE (newval)->frame = Qnil; 1754 XBUFFER_LOCAL_VALUE (newval)->frame = Qnil;
1755 XBUFFER_LOCAL_VALUE (newval)->local_if_set = 0;
1762 XBUFFER_LOCAL_VALUE (newval)->found_for_buffer = 0; 1756 XBUFFER_LOCAL_VALUE (newval)->found_for_buffer = 0;
1763 XBUFFER_LOCAL_VALUE (newval)->found_for_frame = 0; 1757 XBUFFER_LOCAL_VALUE (newval)->found_for_frame = 0;
1764 XBUFFER_LOCAL_VALUE (newval)->check_frame = 1; 1758 XBUFFER_LOCAL_VALUE (newval)->check_frame = 1;
@@ -1789,8 +1783,7 @@ BUFFER defaults to the current buffer. */)
1789 variable = indirect_variable (variable); 1783 variable = indirect_variable (variable);
1790 1784
1791 valcontents = SYMBOL_VALUE (variable); 1785 valcontents = SYMBOL_VALUE (variable);
1792 if (BUFFER_LOCAL_VALUEP (valcontents) 1786 if (BUFFER_LOCAL_VALUEP (valcontents))
1793 || SOME_BUFFER_LOCAL_VALUEP (valcontents))
1794 { 1787 {
1795 Lisp_Object tail, elt; 1788 Lisp_Object tail, elt;
1796 1789
@@ -1838,15 +1831,14 @@ BUFFER defaults to the current buffer. */)
1838 1831
1839 valcontents = SYMBOL_VALUE (variable); 1832 valcontents = SYMBOL_VALUE (variable);
1840 1833
1841 /* This means that make-variable-buffer-local was done. */
1842 if (BUFFER_LOCAL_VALUEP (valcontents))
1843 return Qt;
1844 /* All these slots become local if they are set. */
1845 if (BUFFER_OBJFWDP (valcontents)) 1834 if (BUFFER_OBJFWDP (valcontents))
1835 /* All these slots become local if they are set. */
1846 return Qt; 1836 return Qt;
1847 if (SOME_BUFFER_LOCAL_VALUEP (valcontents)) 1837 else if (BUFFER_LOCAL_VALUEP (valcontents))
1848 { 1838 {
1849 Lisp_Object tail, elt; 1839 Lisp_Object tail, elt;
1840 if (XBUFFER_LOCAL_VALUE (valcontents)->local_if_set)
1841 return Qt;
1850 for (tail = buf->local_var_alist; CONSP (tail); tail = XCDR (tail)) 1842 for (tail = buf->local_var_alist; CONSP (tail); tail = XCDR (tail))
1851 { 1843 {
1852 elt = XCAR (tail); 1844 elt = XCAR (tail);
@@ -1877,14 +1869,13 @@ If the current binding is global (the default), the value is nil. */)
1877 valcontents = XSYMBOL (variable)->value; 1869 valcontents = XSYMBOL (variable)->value;
1878 1870
1879 if (BUFFER_LOCAL_VALUEP (valcontents) 1871 if (BUFFER_LOCAL_VALUEP (valcontents)
1880 || SOME_BUFFER_LOCAL_VALUEP (valcontents)
1881 || BUFFER_OBJFWDP (valcontents)) 1872 || BUFFER_OBJFWDP (valcontents))
1882 { 1873 {
1883 /* For a local variable, record both the symbol and which 1874 /* For a local variable, record both the symbol and which
1884 buffer's or frame's value we are saving. */ 1875 buffer's or frame's value we are saving. */
1885 if (!NILP (Flocal_variable_p (variable, Qnil))) 1876 if (!NILP (Flocal_variable_p (variable, Qnil)))
1886 return Fcurrent_buffer (); 1877 return Fcurrent_buffer ();
1887 else if (!BUFFER_OBJFWDP (valcontents) 1878 else if (BUFFER_LOCAL_VALUEP (valcontents)
1888 && XBUFFER_LOCAL_VALUE (valcontents)->found_for_frame) 1879 && XBUFFER_LOCAL_VALUE (valcontents)->found_for_frame)
1889 return XBUFFER_LOCAL_VALUE (valcontents)->frame; 1880 return XBUFFER_LOCAL_VALUE (valcontents)->frame;
1890 } 1881 }