1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-03 08:30:09 +00:00

cl-defmethod doc string clarification

* lisp/emacs-lisp/cl-generic.el (cl-defmethod): Clarify the doc
string, and give an example (bug#42322).
This commit is contained in:
Lars Ingebrigtsen 2020-12-09 14:51:48 +01:00
parent b8dbb2bb73
commit c47e6aa1f4

View File

@ -410,8 +410,18 @@ the specializer used will be the one returned by BODY."
;;;###autoload
(defmacro cl-defmethod (name args &rest body)
"Define a new method for generic function NAME.
I.e. it defines the implementation of NAME to use for invocations where the
values of the dispatch arguments match the specified TYPEs.
This it defines an implementation of NAME to use for invocations
of specific types of arguments.
ARGS is a list of dispatch arguments (see `cl-defun'), but where
each variable element is either just a single variable name VAR,
or a list on the form (VAR TYPE).
For instance:
(cl-defmethod foo (bar (format-string string) &optional zot)
(format format-string bar))
The dispatch arguments have to be among the mandatory arguments, and
all methods of NAME have to use the same set of arguments for dispatch.
Each dispatch argument and TYPE are specified in ARGS where the corresponding