Function: fset

fset is a function defined in data.c.

Signature

(fset SYMBOL DEFINITION)

Documentation

Set SYMBOL's function definition to DEFINITION, and return DEFINITION.

View in manual

Probably introduced at or before Emacs version 24.4.

Source Code

// Defined in /usr/src/emacs/src/data.c
{
  CHECK_SYMBOL (symbol);
  /* Perhaps not quite the right error signal, but seems good enough.  */
  if (NILP (symbol) && !NILP (definition))
    /* There are so many other ways to shoot oneself in the foot, I don't
       think this one little sanity check is worth its cost, but anyway.  */
    xsignal1 (Qsetting_constant, symbol);

  eassert (valid_lisp_object_p (definition));

#ifdef HAVE_NATIVE_COMP
  register Lisp_Object function = XSYMBOL (symbol)->u.s.function;

  if (!NILP (Vnative_comp_enable_subr_trampolines)
      && SUBRP (function)
      && !SUBR_NATIVE_COMPILEDP (function))
    CALLN (Ffuncall, Qcomp_subr_trampoline_install, symbol);
#endif

  set_symbol_function (symbol, definition);

  return definition;
}