[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/src/data.c
From: |
Richard M. Stallman |
Subject: |
[Emacs-diffs] Changes to emacs/src/data.c |
Date: |
Fri, 19 Sep 2003 10:34:30 -0400 |
Index: emacs/src/data.c
diff -c emacs/src/data.c:1.226 emacs/src/data.c:1.227
*** emacs/src/data.c:1.226 Mon Sep 1 11:45:52 2003
--- emacs/src/data.c Fri Sep 19 10:34:30 2003
***************
*** 1706,1712 ****
{
Lisp_Object tail, elt;
- variable = indirect_variable (variable);
for (tail = buf->local_var_alist; CONSP (tail); tail = XCDR (tail))
{
elt = XCAR (tail);
--- 1706,1711 ----
***************
*** 1765,1770 ****
--- 1764,1804 ----
}
return Qnil;
}
+
+ DEFUN ("variable-binding-locus", Fvariable_binding_locus,
Svariable_binding_locus,
+ 1, 1, 0,
+ doc: /* Return a value indicating where VARIABLE's current binding
comes from.
+ If the current binding is buffer-local, the value is the current buffer.
+ If the current binding is frame-local, the value is the selected frame.
+ If the current binding is global (the default), the value is nil. */)
+ (variable)
+ register Lisp_Object variable;
+ {
+ Lisp_Object valcontents;
+
+ CHECK_SYMBOL (variable);
+ variable = indirect_variable (variable);
+
+ /* Make sure the current binding is actually swapped in. */
+ find_symbol_value (variable);
+
+ 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)
+ && XBUFFER_LOCAL_VALUE (valcontents)->found_for_frame)
+ return XBUFFER_LOCAL_VALUE (valcontents)->frame;
+ }
+
+ return Qnil;
+ }
/* Find the function at the end of a chain of symbol function indirections.
*/
***************
*** 3185,3190 ****
--- 3219,3225 ----
defsubr (&Smake_variable_frame_local);
defsubr (&Slocal_variable_p);
defsubr (&Slocal_variable_if_set_p);
+ defsubr (&Svariable_binding_locus);
defsubr (&Saref);
defsubr (&Saset);
defsubr (&Snumber_to_string);