Does Elisp allow the equivalent of an alias for a function name?
1 Answers
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:
defaliasis a built-in function inC source code.(defalias SYMBOL DEFINITION &optional DOCSTRING)
Set
SYMBOL's function definition toDEFINITION.Associates the function with the current load file, if any.
The optional third argument
DOCSTRINGspecifies the documentation string forSYMBOL; if it is omitted ornil,SYMBOLuses the documentation string determined byDEFINITION.Internally, this normally uses
fset, but ifSYMBOLhas adefalias-fset-functionproperty, the associated value is used instead.The return value is undefined.
See also the Elisp manual, node Defining Functions.
- 75,699
- 9
- 109
- 225