aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Ingebrigtsen2020-12-09 14:51:48 +0100
committerLars Ingebrigtsen2020-12-09 14:52:53 +0100
commitc47e6aa1f48fc4417588cef55d96b4e9c1b3fead (patch)
tree02babb57f75e1b36bfb7edc4a2bb6fb2d9787456
parentb8dbb2bb7317da4c21b62e33329e21ec65af3755 (diff)
downloademacs-c47e6aa1f48fc4417588cef55d96b4e9c1b3fead.tar.gz
emacs-c47e6aa1f48fc4417588cef55d96b4e9c1b3fead.zip
cl-defmethod doc string clarification
* lisp/emacs-lisp/cl-generic.el (cl-defmethod): Clarify the doc string, and give an example (bug#42322).
-rw-r--r--lisp/emacs-lisp/cl-generic.el14
1 files changed, 12 insertions, 2 deletions
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."
410;;;###autoload 410;;;###autoload
411(defmacro cl-defmethod (name args &rest body) 411(defmacro cl-defmethod (name args &rest body)
412 "Define a new method for generic function NAME. 412 "Define a new method for generic function NAME.
413I.e. it defines the implementation of NAME to use for invocations where the 413This it defines an implementation of NAME to use for invocations
414values of the dispatch arguments match the specified TYPEs. 414of specific types of arguments.
415
416ARGS is a list of dispatch arguments (see `cl-defun'), but where
417each variable element is either just a single variable name VAR,
418or a list on the form (VAR TYPE).
419
420For instance:
421
422 (cl-defmethod foo (bar (format-string string) &optional zot)
423 (format format-string bar))
424
415The dispatch arguments have to be among the mandatory arguments, and 425The dispatch arguments have to be among the mandatory arguments, and
416all methods of NAME have to use the same set of arguments for dispatch. 426all methods of NAME have to use the same set of arguments for dispatch.
417Each dispatch argument and TYPE are specified in ARGS where the corresponding 427Each dispatch argument and TYPE are specified in ARGS where the corresponding