1

Does Elisp allow the equivalent of an alias for a function name?

Drew
  • 75,699
  • 9
  • 109
  • 225
Dilna
  • 1,173
  • 3
  • 10

1 Answers1

2

Yes. You can have any number of aliases for the same function.

To do that, use defalias (or fset, but defalias is generally recommended).

Example: define mop as an alias for means-of-production.

(defalias 'mop 'means-of-production)

C-h f defalias says:

defalias is a built-in function in C source code.

(defalias SYMBOL DEFINITION &optional DOCSTRING)

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.

See also the Elisp manual, node Defining Functions.

Drew
  • 75,699
  • 9
  • 109
  • 225