From: Lars Ingebrigtsen Date: Wed, 9 Dec 2020 13:51:48 +0000 (+0100) Subject: cl-defmethod doc string clarification X-Git-Tag: emacs-28.0.90~4824 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=c47e6aa1f48fc4417588cef55d96b4e9c1b3fead;p=emacs.git cl-defmethod doc string clarification * lisp/emacs-lisp/cl-generic.el (cl-defmethod): Clarify the doc string, and give an example (bug#42322). --- diff --git a/lisp/emacs-lisp/cl-generic.el b/lisp/emacs-lisp/cl-generic.el index 02da07daaf4..b37b05b9a3a 100644 --- a/lisp/emacs-lisp/cl-generic.el +++ b/lisp/emacs-lisp/cl-generic.el @@ -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