Commit 553defa4 authored by Richard M. Stallman's avatar Richard M. Stallman

(Fbuffer_local_variables): For local var that is unbound,

put just the symbol in the result, not a cons of (symbol . value).
parent fc53efda
......@@ -400,14 +400,15 @@ No argument or nil as argument means use the current buffer.")
DEFUN ("buffer-local-variables", Fbuffer_local_variables,
Sbuffer_local_variables, 0, 1, 0,
"Return an alist of variables that are buffer-local in BUFFER.\n\
Each element looks like (SYMBOL . VALUE) and describes one variable.\n\
Most elements look like (SYMBOL . VALUE), describing one variable.\n\
For a symbol that is locally unbound, just the symbol appears in the value.\n\
Note that storing new VALUEs in these elements doesn't change the variables.\n\
No argument or nil as argument means use current buffer as BUFFER.")
(buffer)
register Lisp_Object buffer;
{
register struct buffer *buf;
register Lisp_Object val;
register Lisp_Object result;
if (NILP (buffer))
buf = current_buffer;
......@@ -417,24 +418,35 @@ No argument or nil as argument means use current buffer as BUFFER.")
buf = XBUFFER (buffer);
}
result = Qnil;
{
/* Reference each variable in the alist in our current buffer.
If inquiring about the current buffer, this gets the current values,
so store them into the alist so the alist is up to date.
If inquiring about some other buffer, this swaps out any values
for that buffer, making the alist up to date automatically. */
register Lisp_Object tem;
for (tem = buf->local_var_alist; CONSP (tem); tem = XCONS (tem)->cdr)
register Lisp_Object tail;
for (tail = buf->local_var_alist; CONSP (tail); tail = XCONS (tail)->cdr)
{
Lisp_Object v1 = Fsymbol_value (XCONS (XCONS (tem)->car)->car);
Lisp_Object val, elt;
elt = XCONS (tail)->car;
if (buf == current_buffer)
XCONS (XCONS (tem)->car)->cdr = v1;
val = find_symbol_value (XCONS (elt)->car);
else
val = XCONS (elt)->cdr;
/* If symbol is unbound, put just the symbol in the list. */
if (EQ (val, Qunbound))
result = Fcons (XCONS (elt)->car, result);
/* Otherwise, put (symbol . value) in the list. */
else
result = Fcons (Fcons (XCONS (elt)->car, val), result);
}
}
/* Make a copy of the alist, to return it. */
val = Fcopy_alist (buf->local_var_alist);
/* Add on all the variables stored in special slots. */
{
register int offset, mask;
......@@ -447,12 +459,13 @@ No argument or nil as argument means use current buffer as BUFFER.")
if (mask == -1 || (buf->local_var_flags & mask))
if (XTYPE (*(Lisp_Object *)(offset + (char *)&buffer_local_symbols))
== Lisp_Symbol)
val = Fcons (Fcons (*(Lisp_Object *)(offset + (char *)&buffer_local_symbols),
*(Lisp_Object *)(offset + (char *)buf)),
val);
result = Fcons (Fcons (*(Lisp_Object *)(offset + (char *)&buffer_local_symbols),
*(Lisp_Object *)(offset + (char *)buf)),
result);
}
}
return (val);
return result;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment