diff options
| author | Lars Ingebrigtsen | 2020-12-09 14:51:48 +0100 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2020-12-09 14:52:53 +0100 |
| commit | c47e6aa1f48fc4417588cef55d96b4e9c1b3fead (patch) | |
| tree | 02babb57f75e1b36bfb7edc4a2bb6fb2d9787456 | |
| parent | b8dbb2bb7317da4c21b62e33329e21ec65af3755 (diff) | |
| download | emacs-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.el | 14 |
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. |
| 413 | I.e. it defines the implementation of NAME to use for invocations where the | 413 | This it defines an implementation of NAME to use for invocations |
| 414 | values of the dispatch arguments match the specified TYPEs. | 414 | of specific types of arguments. |
| 415 | |||
| 416 | ARGS is a list of dispatch arguments (see `cl-defun'), but where | ||
| 417 | each variable element is either just a single variable name VAR, | ||
| 418 | or a list on the form (VAR TYPE). | ||
| 419 | |||
| 420 | For instance: | ||
| 421 | |||
| 422 | (cl-defmethod foo (bar (format-string string) &optional zot) | ||
| 423 | (format format-string bar)) | ||
| 424 | |||
| 415 | The dispatch arguments have to be among the mandatory arguments, and | 425 | The dispatch arguments have to be among the mandatory arguments, and |
| 416 | all methods of NAME have to use the same set of arguments for dispatch. | 426 | all methods of NAME have to use the same set of arguments for dispatch. |
| 417 | Each dispatch argument and TYPE are specified in ARGS where the corresponding | 427 | Each dispatch argument and TYPE are specified in ARGS where the corresponding |