From 81a076ee92df87c0ded9e759dcc28e2772feabc5 Mon Sep 17 00:00:00 2001 From: jjgarcia Date: Thu, 21 Apr 2005 09:32:41 +0000 Subject: [PATCH] (DOCUMENTATION 'F 'FUNCTION) did not work with generic functions --- src/CHANGELOG | 2 ++ src/clos/inspect.lsp | 40 +++++++++++++++++++++++++++++----------- 2 files changed, 31 insertions(+), 11 deletions(-) diff --git a/src/CHANGELOG b/src/CHANGELOG index ce84574e5..5d70701c0 100644 --- a/src/CHANGELOG +++ b/src/CHANGELOG @@ -42,6 +42,8 @@ ECL 0.9f - Pipes are now opened in character mode (M. Pasternacki) + - (DOCUMENTATION 'F 'FUNCTION) did not work with generic functions. + * Foreign function interface (FFI): - ext:c-uint-max and ext:c-ulong-max did not have the right bignum value. diff --git a/src/clos/inspect.lsp b/src/clos/inspect.lsp index bbb680496..4b7c59b52 100644 --- a/src/clos/inspect.lsp +++ b/src/clos/inspect.lsp @@ -431,20 +431,38 @@ q (or Q): quits the inspection.~%~ (defmethod documentation ((object symbol) doc-type) (when (member doc-type +valid-documentation-types+) - (or (when (eq doc-type 'type) - (let ((c (find-class object nil))) - (and c (documentation c t)))) - (si::get-documentation object doc-type)))) + (case doc-type + (type + (let ((c (find-class object nil))) + (if c + (documentation c t) + (si::get-documentation object doc-type)))) + (function + (if (fboundp object) + (documentation (fdefinition object) doc-type) + (si::get-documentation object doc-type))) + (otherwise + (si::get-documentation object doc-type))))) (defmethod (setf documentation) (new-value (object symbol) doc-type) (when (member doc-type +valid-documentation-types+) - (or (when (eq doc-type 'type) - (let ((c (find-class object nil))) - (when c - (si::set-documentation object 'type nil) - (si::set-documentation object 'structure nil) - (setf (documentation c t) new-value)))) - (si::get-documentation object doc-type))) + (case doc-type + (type + (let ((c (find-class object nil))) + (if c + (progn + (si::set-documentation object 'type nil) + (si::set-documentation object 'structure nil) + (setf (documentation c t) new-value)) + (si::set-documentation object doc-type new-value)))) + (function + (if (fboundp object) + (let ((c (fdefinition object))) + (si::set-documentation object 'function nil) + (setf (documentation object 'function) new-value)) + (si::set-documentation object doc-type new-value))) + (otherwise + (si::set-documentation object doc-type new-value)))) new-value) (defmethod documentation ((object package) doc-type)