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 a
declare form occurs in the
declare argument of a
definition (see Defining Functions) or a
definition (see Defining Macros), it appends the properties
specified by specs to the function or macro. This work is
specially performed by
Each element in specs should have the form
args…), which should not be quoted. These have the
(advertised-calling-convention signature when)
This acts like a call to
(see Declaring Functions Obsolete); signature specifies the correct
argument list for calling the function or macro, and when should
be a string indicating when the old argument list was first made obsolete.
This is valid for macros only. When stepping through the macro with Edebug, use edebug-form-spec. See Instrumenting Macro Calls.
This is used when defining a function or macro which itself will be used to define entities like functions, macros, or variables. It indicates that the nth argument, if any, should be considered as a documentation string.
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.
Set the function’s
interactive-only property to value.
See The interactive-only property.
(obsolete current-name when)
Mark the function or macro as obsolete, similar to a call to
make-obsolete (see Declaring Functions Obsolete). current-name
should be a symbol (in which case the warning message says to use that
instead), a string (specifying the warning message), or
which case the warning message gives no extra details). when
should be a string indicating when the function or macro was first
This can only be used for functions, and tells the compiler to use
expander as an optimization function. When encountering a call to the
function, of the form
(function args…), the macro
expander will call expander with that form as well as with
args…, and expander can either return a new expression to use
instead of the function call, or it can return just the form unchanged,
to indicate that the function call should be left alone. expander can
be a symbol, or it can be a form
(lambda (arg) body) in
which case arg will hold the original function call expression, and the
(unevaluated) arguments to the function can be accessed using the function’s
Declare expander to be the function to handle calls to the macro (or
function) as a generalized variable, similarly to
expander can be a symbol or it can be of the form
(arg) body) in which case that function will additionally have
access to the macro (or function)’s arguments.
Declare setter to be the function to handle calls to the macro (or
function) as a generalized variable. setter can be a symbol in which
case it will be passed to
gv-define-simple-setter, or it can be of the
(lambda (arg) body) in which case that function will
additionally have access to the macro (or function)’s arguments and it will
be passed to
Declare completion-predicate as a function to determine whether to include the symbol in the list of functions when asking for completions in M-x. completion-predicate is called with two parameters: The first parameter is the symbol, and the second is the current buffer.
Specify that this command is meant to be applicable for modes only.