summaryrefslogtreecommitdiff
path: root/src/data.c
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>2007-10-19 00:00:21 +0000
committerMiles Bader <miles@gnu.org>2007-10-19 00:00:21 +0000
commit9c8020a8df03dc67a56d7df15664dcf7ace54bf0 (patch)
tree09b0646addff3c39f9e96ba89c04bdcc038a87a7 /src/data.c
parentdfc3268dfa133a2e0a677f1af7c1ee548eae065d (diff)
parentbd3164743080f3eb5fc316aca7cc5322ca58fe33 (diff)
downloademacs-9c8020a8df03dc67a56d7df15664dcf7ace54bf0.tar.gz
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,
valcontents = SYMBOL_VALUE (symbol);
- if (BUFFER_LOCAL_VALUEP (valcontents)
- || SOME_BUFFER_LOCAL_VALUEP (valcontents))
+ if (BUFFER_LOCAL_VALUEP (valcontents))
valcontents = swap_in_symval_forwarding (symbol, valcontents);
return (EQ (valcontents, Qunbound) ? Qnil : Qt);
@@ -998,8 +997,7 @@ store_symval_forwarding (symbol, valcontents, newval, buf)
default:
def:
valcontents = SYMBOL_VALUE (symbol);
- if (BUFFER_LOCAL_VALUEP (valcontents)
- || SOME_BUFFER_LOCAL_VALUEP (valcontents))
+ if (BUFFER_LOCAL_VALUEP (valcontents))
XBUFFER_LOCAL_VALUE (valcontents)->realvalue = newval;
else
SET_SYMBOL_VALUE (symbol, newval);
@@ -1016,8 +1014,7 @@ swap_in_global_binding (symbol)
Lisp_Object valcontents, cdr;
valcontents = SYMBOL_VALUE (symbol);
- if (!BUFFER_LOCAL_VALUEP (valcontents)
- && !SOME_BUFFER_LOCAL_VALUEP (valcontents))
+ if (!BUFFER_LOCAL_VALUEP (valcontents))
abort ();
cdr = XBUFFER_LOCAL_VALUE (valcontents)->cdr;
@@ -1106,8 +1103,7 @@ find_symbol_value (symbol)
CHECK_SYMBOL (symbol);
valcontents = SYMBOL_VALUE (symbol);
- if (BUFFER_LOCAL_VALUEP (valcontents)
- || SOME_BUFFER_LOCAL_VALUEP (valcontents))
+ if (BUFFER_LOCAL_VALUEP (valcontents))
valcontents = swap_in_symval_forwarding (symbol, valcontents);
if (MISCP (valcontents))
@@ -1225,8 +1221,7 @@ set_internal (symbol, newval, buf, bindflag)
&& !let_shadows_buffer_binding_p (symbol))
SET_PER_BUFFER_VALUE_P (buf, idx, 1);
}
- else if (BUFFER_LOCAL_VALUEP (valcontents)
- || SOME_BUFFER_LOCAL_VALUEP (valcontents))
+ else if (BUFFER_LOCAL_VALUEP (valcontents))
{
/* valcontents is a struct Lisp_Buffer_Local_Value. */
if (XSYMBOL (symbol)->indirect_variable)
@@ -1271,7 +1266,7 @@ set_internal (symbol, newval, buf, bindflag)
indicating that we're seeing the default value.
Likewise if the variable has been let-bound
in the current buffer. */
- if (bindflag || SOME_BUFFER_LOCAL_VALUEP (valcontents)
+ if (bindflag || !XBUFFER_LOCAL_VALUE (valcontents)->local_if_set
|| let_shadows_buffer_binding_p (symbol))
{
XBUFFER_LOCAL_VALUE (valcontents)->found_for_buffer = 0;
@@ -1299,8 +1294,7 @@ set_internal (symbol, newval, buf, bindflag)
}
/* Record which binding is now loaded. */
- XSETCAR (XBUFFER_LOCAL_VALUE (valcontents)->cdr,
- tem1);
+ XSETCAR (XBUFFER_LOCAL_VALUE (valcontents)->cdr, tem1);
/* Set `buffer' and `frame' slots for the binding now loaded. */
XSETBUFFER (XBUFFER_LOCAL_VALUE (valcontents)->buffer, buf);
@@ -1319,8 +1313,7 @@ set_internal (symbol, newval, buf, bindflag)
/* If we just set a variable whose current binding is frame-local,
store the new value in the frame parameter too. */
- if (BUFFER_LOCAL_VALUEP (valcontents)
- || SOME_BUFFER_LOCAL_VALUEP (valcontents))
+ if (BUFFER_LOCAL_VALUEP (valcontents))
{
/* What binding is loaded right now? */
current_alist_element
@@ -1362,8 +1355,7 @@ default_value (symbol)
}
/* Handle user-created local variables. */
- if (BUFFER_LOCAL_VALUEP (valcontents)
- || SOME_BUFFER_LOCAL_VALUEP (valcontents))
+ if (BUFFER_LOCAL_VALUEP (valcontents))
{
/* If var is set up for a buffer that lacks a local value for it,
the current value is nominally the default value.
@@ -1447,8 +1439,7 @@ for this variable. */)
return value;
}
- if (!BUFFER_LOCAL_VALUEP (valcontents)
- && !SOME_BUFFER_LOCAL_VALUEP (valcontents))
+ if (!BUFFER_LOCAL_VALUEP (valcontents))
return Fset (symbol, value);
/* 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.
if (EQ (variable, Qnil) || EQ (variable, Qt) || KBOARD_OBJFWDP (valcontents))
error ("Symbol %s may not be buffer-local", SDATA (SYMBOL_NAME (variable)));
- if (BUFFER_LOCAL_VALUEP (valcontents) || BUFFER_OBJFWDP (valcontents))
+ if (BUFFER_OBJFWDP (valcontents))
return variable;
- if (SOME_BUFFER_LOCAL_VALUEP (valcontents))
+ else if (BUFFER_LOCAL_VALUEP (valcontents))
+ newval = valcontents;
+ else
{
- XMISCTYPE (SYMBOL_VALUE (variable)) = Lisp_Misc_Buffer_Local_Value;
- return variable;
+ if (EQ (valcontents, Qunbound))
+ SET_SYMBOL_VALUE (variable, Qnil);
+ tem = Fcons (Qnil, Fsymbol_value (variable));
+ XSETCAR (tem, tem);
+ newval = allocate_misc ();
+ XMISCTYPE (newval) = Lisp_Misc_Buffer_Local_Value;
+ XBUFFER_LOCAL_VALUE (newval)->realvalue = SYMBOL_VALUE (variable);
+ XBUFFER_LOCAL_VALUE (newval)->buffer = Fcurrent_buffer ();
+ XBUFFER_LOCAL_VALUE (newval)->frame = Qnil;
+ XBUFFER_LOCAL_VALUE (newval)->found_for_buffer = 0;
+ XBUFFER_LOCAL_VALUE (newval)->found_for_frame = 0;
+ XBUFFER_LOCAL_VALUE (newval)->check_frame = 0;
+ XBUFFER_LOCAL_VALUE (newval)->cdr = tem;
+ SET_SYMBOL_VALUE (variable, newval);
}
- if (EQ (valcontents, Qunbound))
- SET_SYMBOL_VALUE (variable, Qnil);
- tem = Fcons (Qnil, Fsymbol_value (variable));
- XSETCAR (tem, tem);
- newval = allocate_misc ();
- XMISCTYPE (newval) = Lisp_Misc_Buffer_Local_Value;
- XBUFFER_LOCAL_VALUE (newval)->realvalue = SYMBOL_VALUE (variable);
- XBUFFER_LOCAL_VALUE (newval)->buffer = Fcurrent_buffer ();
- XBUFFER_LOCAL_VALUE (newval)->frame = Qnil;
- XBUFFER_LOCAL_VALUE (newval)->found_for_buffer = 0;
- XBUFFER_LOCAL_VALUE (newval)->found_for_frame = 0;
- XBUFFER_LOCAL_VALUE (newval)->check_frame = 0;
- XBUFFER_LOCAL_VALUE (newval)->cdr = tem;
- SET_SYMBOL_VALUE (variable, newval);
+ XBUFFER_LOCAL_VALUE (newval)->local_if_set = 1;
return variable;
}
@@ -1589,7 +1581,9 @@ Instead, use `add-hook' and specify t for the LOCAL argument. */)
if (EQ (variable, Qnil) || EQ (variable, Qt) || KBOARD_OBJFWDP (valcontents))
error ("Symbol %s may not be buffer-local", SDATA (SYMBOL_NAME (variable)));
- if (BUFFER_LOCAL_VALUEP (valcontents) || BUFFER_OBJFWDP (valcontents))
+ if ((BUFFER_LOCAL_VALUEP (valcontents)
+ && XBUFFER_LOCAL_VALUE (valcontents)->local_if_set)
+ || BUFFER_OBJFWDP (valcontents))
{
tem = Fboundp (variable);
@@ -1599,16 +1593,17 @@ Instead, use `add-hook' and specify t for the LOCAL argument. */)
return variable;
}
/* Make sure symbol is set up to hold per-buffer values. */
- if (!SOME_BUFFER_LOCAL_VALUEP (valcontents))
+ if (!BUFFER_LOCAL_VALUEP (valcontents))
{
Lisp_Object newval;
tem = Fcons (Qnil, do_symval_forwarding (valcontents));
XSETCAR (tem, tem);
newval = allocate_misc ();
- XMISCTYPE (newval) = Lisp_Misc_Some_Buffer_Local_Value;
+ XMISCTYPE (newval) = Lisp_Misc_Buffer_Local_Value;
XBUFFER_LOCAL_VALUE (newval)->realvalue = SYMBOL_VALUE (variable);
XBUFFER_LOCAL_VALUE (newval)->buffer = Qnil;
XBUFFER_LOCAL_VALUE (newval)->frame = Qnil;
+ XBUFFER_LOCAL_VALUE (newval)->local_if_set = 0;
XBUFFER_LOCAL_VALUE (newval)->found_for_buffer = 0;
XBUFFER_LOCAL_VALUE (newval)->found_for_frame = 0;
XBUFFER_LOCAL_VALUE (newval)->check_frame = 0;
@@ -1681,8 +1676,7 @@ From now on the default value will apply in this buffer. Return VARIABLE. */)
return variable;
}
- if (!BUFFER_LOCAL_VALUEP (valcontents)
- && !SOME_BUFFER_LOCAL_VALUEP (valcontents))
+ if (!BUFFER_LOCAL_VALUEP (valcontents))
return variable;
/* Get rid of this buffer's alist element, if any. */
@@ -1743,8 +1737,7 @@ Buffer-local bindings take precedence over frame-local bindings. */)
|| BUFFER_OBJFWDP (valcontents))
error ("Symbol %s may not be frame-local", SDATA (SYMBOL_NAME (variable)));
- if (BUFFER_LOCAL_VALUEP (valcontents)
- || SOME_BUFFER_LOCAL_VALUEP (valcontents))
+ if (BUFFER_LOCAL_VALUEP (valcontents))
{
XBUFFER_LOCAL_VALUE (valcontents)->check_frame = 1;
return variable;
@@ -1755,10 +1748,11 @@ Buffer-local bindings take precedence over frame-local bindings. */)
tem = Fcons (Qnil, Fsymbol_value (variable));
XSETCAR (tem, tem);
newval = allocate_misc ();
- XMISCTYPE (newval) = Lisp_Misc_Some_Buffer_Local_Value;
+ XMISCTYPE (newval) = Lisp_Misc_Buffer_Local_Value;
XBUFFER_LOCAL_VALUE (newval)->realvalue = SYMBOL_VALUE (variable);
XBUFFER_LOCAL_VALUE (newval)->buffer = Qnil;
XBUFFER_LOCAL_VALUE (newval)->frame = Qnil;
+ XBUFFER_LOCAL_VALUE (newval)->local_if_set = 0;
XBUFFER_LOCAL_VALUE (newval)->found_for_buffer = 0;
XBUFFER_LOCAL_VALUE (newval)->found_for_frame = 0;
XBUFFER_LOCAL_VALUE (newval)->check_frame = 1;
@@ -1789,8 +1783,7 @@ BUFFER defaults to the current buffer. */)
variable = indirect_variable (variable);
valcontents = SYMBOL_VALUE (variable);
- if (BUFFER_LOCAL_VALUEP (valcontents)
- || SOME_BUFFER_LOCAL_VALUEP (valcontents))
+ if (BUFFER_LOCAL_VALUEP (valcontents))
{
Lisp_Object tail, elt;
@@ -1838,15 +1831,14 @@ BUFFER defaults to the current buffer. */)
valcontents = SYMBOL_VALUE (variable);
- /* This means that make-variable-buffer-local was done. */
- if (BUFFER_LOCAL_VALUEP (valcontents))
- return Qt;
- /* All these slots become local if they are set. */
if (BUFFER_OBJFWDP (valcontents))
+ /* All these slots become local if they are set. */
return Qt;
- if (SOME_BUFFER_LOCAL_VALUEP (valcontents))
+ else if (BUFFER_LOCAL_VALUEP (valcontents))
{
Lisp_Object tail, elt;
+ if (XBUFFER_LOCAL_VALUE (valcontents)->local_if_set)
+ return Qt;
for (tail = buf->local_var_alist; CONSP (tail); tail = XCDR (tail))
{
elt = XCAR (tail);
@@ -1877,14 +1869,13 @@ If the current binding is global (the default), the value is nil. */)
valcontents = XSYMBOL (variable)->value;
if (BUFFER_LOCAL_VALUEP (valcontents)
- || SOME_BUFFER_LOCAL_VALUEP (valcontents)
|| BUFFER_OBJFWDP (valcontents))
{
/* For a local variable, record both the symbol and which
buffer's or frame's value we are saving. */
if (!NILP (Flocal_variable_p (variable, Qnil)))
return Fcurrent_buffer ();
- else if (!BUFFER_OBJFWDP (valcontents)
+ else if (BUFFER_LOCAL_VALUEP (valcontents)
&& XBUFFER_LOCAL_VALUE (valcontents)->found_for_frame)
return XBUFFER_LOCAL_VALUE (valcontents)->frame;
}