set_symbol_plist (val, Qnil);
p->redirect = SYMBOL_PLAINVAL;
SET_SYMBOL_VAL (p, Qunbound);
- set_symbol_function (val, Qnil);
+ scm_module_define (function_module, val, Qnil);
p->interned = SYMBOL_UNINTERNED;
p->constant = 0;
p->declared_special = false;
and the hook has a non-nil `no-self-insert' property,
return right away--don't really self-insert. */
if (SYMBOLP (sym) && ! NILP (sym)
- && ! NILP (XSYMBOL (sym)->function)
- && SYMBOLP (XSYMBOL (sym)->function))
+ && ! NILP (SYMBOL_FUNCTION (sym))
+ && SYMBOLP (SYMBOL_FUNCTION (sym)))
{
Lisp_Object prop;
- prop = Fget (XSYMBOL (sym)->function, intern ("no-self-insert"));
+ prop = Fget (SYMBOL_FUNCTION (sym), intern ("no-self-insert"));
if (! NILP (prop))
return 1;
}
(register Lisp_Object symbol)
{
CHECK_SYMBOL (symbol);
- return NILP (XSYMBOL (symbol)->function) ? Qnil : Qt;
+ return NILP (SYMBOL_FUNCTION (symbol)) ? Qnil : Qt;
}
DEFUN ("makunbound", Fmakunbound, Smakunbound, 1, 1, 0,
(register Lisp_Object symbol)
{
CHECK_SYMBOL (symbol);
- return XSYMBOL (symbol)->function;
+ return SYMBOL_FUNCTION (symbol);
}
DEFUN ("symbol-plist", Fsymbol_plist, Ssymbol_plist, 1, 1, 0,
register Lisp_Object function;
CHECK_SYMBOL (symbol);
- function = XSYMBOL (symbol)->function;
+ function = SYMBOL_FUNCTION (symbol);
if (!NILP (Vautoload_queue) && !NILP (function))
Vautoload_queue = Fcons (Fcons (symbol, function), Vautoload_queue);
{ /* Only add autoload entries after dumping, because the ones before are
not useful and else we get loads of them from the loaddefs.el. */
- if (AUTOLOADP (XSYMBOL (symbol)->function))
+ if (AUTOLOADP (SYMBOL_FUNCTION (symbol)))
/* Remember that the function was already an autoload. */
LOADHIST_ATTACH (Fcons (Qt, symbol));
LOADHIST_ATTACH (Fcons (autoload ? Qautoload : Qdefun, symbol));
{
if (!SYMBOLP (hare) || NILP (hare))
break;
- hare = XSYMBOL (hare)->function;
+ hare = SYMBOL_FUNCTION (hare);
if (!SYMBOLP (hare) || NILP (hare))
break;
- hare = XSYMBOL (hare)->function;
+ hare = SYMBOL_FUNCTION (hare);
- tortoise = XSYMBOL (tortoise)->function;
+ tortoise = SYMBOL_FUNCTION (tortoise);
if (EQ (hare, tortoise))
xsignal1 (Qcyclic_function_indirection, object);
/* Optimize for no indirection. */
result = object;
if (SYMBOLP (result) && !NILP (result)
- && (result = XSYMBOL (result)->function, SYMBOLP (result)))
+ && (result = SYMBOL_FUNCTION (result), SYMBOLP (result)))
result = indirect_function (result);
if (!NILP (result))
return result;
DEFSYM (Qinteractive_form, "interactive-form");
DEFSYM (Qdefalias_fset_function, "defalias-fset-function");
- set_symbol_function (Qwholenump, XSYMBOL (Qnatnump)->function);
+ set_symbol_function (Qwholenump, SYMBOL_FUNCTION (Qnatnump));
DEFVAR_LISP ("most-positive-fixnum", Vmost_positive_fixnum,
doc: /* The largest value that is representable in a Lisp integer. */);
{
/* Don't use indirect_function here, or defaliases will apply their
docstrings to the base functions (Bug#2603). */
- Lisp_Object fun = SYMBOLP (obj) ? XSYMBOL (obj)->function : obj;
+ Lisp_Object fun = SYMBOLP (obj) ? SYMBOL_FUNCTION (obj) : obj;
/* The type determines where the docstring is stored. */
#endif
Lisp_Object symbol_module;
+Lisp_Object function_module;
static const char emacs_version[] = PACKAGE_VERSION;
static const char emacs_copyright[] = COPYRIGHT;
scm_from_locale_keyword ("pure"),
SCM_BOOL_T,
SCM_UNDEFINED);
+ function_module = scm_call (scm_c_public_ref ("guile", "define-module*"),
+ scm_list_1 (scm_from_utf8_symbol ("elisp-functions")),
+ scm_from_locale_keyword ("pure"),
+ SCM_BOOL_T,
+ SCM_UNDEFINED);
init_alloc_once ();
init_guile ();
init_fns_once ();
tem = Fassq (sym, environment);
if (NILP (tem))
{
- def = XSYMBOL (sym)->function;
+ def = SYMBOL_FUNCTION (sym);
if (!NILP (def))
continue;
}
CHECK_STRING (file);
/* If function is defined and not as an autoload, don't override. */
- if (!NILP (XSYMBOL (function)->function)
- && !AUTOLOADP (XSYMBOL (function)->function))
+ if (!NILP (SYMBOL_FUNCTION (function))
+ && !AUTOLOADP (SYMBOL_FUNCTION (function)))
return Qnil;
return Fdefalias (function,
fun = original_fun;
if (!SYMBOLP (fun))
fun = Ffunction (Fcons (fun, Qnil));
- else if (!NILP (fun) && (fun = XSYMBOL (fun)->function, SYMBOLP (fun)))
+ else if (!NILP (fun) && (fun = SYMBOL_FUNCTION (fun), SYMBOLP (fun)))
fun = indirect_function (fun);
if (SUBRP (fun))
/* Optimize for no indirection. */
if (SYMBOLP (fun) && !NILP (fun)
- && (fun = XSYMBOL (fun)->function, SYMBOLP (fun)))
+ && (fun = SYMBOL_FUNCTION (fun), SYMBOLP (fun)))
fun = indirect_function (fun);
if (NILP (fun))
{
/* Optimize for no indirection. */
fun = original_fun;
if (SYMBOLP (fun) && !NILP (fun)
- && (fun = XSYMBOL (fun)->function, SYMBOLP (fun)))
+ && (fun = SYMBOL_FUNCTION (fun), SYMBOLP (fun)))
fun = indirect_function (fun);
if (SUBRP (fun))
(such as lmenu.el set it up), check if the
original command matches the cached command. */
&& !(SYMBOLP (def)
- && EQ (tem, XSYMBOL (def)->function))))
+ && EQ (tem, SYMBOL_FUNCTION (def)))))
keys = Qnil;
}
/* Handle a symbol whose function definition is a keymap
or an array. */
if (SYMBOLP (next) && !NILP (Ffboundp (next))
- && (ARRAYP (XSYMBOL (next)->function)
- || KEYMAPP (XSYMBOL (next)->function)))
- next = Fautoload_do_load (XSYMBOL (next)->function, next, Qnil);
+ && (ARRAYP (SYMBOL_FUNCTION (next))
+ || KEYMAPP (SYMBOL_FUNCTION (next))))
+ next = Fautoload_do_load (SYMBOL_FUNCTION (next),
+ next, Qnil);
/* If the keymap gives a function, not an
array, then call the function with one arg and use
extern void initialize_symbol (Lisp_Object, Lisp_Object);
INLINE Lisp_Object build_string (const char *);
extern Lisp_Object symbol_module;
+extern Lisp_Object function_module;
INLINE struct Lisp_Symbol *
XSYMBOL (Lisp_Object a)
union Lisp_Fwd *fwd;
} val;
- /* Function value of the symbol or Qnil if not fboundp. */
- Lisp_Object function;
-
/* The symbol's property list. */
Lisp_Object plist;
};
return XSYMBOL (sym)->interned == SYMBOL_INTERNED_IN_INITIAL_OBARRAY;
}
+INLINE Lisp_Object
+SYMBOL_FUNCTION (Lisp_Object sym)
+{
+ return scm_variable_ref (scm_module_lookup (function_module, sym));
+}
+
/* Value is non-zero if symbol is considered a constant, i.e. its
value cannot be changed (there is an exception for keyword symbols,
whose value can be set to the keyword symbol itself). */
INLINE void
set_symbol_function (Lisp_Object sym, Lisp_Object function)
{
- XSYMBOL (sym)->function = function;
+ scm_variable_set_x (scm_module_lookup (function_module, sym), function);
}
INLINE void
{
terminal->kboard = allocate_kboard (Qx);
- if (!EQ (XSYMBOL (Qvendor_specific_keysyms)->function, Qunbound))
+ if (!EQ (SYMBOL_FUNCTION (Qvendor_specific_keysyms), Qunbound))
{
char *vendor = ServerVendor (dpy);