Function: defalias

defalias is a function defined in data.c.

Signature

(defalias SYMBOL DEFINITION &optional DOCSTRING)

Documentation

Set SYMBOL's function definition to DEFINITION.

Associates the function with the current load file, if any. The optional third argument DOCSTRING specifies the documentation string for SYMBOL; if it is omitted or nil, SYMBOL uses the documentation string determined by DEFINITION.

Internally, this normally uses fset, but if SYMBOL has a defalias-fset-function property, the associated value is used instead.

The return value is undefined.

View in manual

Probably introduced at or before Emacs version 22.1.

Source Code

// Defined in /usr/src/emacs/src/data.c
{
  CHECK_SYMBOL (symbol);
  if (!NILP (Vpurify_flag)
      /* If `definition' is a keymap, immutable (and copying) is wrong.  */
      && !KEYMAPP (definition))
    definition = Fpurecopy (definition);

  defalias (symbol, definition);

  maybe_defer_native_compilation (symbol, definition);

  if (!NILP (docstring))
    Fput (symbol, Qfunction_documentation, docstring);
  /* We used to return `definition', but now that `defun' and `defmacro' expand
     to a call to `defalias', we return `symbol' for backward compatibility
     (bug#11686).  */
  return symbol;
}