comparison src/symbols.c @ 1674:7670d88516af

[xemacs-hg @ 2003-09-10 08:40:30 by michaels] 2003-09-08 Mike Sperber <mike@xemacs.org> * symbols.c (Fvariable_binding_locus): Add, as per suggestion from RMS at: http://article.gmane.org/gmane.emacs.pretest.bugs/1010
author michaels
date Wed, 10 Sep 2003 08:40:41 +0000
parents e22b0213b713
children 04bc9d2f42c7
comparison
equal deleted inserted replaced
1673:9f8a8fc32b1b 1674:7670d88516af
3209 handler_type_from_function_symbol (follow_past_lisp_magic, 0); 3209 handler_type_from_function_symbol (follow_past_lisp_magic, 0);
3210 } 3210 }
3211 return follow_varalias_pointers (object, follow_past_lisp_magic); 3211 return follow_varalias_pointers (object, follow_past_lisp_magic);
3212 } 3212 }
3213 3213
3214 DEFUN ("variable-binding-locus", Fvariable_binding_locus, 1, 1, 0, /*
3215 Return a value indicating where VARIABLE's current binding comes from.
3216 If the current binding is buffer-local, the value is the current buffer.
3217 If the current binding is global (the default), the value is nil.
3218 */
3219 (variable))
3220 {
3221 Lisp_Object valcontents;
3222
3223 CHECK_SYMBOL (variable);
3224 variable = Findirect_variable (variable, Qnil);
3225
3226 /* Make sure the current binding is actually swapped in. */
3227 find_symbol_value (variable);
3228
3229 valcontents = XSYMBOL (variable)->value;
3230
3231 if (SYMBOL_VALUE_MAGIC_P (valcontents)
3232 && ((XSYMBOL_VALUE_MAGIC_TYPE (valcontents) == SYMVAL_BUFFER_LOCAL)
3233 || (XSYMBOL_VALUE_MAGIC_TYPE (valcontents) == SYMVAL_SOME_BUFFER_LOCAL))
3234 && (!NILP (Flocal_variable_p (variable, Fcurrent_buffer (), Qnil))))
3235 return Fcurrent_buffer ();
3236 else
3237 return Qnil;
3238 }
3214 3239
3215 /************************************************************************/ 3240 /************************************************************************/
3216 /* initialization */ 3241 /* initialization */
3217 /************************************************************************/ 3242 /************************************************************************/
3218 3243
3595 DEFSYMBOL (Qkill_local_variable); 3620 DEFSYMBOL (Qkill_local_variable);
3596 DEFSYMBOL (Qkill_console_local_variable); 3621 DEFSYMBOL (Qkill_console_local_variable);
3597 DEFSYMBOL (Qsymbol_value_in_buffer); 3622 DEFSYMBOL (Qsymbol_value_in_buffer);
3598 DEFSYMBOL (Qsymbol_value_in_console); 3623 DEFSYMBOL (Qsymbol_value_in_console);
3599 DEFSYMBOL (Qlocal_variable_p); 3624 DEFSYMBOL (Qlocal_variable_p);
3600
3601 DEFSYMBOL (Qconst_integer); 3625 DEFSYMBOL (Qconst_integer);
3602 DEFSYMBOL (Qconst_boolean); 3626 DEFSYMBOL (Qconst_boolean);
3603 DEFSYMBOL (Qconst_object); 3627 DEFSYMBOL (Qconst_object);
3604 DEFSYMBOL (Qconst_specifier); 3628 DEFSYMBOL (Qconst_specifier);
3605 DEFSYMBOL (Qdefault_buffer); 3629 DEFSYMBOL (Qdefault_buffer);
3642 DEFSUBR (Fkill_console_local_variable); 3666 DEFSUBR (Fkill_console_local_variable);
3643 DEFSUBR (Flocal_variable_p); 3667 DEFSUBR (Flocal_variable_p);
3644 DEFSUBR (Fdefvaralias); 3668 DEFSUBR (Fdefvaralias);
3645 DEFSUBR (Fvariable_alias); 3669 DEFSUBR (Fvariable_alias);
3646 DEFSUBR (Findirect_variable); 3670 DEFSUBR (Findirect_variable);
3671 DEFSUBR (Fvariable_binding_locus);
3647 DEFSUBR (Fdontusethis_set_symbol_value_handler); 3672 DEFSUBR (Fdontusethis_set_symbol_value_handler);
3648 } 3673 }
3649 3674
3650 /* Create and initialize a Lisp variable whose value is forwarded to C data */ 3675 /* Create and initialize a Lisp variable whose value is forwarded to C data */
3651 void 3676 void