Next: Declaring Functions, Previous: Inline Functions, Up: Functions
declare Form
declare is a special macro which can be used to add “meta”
properties to a function or macro: for example, marking it as
obsolete, or giving its forms a special <TAB> indentation
convention in Emacs Lisp mode.
This macro ignores its arguments and evaluates to
nil; it has no run-time effect. However, when adeclareform occurs in the declare argument of adefunordefsubstfunction definition (see Defining Functions) or adefmacromacro definition (see Defining Macros), it appends the properties specified by specs to the function or macro. This work is specially performed bydefun,defsubst, anddefmacro.Each element in specs should have the form
(property args...), which should not be quoted. These have the following effects:
(advertised-calling-conventionsignature when)- This acts like a call to
set-advertised-calling-convention(see Obsolete Functions); signature specifies the correct argument list for calling the function or macro, and when should be a string indicating when the variable was first made obsolete.(debugedebug-form-spec)- This is valid for macros only. When stepping through the macro with Edebug, use edebug-form-spec. See Instrumenting Macro Calls.
(doc-stringn)- Use element number n, if any, as the documentation string.
(indentindent-spec)- Indent calls to this function or macro according to indent-spec. This is typically used for macros, though it works for functions too. See Indenting Macros.
(obsoletecurrent-name when)- Mark the function or macro as obsolete, similar to a call to
make-obsolete(see Obsolete Functions). current-name should be a symbol (in which case the warning message says to use that instead), a string (specifying the warning message), ornil(in which case the warning message gives no extra details). when should be a string indicating when the function or macro was first made obsolete.