Skip to content

Commit

Permalink
epkg-type: fix documentation
Browse files Browse the repository at this point in the history
Improving the doc-string involves explicitly defining it
as a generic function.
  • Loading branch information
tarsius committed Feb 5, 2017
1 parent 06f8b05 commit 80ad642
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 16 deletions.
15 changes: 11 additions & 4 deletions epkg.el
Original file line number Diff line number Diff line change
Expand Up @@ -385,12 +385,19 @@ is an optional dependency.
:order-by [(asc package) (asc feature)]]
(vconcat (epkg-provided package))))))

(cl-defmethod epkg-type ((pkg epkg-package))
"Return the type of the Epkg object PKG."
(cl-defgeneric epkg-type (ARG)
"Return the type of the object or class ARG.
ARG has to be the class `epkg-package', a subclass of that, an
`epkg-package' object, or an object of a subclass. The type
represents the class and is used in the user interface, where
it would be inconvenient to instead use the actual class name,
because the latter is longer and an implementation detail.")

(cl-defmethod epkg-type ((pkg epkg-package))
(epkg-type (eieio-object-class pkg)))

(cl-defmethod epkg-type ((class (subclass epkg-package)))
"Return a short representation of CLASS."
(cl-defmethod epkg-type ((class (subclass epkg-package)))
(if (eq class 'epkg-package)
'all
(setq class (symbol-name class))
Expand Down
13 changes: 7 additions & 6 deletions epkg.org
Original file line number Diff line number Diff line change
Expand Up @@ -478,14 +478,15 @@ functions return these values in a form that is generally more useful.
that it is a mandatory dependency; if a string is used, then it
is an optional dependency.

- Function: epkg-type pkg
- Function: epkg-type arg

This function returns the type of the ~epkg-package~ object PKG.
This function returns the type of the object or class ARG.

A package's type is a short representation of its class, as in
~epkg-TYPE-package~. The argument may also be a class symbol, in
which case the respective type is returned. The type of ~epkg-package~
itself is ~all~.
ARG has to be the class ~epkg-package~, a subclass of that, an
~epkg-package~ object, or an object of a subclass. The type
represents the class and is used in the user interface, where
it would be inconvenient to instead use the actual class name,
because the latter is longer and an implementation detail.

- Function: epkg-package-types subtypes

Expand Down
13 changes: 7 additions & 6 deletions epkg.texi
Original file line number Diff line number Diff line change
Expand Up @@ -574,14 +574,15 @@ that it is a mandatory dependency; if a string is used, then it
is an optional dependency.
@end defun

@defun epkg-type pkg
@defun epkg-type arg

This function returns the type of the @code{epkg-package} object PKG.
This function returns the type of the object or class ARG.

A package's type is a short representation of its class, as in
@code{epkg-TYPE-package}. The argument may also be a class symbol, in
which case the respective type is returned. The type of @code{epkg-package}
itself is @code{all}.
ARG has to be the class @code{epkg-package}, a subclass of that, an
@code{epkg-package} object, or an object of a subclass. The type
represents the class and is used in the user interface, where
it would be inconvenient to instead use the actual class name,
because the latter is longer and an implementation detail.
@end defun

@defun epkg-package-types subtypes
Expand Down

0 comments on commit 80ad642

Please sign in to comment.