]> code.delx.au - gnu-emacs/blobdiff - lisp/emacs-lisp/eieio-opt.el
* lisp/emacs-lisp/cl-generic.el (cl--generic-method): New struct.
[gnu-emacs] / lisp / emacs-lisp / eieio-opt.el
index 27f97b31ebe156d4669e7cc3f0a9fc9113fdcf5d..8d40edf56248c348e635e4845ff698ce2483aabf 100644 (file)
@@ -1,6 +1,6 @@
 ;;; eieio-opt.el -- eieio optional functions (debug, printing, speedbar)
 
 ;;; eieio-opt.el -- eieio optional functions (debug, printing, speedbar)
 
-;; Copyright (C) 1996, 1998-2003, 2005, 2008-2013 Free Software
+;; Copyright (C) 1996, 1998-2003, 2005, 2008-2015 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
 ;; Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <zappo@gnu.org>
@@ -60,7 +60,7 @@ Argument PREFIX is the character prefix to use.
 Argument CH-PREFIX is another character prefix to display."
   (eieio--check-type class-p this-root)
   (let ((myname (symbol-name this-root))
 Argument CH-PREFIX is another character prefix to display."
   (eieio--check-type class-p this-root)
   (let ((myname (symbol-name this-root))
-       (chl (eieio--class-children (class-v this-root)))
+       (chl (eieio--class-children (eieio--class-v this-root)))
        (fprefix (concat ch-prefix "  +--"))
        (mprefix (concat ch-prefix "  |  "))
        (lprefix (concat ch-prefix "     ")))
        (fprefix (concat ch-prefix "  +--"))
        (mprefix (concat ch-prefix "  |  "))
        (lprefix (concat ch-prefix "     ")))
@@ -74,109 +74,71 @@ Argument CH-PREFIX is another character prefix to display."
 
 ;;; CLASS COMPLETION / DOCUMENTATION
 
 
 ;;; CLASS COMPLETION / DOCUMENTATION
 
-;;;###autoload(defalias 'describe-class 'eieio-describe-class)
-
 ;;;###autoload
 ;;;###autoload
-(defun eieio-describe-class (class &optional headerfcn)
-  "Describe a CLASS defined by a string or symbol.
-If CLASS is actually an object, then also display current values of that object.
-Optional HEADERFCN should be called to insert a few bits of info first."
-  (interactive (list (eieio-read-class "Class: ")))
-  (with-output-to-temp-buffer (help-buffer) ;"*Help*"
-    (help-setup-xref (list #'eieio-describe-class class headerfcn)
-                    (called-interactively-p 'interactive))
-
-    (when headerfcn (funcall headerfcn))
-    (prin1 class)
-    (princ " is a")
-    (if (class-option class :abstract)
-       (princ "n abstract"))
-    (princ " class")
-    ;; Print file location
-    (when (get class 'class-location)
-      (princ " in `")
-      (princ (file-name-nondirectory (get class 'class-location)))
-      (princ "'"))
-    (terpri)
-    ;; Inheritance tree information
-    (let ((pl (eieio-class-parents class)))
-      (when pl
-       (princ " Inherits from ")
-       (while pl
-         (princ "`") (prin1 (car pl)) (princ "'")
-         (setq pl (cdr pl))
-         (if pl (princ ", ")))
-       (terpri)))
-    (let ((ch (eieio-class-children class)))
-      (when ch
-       (princ " Children ")
-       (while ch
-         (princ "`") (prin1 (car ch)) (princ "'")
-         (setq ch (cdr ch))
-         (if ch (princ ", ")))
-       (terpri)))
-    (terpri)
-    ;; System documentation
-    (let ((doc (documentation-property class 'variable-documentation)))
-      (when doc
-       (princ "Documentation:")
-       (terpri)
-       (princ doc)
-       (terpri)
-       (terpri)))
-    ;; Describe all the slots in this class
-    (eieio-describe-class-slots class)
-    ;; Describe all the methods specific to this class.
-    (let ((methods (eieio-all-generic-functions class))
-         (doc nil))
-      (if (not methods) nil
-       (princ "Specialized Methods:")
-       (terpri)
-       (terpri)
-       (while methods
-         (setq doc (eieio-method-documentation (car methods) class))
-         (princ "`")
-         (prin1 (car methods))
-         (princ "'")
-         (if (not doc)
-             (princ "  Undocumented")
-           (if (car doc)
-               (progn
-                 (princ "  :STATIC ")
-                 (prin1 (car (car doc)))
-                 (terpri)
-                 (princ (cdr (car doc)))))
-           (setq doc (cdr doc))
-           (if (car doc)
-               (progn
-                 (princ "  :BEFORE ")
-                 (prin1 (car (car doc)))
-                 (terpri)
-                 (princ (cdr (car doc)))))
-           (setq doc (cdr doc))
-           (if (car doc)
-               (progn
-                 (princ "  :PRIMARY ")
-                 (prin1 (car (car doc)))
-                 (terpri)
-                 (princ (cdr (car doc)))))
-           (setq doc (cdr doc))
-           (if (car doc)
-               (progn
-                 (princ "  :AFTER ")
-                 (prin1 (car (car doc)))
-                 (terpri)
-                 (princ (cdr (car doc)))))
-           (terpri)
-           (terpri))
-         (setq methods (cdr methods))))))
-  (with-current-buffer (help-buffer)
-    (buffer-string)))
-
-(defun eieio-describe-class-slots (class)
-  "Describe the slots in CLASS.
-Outputs to the standard output."
-  (let* ((cv (class-v class))
+(defun eieio-help-class (class)
+  "Print help description for CLASS.
+If CLASS is actually an object, then also display current values of that object."
+  ;; Header line
+  (prin1 class)
+  (insert " is a"
+         (if (eieio--class-option (eieio--class-v class) :abstract)
+             "n abstract"
+           "")
+         " class")
+  (let ((location (get class 'class-location)))
+    (when location
+      (insert " in `")
+      (help-insert-xref-button
+       (file-name-nondirectory location)
+       'eieio-class-def class location)
+      (insert "'")))
+  (insert ".\n")
+  ;; Parents
+  (let ((pl (eieio-class-parents class))
+       cur)
+    (when pl
+      (insert " Inherits from ")
+      (while (setq cur (pop pl))
+       (insert "`")
+       (help-insert-xref-button (symbol-name cur)
+                                'help-function cur)
+       (insert (if pl "', " "'")))
+      (insert ".\n")))
+  ;; Children
+  (let ((ch (eieio-class-children class))
+       cur)
+    (when ch
+      (insert " Children ")
+      (while (setq cur (pop ch))
+       (insert "`")
+       (help-insert-xref-button (symbol-name cur)
+                                'help-function cur)
+       (insert (if ch "', " "'")))
+      (insert ".\n")))
+  ;; System documentation
+  (let ((doc (documentation-property class 'variable-documentation)))
+    (when doc
+      (insert "\n" doc "\n\n")))
+  ;; Describe all the slots in this class.
+  (eieio-help-class-slots class)
+  ;; Describe all the methods specific to this class.
+  (let ((generics (eieio-all-generic-functions class)))
+    (when generics
+      (insert (propertize "Specialized Methods:\n\n" 'face 'bold))
+      (dolist (generic generics)
+        (insert "`")
+        (help-insert-xref-button (symbol-name generic) 'help-function generic)
+        (insert "'")
+       (pcase-dolist (`(,qualifiers ,args ,doc)
+                       (eieio-method-documentation generic class))
+          (insert (format " %s%S\n" qualifiers args)
+                  (or doc "")))
+       (insert "\n\n")))))
+
+(defun eieio-help-class-slots (class)
+  "Print help description for the slots in CLASS.
+Outputs to the current buffer."
+  (let* ((cv (eieio--class-v class))
         (docs   (eieio--class-public-doc cv))
         (names  (eieio--class-public-a cv))
         (deflt  (eieio--class-public-d cv))
         (docs   (eieio--class-public-doc cv))
         (names  (eieio--class-public-a cv))
         (deflt  (eieio--class-public-d cv))
@@ -185,28 +147,27 @@ Outputs to the standard output."
         (i      0)
         (prot   (eieio--class-protection cv))
         )
         (i      0)
         (prot   (eieio--class-protection cv))
         )
-    (princ "Instance Allocated Slots:")
-    (terpri)
-    (terpri)
+    (insert (propertize "Instance Allocated Slots:\n\n"
+                       'face 'bold))
     (while names
     (while names
-      (if (car prot) (princ "Private "))
-      (princ "Slot: ")
-      (prin1 (car names))
-      (when (not (eq (aref types i) t))
-       (princ "    type = ")
-       (prin1 (aref types i)))
-      (unless (eq (car deflt) eieio-unbound)
-       (princ "    default = ")
-       (prin1 (car deflt)))
-      (when (car publp)
-       (princ "    printer = ")
-       (prin1 (car publp)))
-      (when (car docs)
-       (terpri)
-       (princ "  ")
-       (princ (car docs))
-       (terpri))
-      (terpri)
+      (insert
+       (concat
+       (when (car prot)
+         (propertize "Private " 'face 'bold))
+       (propertize "Slot: " 'face 'bold)
+       (prin1-to-string (car names))
+       (unless (eq (aref types i) t)
+         (concat "    type = "
+                 (prin1-to-string (aref types i))))
+       (unless (eq (car deflt) eieio-unbound)
+         (concat "    default = "
+                 (prin1-to-string (car deflt))))
+       (when (car publp)
+         (concat "    printer = "
+                 (prin1-to-string (car publp))))
+       (when (car docs)
+         (concat "\n  " (car docs) "\n"))
+       "\n"))
       (setq names (cdr names)
            docs (cdr docs)
            deflt (cdr deflt)
       (setq names (cdr names)
            docs (cdr docs)
            deflt (cdr deflt)
@@ -219,69 +180,37 @@ Outputs to the standard output."
          i     0
          prot  (eieio--class-class-allocation-protection cv))
     (when names
          i     0
          prot  (eieio--class-class-allocation-protection cv))
     (when names
-       (terpri)
-       (princ "Class Allocated Slots:"))
-       (terpri)
-       (terpri)
+      (insert (propertize "\nClass Allocated Slots:\n\n" 'face 'bold)))
     (while names
     (while names
-      (when (car prot)
-       (princ "Private "))
-      (princ "Slot: ")
-      (prin1 (car names))
-      (unless (eq (aref types i) t)
-       (princ "    type = ")
-       (prin1 (aref types i)))
-      (condition-case nil
-         (let ((value (eieio-oref class (car names))))
-           (princ "   value = ")
-           (prin1 value))
+      (insert
+       (concat
+       (when (car prot)
+         "Private ")
+       "Slot: "
+       (prin1-to-string (car names))
+       (unless (eq (aref types i) t)
+         (concat "    type = "
+                 (prin1-to-string (aref types i))))
+       (condition-case nil
+           (let ((value (eieio-oref class (car names))))
+             (concat "   value = "
+                     (prin1-to-string value)))
          (error nil))
          (error nil))
-      (when (car docs)
-       (terpri)
-       (princ "  ")
-       (princ (car docs))
-       (terpri))
-      (terpri)
+       (when (car docs)
+         (concat "\n\n " (car docs) "\n"))
+       "\n"))
       (setq names (cdr names)
            docs (cdr docs)
            prot (cdr prot)
            i (1+ i)))))
 
       (setq names (cdr names)
            docs (cdr docs)
            prot (cdr prot)
            i (1+ i)))))
 
-;;;###autoload
-(defun eieio-describe-constructor (fcn)
-  "Describe the constructor function FCN.
-Uses `eieio-describe-class' to describe the class being constructed."
-  (interactive
-   ;; Use eieio-read-class since all constructors have the same name as
-   ;; the class they create.
-   (list (eieio-read-class "Class: ")))
-  (eieio-describe-class
-   fcn (lambda ()
-        ;; Describe the constructor part.
-        (prin1 fcn)
-        (princ " is an object constructor function")
-        ;; Print file location
-        (when (get fcn 'class-location)
-          (princ " in `")
-          (princ (file-name-nondirectory (get fcn 'class-location)))
-          (princ "'"))
-        (terpri)
-        (princ "Creates an object of class ")
-        (prin1 fcn)
-        (princ ".")
-        (terpri)
-        (terpri)
-        ))
-  )
-
 (defun eieio-build-class-list (class)
   "Return a list of all classes that inherit from CLASS."
   (if (class-p class)
 (defun eieio-build-class-list (class)
   "Return a list of all classes that inherit from CLASS."
   (if (class-p class)
-      (apply #'append
-            (mapcar
-             (lambda (c)
-               (append (list c) (eieio-build-class-list c)))
-             (eieio-class-children-fast class)))
+      (cl-mapcan
+       (lambda (c)
+         (append (list c) (eieio-build-class-list c)))
+       (eieio--class-children (eieio--class-v class)))
     (list class)))
 
 (defun eieio-build-class-alist (&optional class instantiable-only buildlist)
     (list class)))
 
 (defun eieio-build-class-alist (&optional class instantiable-only buildlist)
@@ -290,15 +219,16 @@ Optional argument CLASS is the class to start with.
 If INSTANTIABLE-ONLY is non nil, only allow names of classes which
 are not abstract, otherwise allow all classes.
 Optional argument BUILDLIST is more list to attach and is used internally."
 If INSTANTIABLE-ONLY is non nil, only allow names of classes which
 are not abstract, otherwise allow all classes.
 Optional argument BUILDLIST is more list to attach and is used internally."
-  (let* ((cc (or class eieio-default-superclass))
-        (sublst (eieio--class-children (class-v cc))))
+  (let* ((cc (or class 'eieio-default-superclass))
+        (sublst (eieio--class-children (eieio--class-v cc))))
     (unless (assoc (symbol-name cc) buildlist)
       (when (or (not instantiable-only) (not (class-abstract-p cc)))
     (unless (assoc (symbol-name cc) buildlist)
       (when (or (not instantiable-only) (not (class-abstract-p cc)))
+        ;; FIXME: Completion tables don't need alists, and ede/generic.el needs
+        ;; the symbols rather than their names.
        (setq buildlist (cons (cons (symbol-name cc) 1) buildlist))))
        (setq buildlist (cons (cons (symbol-name cc) 1) buildlist))))
-    (while sublst
+    (dolist (elem sublst)
       (setq buildlist (eieio-build-class-alist
       (setq buildlist (eieio-build-class-alist
-                      (car sublst) instantiable-only buildlist))
-      (setq sublst (cdr sublst)))
+                      elem instantiable-only buildlist)))
     buildlist))
 
 (defvar eieio-read-class nil
     buildlist))
 
 (defvar eieio-read-class nil
@@ -326,163 +256,94 @@ are not abstract."
 
 ;;; METHOD COMPLETION / DOC
 
 
 ;;; METHOD COMPLETION / DOC
 
-(defalias 'describe-method 'eieio-describe-generic)
-;;;###autoload(defalias 'describe-generic 'eieio-describe-generic)
-(defalias 'eieio-describe-method 'eieio-describe-generic)
+(define-button-type 'eieio-method-def
+  :supertype 'help-xref
+  'help-function (lambda (class method file)
+                  (eieio-help-find-method-definition class method file))
+  'help-echo (purecopy "mouse-2, RET: find method's definition"))
+
+(define-button-type 'eieio-class-def
+  :supertype 'help-xref
+  'help-function (lambda (class file)
+                  (eieio-help-find-class-definition class file))
+  'help-echo (purecopy "mouse-2, RET: find class definition"))
 
 ;;;###autoload
 
 ;;;###autoload
-(defun eieio-describe-generic (generic)
-  "Describe the generic function GENERIC.
-Also extracts information about all methods specific to this generic."
-  (interactive (list (eieio-read-generic "Generic Method: ")))
-  (eieio--check-type generic-p generic)
-  (with-output-to-temp-buffer (help-buffer) ; "*Help*"
-    (help-setup-xref (list #'eieio-describe-generic generic)
-                    (called-interactively-p 'interactive))
-
-    (prin1 generic)
-    (princ " is a generic function")
-    (when (generic-primary-only-p generic)
-      (princ " with only ")
-      (when (generic-primary-only-one-p generic)
-       (princ "one "))
-      (princ "primary method")
-      (when (not (generic-primary-only-one-p generic))
-       (princ "s"))
-      )
-    (princ ".")
-    (terpri)
-    (terpri)
-    (let ((d (documentation generic)))
-      (if (not d)
-         (princ "The generic is not documented.\n")
-       (princ "Documentation:")
-       (terpri)
-       (princ d)
-       (terpri)
-       (terpri)))
-    (princ "Implementations:")
-    (terpri)
-    (terpri)
-    (let ((i 4)
-         (prefix [ ":STATIC" ":BEFORE" ":PRIMARY" ":AFTER" ] ))
-      ;; Loop over fanciful generics
-      (while (< i 7)
-       (let ((gm (aref (get generic 'eieio-method-tree) i)))
-         (when gm
-           (princ "Generic ")
-           (princ (aref prefix (- i 3)))
-           (terpri)
-           (princ (or (nth 2 gm) "Undocumented"))
-           (terpri)
-           (terpri)))
-       (setq i (1+ i)))
-      (setq i 0)
-      ;; Loop over defined class-specific methods
-      (while (< i 4)
-       (let ((gm (reverse (aref (get generic 'eieio-method-tree) i)))
-             location)
-         (while gm
-           (princ "`")
-           (prin1 (car (car gm)))
-           (princ "'")
-           ;; prefix type
-           (princ " ")
-           (princ (aref prefix i))
-           (princ " ")
-           ;; argument list
-           (let* ((func (cdr (car gm)))
-                  (arglst (eieio-lambda-arglist func)))
-             (prin1 arglst))
-           (terpri)
-           ;; 3 because of cdr
-           (princ (or (documentation (cdr (car gm)))
-                      "Undocumented"))
-           ;; Print file location if available
-           (when (and (setq location (get generic 'method-locations))
-                      (setq location (assoc (caar gm) location)))
-             (setq location (cadr location))
-             (princ "\n\nDefined in `")
-             (princ (file-name-nondirectory location))
-             (princ "'\n"))
-           (setq gm (cdr gm))
-           (terpri)
-           (terpri)))
-       (setq i (1+ i)))))
-  (with-current-buffer (help-buffer)
-    (buffer-string)))
-
-(defun eieio-lambda-arglist (func)
-  "Return the argument list of FUNC, a function body."
-  (if (symbolp func) (setq func (symbol-function func)))
-  (if (byte-code-function-p func)
-      (eieio-compiled-function-arglist func)
-    (car (cdr func))))
+(defun eieio-help-constructor (ctr)
+  "Describe CTR if it is a class constructor."
+  (when (class-p ctr)
+    (erase-buffer)
+    (let ((location (get ctr 'class-location))
+         (def (symbol-function ctr)))
+      (goto-char (point-min))
+      (prin1 ctr)
+      (insert (format " is an %s object constructor function"
+                     (if (autoloadp def)
+                         "autoloaded"
+                       "")))
+      (when (and (autoloadp def)
+                (null location))
+       (setq location
+             (find-lisp-object-file-name ctr def)))
+      (when location
+       (insert " in `")
+       (help-insert-xref-button
+        (file-name-nondirectory location)
+        'eieio-class-def ctr location)
+       (insert "'"))
+      (insert ".\nCreates an object of class " (symbol-name ctr) ".")
+      (goto-char (point-max))
+      (if (autoloadp def)
+         (insert "\n\n[Class description not available until class definition is loaded.]\n")
+       (save-excursion
+         (insert (propertize "\n\nClass description:\n" 'face 'bold))
+         (eieio-help-class ctr))
+       ))))
+
+(defun eieio--specializers-apply-to-class-p (specializers class)
+  "Return non-nil if a method with SPECIALIZERS applies to CLASS."
+  (let ((applies nil))
+    (dolist (specializer specializers)
+      (if (eq 'subclass (car-safe specializer))
+          (setq specializer (nth 1 specializer)))
+      ;; Don't include the methods that are "too generic", such as those
+      ;; applying to `eieio-default-superclass'.
+      (and (not (memq specializer '(t eieio-default-superclass)))
+           (class-p specializer)
+           (child-of-class-p class specializer)
+           (setq applies t)))
+    applies))
 
 (defun eieio-all-generic-functions (&optional class)
   "Return a list of all generic functions.
 Optional CLASS argument returns only those functions that contain
 methods for CLASS."
 
 (defun eieio-all-generic-functions (&optional class)
   "Return a list of all generic functions.
 Optional CLASS argument returns only those functions that contain
 methods for CLASS."
-  (let ((l nil) tree (cn (if class (symbol-name class) nil)))
+  (let ((l nil))
     (mapatoms
      (lambda (symbol)
     (mapatoms
      (lambda (symbol)
-       (setq tree (get symbol 'eieio-method-obarray))
-       (if tree
-          (progn
-            ;; A symbol might be interned for that class in one of
-            ;; these three slots in the method-obarray.
-            (if (or (not class)
-                    (fboundp (intern-soft cn (aref tree 0)))
-                    (fboundp (intern-soft cn (aref tree 1)))
-                    (fboundp (intern-soft cn (aref tree 2))))
-                (setq l (cons symbol l)))))))
+       (let ((generic (and (fboundp symbol) (cl--generic symbol))))
+         (and generic
+             (catch 'found
+               (if (null class) (throw 'found t))
+               (dolist (method (cl--generic-method-table generic))
+                 (if (eieio--specializers-apply-to-class-p
+                      (cl--generic-method-specializers method) class)
+                     (throw 'found t))))
+             (push symbol l)))))
     l))
 
 (defun eieio-method-documentation (generic class)
     l))
 
 (defun eieio-method-documentation (generic class)
-  "Return a list of the specific documentation of GENERIC for CLASS.
-If there is not an explicit method for CLASS in GENERIC, or if that
-function has no documentation, then return nil."
-  (let ((tree (get generic 'eieio-method-obarray))
-       (cn (symbol-name class))
-       before primary after)
-    (if (not tree)
-       nil
-      ;; A symbol might be interned for that class in one of
-      ;; these three slots in the method-obarray.
-      (setq before (intern-soft cn (aref tree 0))
-           primary (intern-soft cn (aref tree 1))
-           after (intern-soft cn (aref tree 2)))
-      (if (not (or (fboundp before)
-                  (fboundp primary)
-                  (fboundp after)))
-         nil
-       (list (if (fboundp before)
-                 (cons (eieio-lambda-arglist before)
-                       (documentation before))
-               nil)
-             (if (fboundp primary)
-                 (cons (eieio-lambda-arglist primary)
-                       (documentation primary))
-               nil)
-             (if (fboundp after)
-                 (cons (eieio-lambda-arglist after)
-                       (documentation after))
-               nil))))))
-
-(defvar eieio-read-generic nil
-  "History of the `eieio-read-generic' prompt.")
-
-(defun eieio-read-generic-p (fn)
-  "Function used in function `eieio-read-generic'.
-This is because `generic-p' is a macro.
-Argument FN is the function to test."
-  (generic-p fn))
-
-(defun eieio-read-generic (prompt &optional historyvar)
-  "Read a generic function from the minibuffer with PROMPT.
-Optional argument HISTORYVAR is the variable to use as history."
-  (intern (completing-read prompt obarray 'eieio-read-generic-p
-                          t nil (or historyvar 'eieio-read-generic))))
+  "Return info for all methods of GENERIC applicable to CLASS.
+The value returned is a list of elements of the form
+\(QUALIFIERS ARGS DOC)."
+  (let ((generic (cl--generic generic))
+        (docs ()))
+    (when generic
+      (dolist (method (cl--generic-method-table generic))
+        (when (eieio--specializers-apply-to-class-p
+               (cl--generic-method-specializers method) class)
+          (push (cl--generic-method-info method) docs))))
+    docs))
 
 ;;; METHOD STATS
 ;;
 
 ;;; METHOD STATS
 ;;
@@ -584,21 +445,13 @@ Optional argument HISTORYVAR is the variable to use as history."
 
 ;;; HELP AUGMENTATION
 ;;
 
 ;;; HELP AUGMENTATION
 ;;
-(define-button-type 'eieio-method-def
-  :supertype 'help-xref
-  'help-function (lambda (class method file)
-                  (eieio-help-find-method-definition class method file))
-  'help-echo (purecopy "mouse-2, RET: find method's definition"))
-
-(define-button-type 'eieio-class-def
-  :supertype 'help-xref
-  'help-function (lambda (class file)
-                  (eieio-help-find-class-definition class file))
-  'help-echo (purecopy "mouse-2, RET: find class definition"))
-
 (defun eieio-help-find-method-definition (class method file)
   (let ((filename (find-library-name file))
        location buf)
 (defun eieio-help-find-method-definition (class method file)
   (let ((filename (find-library-name file))
        location buf)
+    (when (symbolp class)
+      (setq class (symbol-name class)))
+    (when (symbolp method)
+      (setq method (symbol-name method)))
     (when (null filename)
       (error "Cannot find library %s" file))
     (setq buf (find-file-noselect filename))
     (when (null filename)
       (error "Cannot find library %s" file))
     (setq buf (find-file-noselect filename))
@@ -622,6 +475,8 @@ Optional argument HISTORYVAR is the variable to use as history."
       (beginning-of-line))))
 
 (defun eieio-help-find-class-definition (class file)
       (beginning-of-line))))
 
 (defun eieio-help-find-class-definition (class file)
+  (when (symbolp class)
+    (setq class (symbol-name class)))
   (let ((filename (find-library-name file))
        location buf)
     (when (null filename)
   (let ((filename (find-library-name file))
        location buf)
     (when (null filename)
@@ -642,71 +497,6 @@ Optional argument HISTORYVAR is the variable to use as history."
       (recenter)
       (beginning-of-line))))
 
       (recenter)
       (beginning-of-line))))
 
-
-(defun eieio-help-mode-augmentation-maybee (&rest unused)
-  "For buffers thrown into help mode, augment for EIEIO.
-Arguments UNUSED are not used."
-  ;; Scan created buttons so far if we are in help mode.
-  (when (eq major-mode 'help-mode)
-    (save-excursion
-      (goto-char (point-min))
-      (let ((pos t) (inhibit-read-only t))
-       (while pos
-         (if (get-text-property (point) 'help-xref) ; move off reference
-             (goto-char
-              (or (next-single-property-change (point) 'help-xref)
-                  (point))))
-         (setq pos (next-single-property-change (point) 'help-xref))
-         (when pos
-           (goto-char pos)
-           (let* ((help-data (get-text-property (point) 'help-xref))
-                  ;(method (car help-data))
-                  (args (cdr help-data)))
-             (when (symbolp (car args))
-               (cond ((class-p (car args))
-                      (setcar help-data 'eieio-describe-class))
-                     ((generic-p (car args))
-                      (setcar help-data 'eieio-describe-generic))
-                     (t nil))
-               ))))
-       ;; start back at the beginning, and highlight some sections
-       (goto-char (point-min))
-       (while (re-search-forward "^\\(Documentation\\|Implementations\\):$" nil t)
-           (put-text-property (match-beginning 0) (match-end 0) 'face 'bold))
-       (goto-char (point-min))
-       (if (re-search-forward "^Specialized Methods:$" nil t)
-           (put-text-property (match-beginning 0) (match-end 0) 'face 'bold))
-       (goto-char (point-min))
-       (while (re-search-forward "^\\(Instance\\|Class\\) Allocated Slots:$" nil t)
-           (put-text-property (match-beginning 0) (match-end 0) 'face 'bold))
-       (goto-char (point-min))
-       (while (re-search-forward ":\\(STATIC\\|BEFORE\\|AFTER\\|PRIMARY\\)" nil t)
-           (put-text-property (match-beginning 0) (match-end 0) 'face 'bold))
-       (goto-char (point-min))
-       (while (re-search-forward "^\\(Private \\)?Slot:" nil t)
-           (put-text-property (match-beginning 0) (match-end 0) 'face 'bold))
-       (goto-char (point-min))
-       (cond
-        ((looking-at "\\(.+\\) is a generic function")
-         (let ((mname (match-string 1))
-               cname)
-           (while (re-search-forward "^`\\(.+\\)'[^\0]+?Defined in `\\(.+\\)'" nil t)
-             (setq cname (match-string-no-properties 1))
-             (help-xref-button 2 'eieio-method-def cname
-                               mname
-                               (cadr (assoc (intern cname)
-                                            (get (intern mname)
-                                                 'method-locations)))))))
-        ((looking-at "\\(.+\\) is an object constructor function in `\\(.+\\)'")
-         (let ((cname (match-string-no-properties 1)))
-           (help-xref-button 2 'eieio-class-def cname
-                             (get (intern cname) 'class-location))))
-        ((looking-at "\\(.+\\) is a\\(n abstract\\)? class in `\\(.+\\)'")
-         (let ((cname (match-string-no-properties 1)))
-           (help-xref-button 3 'eieio-class-def cname
-                             (get (intern cname) 'class-location)))))
-       ))))
-
 ;;; SPEEDBAR SUPPORT
 ;;
 
 ;;; SPEEDBAR SUPPORT
 ;;
 
@@ -743,21 +533,21 @@ Arguments UNUSED are not used."
   ()
   "Menu part in easymenu format used in speedbar while in `eieio' mode.")
 
   ()
   "Menu part in easymenu format used in speedbar while in `eieio' mode.")
 
-(defun eieio-class-speedbar (dir-or-object depth)
+(defun eieio-class-speedbar (_dir-or-object _depth)
   "Create buttons in speedbar that represents the current project.
 DIR-OR-OBJECT is the object to expand, or nil, and DEPTH is the
 current expansion depth."
   (when (eq (point-min) (point-max))
     ;; This function is only called once, to start the whole deal.
   "Create buttons in speedbar that represents the current project.
 DIR-OR-OBJECT is the object to expand, or nil, and DEPTH is the
 current expansion depth."
   (when (eq (point-min) (point-max))
     ;; This function is only called once, to start the whole deal.
-    ;; Ceate, and expand the default object.
-    (eieio-class-button eieio-default-superclass 0)
+    ;; Create and expand the default object.
+    (eieio-class-button 'eieio-default-superclass 0)
     (forward-line -1)
     (speedbar-expand-line)))
 
 (defun eieio-class-button (class depth)
   "Draw a speedbar button at the current point for CLASS at DEPTH."
   (eieio--check-type class-p class)
     (forward-line -1)
     (speedbar-expand-line)))
 
 (defun eieio-class-button (class depth)
   "Draw a speedbar button at the current point for CLASS at DEPTH."
   (eieio--check-type class-p class)
-  (let ((subclasses (eieio--class-children (class-v class))))
+  (let ((subclasses (eieio--class-children (eieio--class-v class))))
     (if subclasses
        (speedbar-make-tag-line 'angle ?+
                                'eieio-sb-expand
     (if subclasses
        (speedbar-make-tag-line 'angle ?+
                                'eieio-sb-expand
@@ -782,7 +572,7 @@ Argument INDENT is the depth of indentation."
         (speedbar-with-writable
           (save-excursion
             (end-of-line) (forward-char 1)
         (speedbar-with-writable
           (save-excursion
             (end-of-line) (forward-char 1)
-            (let ((subclasses (eieio--class-children (class-v class))))
+            (let ((subclasses (eieio--class-children (eieio--class-v class))))
               (while subclasses
                 (eieio-class-button (car subclasses) (1+ indent))
                 (setq subclasses (cdr subclasses)))))))
               (while subclasses
                 (eieio-class-button (car subclasses) (1+ indent))
                 (setq subclasses (cdr subclasses)))))))
@@ -792,13 +582,17 @@ Argument INDENT is the depth of indentation."
        (t (error "Ooops...  not sure what to do")))
   (speedbar-center-buffer-smartly))
 
        (t (error "Ooops...  not sure what to do")))
   (speedbar-center-buffer-smartly))
 
-(defun eieio-describe-class-sb (text token indent)
+(defun eieio-describe-class-sb (_text token _indent)
   "Describe the class TEXT in TOKEN.
 INDENT is the current indentation level."
   (dframe-with-attached-buffer
   "Describe the class TEXT in TOKEN.
 INDENT is the current indentation level."
   (dframe-with-attached-buffer
-   (eieio-describe-class token))
+   (describe-function token))
   (dframe-maybee-jump-to-attached-frame))
 
 (provide 'eieio-opt)
 
   (dframe-maybee-jump-to-attached-frame))
 
 (provide 'eieio-opt)
 
+;; Local variables:
+;; generated-autoload-file: "eieio.el"
+;; End:
+
 ;;; eieio-opt.el ends here
 ;;; eieio-opt.el ends here