2

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

1 Answer 1

3

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.