Function: defgeneric

defgeneric is a macro defined in eieio-compat.el.gz.

This macro is obsolete since 25.1; use cl-defgeneric instead.

Signature

(defgeneric METHOD ARGS &optional DOC-STRING)

Documentation

Create a generic function METHOD.

DOC-STRING is the base documentation for this class. A generic function has no body, as its purpose is to decide which method body is appropriate to use. Uses defmethod to create methods, and calls defgeneric for you. With this implementation the ARGS are currently ignored. You can use defgeneric to apply specialized top level documentation to a method.

Probably introduced at or before Emacs version 29.1.

Source Code

;; Defined in /usr/src/emacs/lisp/obsolete/eieio-compat.el.gz
;;;###autoload
(defmacro defgeneric (method args &optional doc-string)
  "Create a generic function METHOD.
DOC-STRING is the base documentation for this class.  A generic
function has no body, as its purpose is to decide which method body
is appropriate to use.  Uses `defmethod' to create methods, and calls
`defgeneric' for you.  With this implementation the ARGS are
currently ignored.  You can use `defgeneric' to apply specialized
top level documentation to a method."
  (declare (doc-string 3) (obsolete cl-defgeneric "25.1")
           (indent defun))
  `(eieio--defalias ',method
                    (eieio--defgeneric-init-form
                     ',method
                     ,(if doc-string (help-add-fundoc-usage doc-string args)))))