annotate lisp/emacs-lisp/eieio-opt.el @ 111217:7be484934a7c

nnir.el (nnir-run-swish-e): Remove hyrex support.
author Katsumi Yamaoka <yamaoka@jpl.org>
date Thu, 28 Oct 2010 10:41:27 +0000
parents 280c8ae2476d
children 417b1e4d63cd
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
105237
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
1 ;;; eieio-opt.el -- eieio optional functions (debug, printing, speedbar)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
2
105327
dcbb3800a4e1 Doc/message fixes.
Glenn Morris <rgm@gnu.org>
parents: 105237
diff changeset
3 ;; Copyright (C) 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2008,
106815
1d1d5d9bd884 Add 2010 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 105813
diff changeset
4 ;; 2009, 2010 Free Software Foundation, Inc.
105237
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
5
105327
dcbb3800a4e1 Doc/message fixes.
Glenn Morris <rgm@gnu.org>
parents: 105237
diff changeset
6 ;; Author: Eric M. Ludlam <zappo@gnu.org>
105237
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
7 ;; Version: 0.2
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
8 ;; Keywords: OO, lisp
110015
280c8ae2476d Add "Package:" file headers to denote built-in packages.
Chong Yidong <cyd@stupidchicken.com>
parents: 106815
diff changeset
9 ;; Package: eieio
105237
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
10
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
11 ;; This file is part of GNU Emacs.
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
12
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
13 ;; GNU Emacs is free software: you can redistribute it and/or modify
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
14 ;; it under the terms of the GNU General Public License as published by
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
15 ;; the Free Software Foundation, either version 3 of the License, or
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
16 ;; (at your option) any later version.
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
17
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
18 ;; GNU Emacs is distributed in the hope that it will be useful,
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
19 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
21 ;; GNU General Public License for more details.
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
22
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
23 ;; You should have received a copy of the GNU General Public License
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
24 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
25
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
26 ;;; Commentary:
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
27 ;;
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
28 ;; This contains support functions to eieio. These functions contain
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
29 ;; some small class browser and class printing functions.
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
30 ;;
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
31
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
32 (require 'eieio)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
33
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
34 ;;; Code:
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
35 (defun eieio-browse (&optional root-class)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
36 "Create an object browser window to show all objects.
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
37 If optional ROOT-CLASS, then start with that, otherwise start with
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
38 variable `eieio-default-superclass'."
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
39 (interactive (if current-prefix-arg
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
40 (list (read (completing-read "Class: "
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
41 (eieio-build-class-alist)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
42 nil t)))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
43 nil))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
44 (if (not root-class) (setq root-class 'eieio-default-superclass))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
45 (if (not (class-p root-class)) (signal 'wrong-type-argument (list 'class-p root-class)))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
46 (display-buffer (get-buffer-create "*EIEIO OBJECT BROWSE*") t)
105813
df4934f25eef * textmodes/two-column.el (2C-split):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105474
diff changeset
47 (with-current-buffer (get-buffer "*EIEIO OBJECT BROWSE*")
105237
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
48 (erase-buffer)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
49 (goto-char 0)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
50 (eieio-browse-tree root-class "" "")
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
51 ))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
52
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
53 (defun eieio-browse-tree (this-root prefix ch-prefix)
105474
0a64442c10e3 Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents: 105377
diff changeset
54 "Recursively draw the children of the given class on the screen.
105237
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
55 Argument THIS-ROOT is the local root of the tree.
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
56 Argument PREFIX is the character prefix to use.
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
57 Argument CH-PREFIX is another character prefix to display."
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
58 (if (not (class-p (eval this-root))) (signal 'wrong-type-argument (list 'class-p this-root)))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
59 (let ((myname (symbol-name this-root))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
60 (chl (aref (class-v this-root) class-children))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
61 (fprefix (concat ch-prefix " +--"))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
62 (mprefix (concat ch-prefix " | "))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
63 (lprefix (concat ch-prefix " ")))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
64 (insert prefix myname "\n")
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
65 (while (cdr chl)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
66 (eieio-browse-tree (car chl) fprefix mprefix)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
67 (setq chl (cdr chl)))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
68 (if chl
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
69 (eieio-browse-tree (car chl) fprefix lprefix))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
70 ))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
71
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
72 ;;; CLASS COMPLETION / DOCUMENTATION
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
73
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
74 (defalias 'describe-class 'eieio-describe-class)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
75
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
76 (defun eieio-describe-class (class &optional headerfcn)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
77 "Describe a CLASS defined by a string or symbol.
105327
dcbb3800a4e1 Doc/message fixes.
Glenn Morris <rgm@gnu.org>
parents: 105237
diff changeset
78 If CLASS is actually an object, then also display current values of that object.
105237
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
79 Optional HEADERFCN should be called to insert a few bits of info first."
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
80 (interactive (list (eieio-read-class "Class: ")))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
81 (with-output-to-temp-buffer (help-buffer) ;"*Help*"
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
82 (help-setup-xref (list #'eieio-describe-class class headerfcn)
105372
bd2966850aac Use `called-interactively-p' instead of `interactive-p'.
Juanma Barranquero <lekktu@gmail.com>
parents: 105327
diff changeset
83 (called-interactively-p 'interactive))
105237
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
84
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
85 (when headerfcn (funcall headerfcn))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
86
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
87 (if (class-option class :abstract)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
88 (princ "Abstract "))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
89 (princ "Class ")
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
90 (prin1 class)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
91 (terpri)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
92 ;; Inheritence tree information
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
93 (let ((pl (class-parents class)))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
94 (when pl
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
95 (princ " Inherits from ")
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
96 (while pl
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
97 (princ "`") (prin1 (car pl)) (princ "'")
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
98 (setq pl (cdr pl))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
99 (if pl (princ ", ")))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
100 (terpri)))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
101 (let ((ch (class-children class)))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
102 (when ch
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
103 (princ " Children ")
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
104 (while ch
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
105 (princ "`") (prin1 (car ch)) (princ "'")
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
106 (setq ch (cdr ch))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
107 (if ch (princ ", ")))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
108 (terpri)))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
109 (terpri)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
110 ;; System documentation
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
111 (let ((doc (documentation-property class 'variable-documentation)))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
112 (when doc
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
113 (princ "Documentation:")
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
114 (terpri)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
115 (princ doc)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
116 (terpri)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
117 (terpri)))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
118 ;; Describe all the slots in this class
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
119 (eieio-describe-class-slots class)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
120 ;; Describe all the methods specific to this class.
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
121 (let ((methods (eieio-all-generic-functions class))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
122 (doc nil))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
123 (if (not methods) nil
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
124 (princ "Specialized Methods:")
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
125 (terpri)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
126 (terpri)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
127 (while methods
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
128 (setq doc (eieio-method-documentation (car methods) class))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
129 (princ "`")
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
130 (prin1 (car methods))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
131 (princ "'")
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
132 (if (not doc)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
133 (princ " Undocumented")
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
134 (if (car doc)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
135 (progn
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
136 (princ " :STATIC ")
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
137 (prin1 (car (car doc)))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
138 (terpri)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
139 (princ (cdr (car doc)))))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
140 (setq doc (cdr doc))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
141 (if (car doc)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
142 (progn
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
143 (princ " :BEFORE ")
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
144 (prin1 (car (car doc)))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
145 (terpri)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
146 (princ (cdr (car doc)))))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
147 (setq doc (cdr doc))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
148 (if (car doc)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
149 (progn
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
150 (princ " :PRIMARY ")
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
151 (prin1 (car (car doc)))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
152 (terpri)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
153 (princ (cdr (car doc)))))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
154 (setq doc (cdr doc))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
155 (if (car doc)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
156 (progn
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
157 (princ " :AFTER ")
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
158 (prin1 (car (car doc)))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
159 (terpri)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
160 (princ (cdr (car doc)))))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
161 (terpri)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
162 (terpri))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
163 (setq methods (cdr methods))))))
105813
df4934f25eef * textmodes/two-column.el (2C-split):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105474
diff changeset
164 (with-current-buffer (help-buffer)
105237
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
165 (buffer-string)))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
166
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
167 (defun eieio-describe-class-slots (class)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
168 "Describe the slots in CLASS.
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
169 Outputs to the standard output."
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
170 (let* ((cv (class-v class))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
171 (docs (aref cv class-public-doc))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
172 (names (aref cv class-public-a))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
173 (deflt (aref cv class-public-d))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
174 (types (aref cv class-public-type))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
175 (publp (aref cv class-public-printer))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
176 (i 0)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
177 (prot (aref cv class-protection))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
178 )
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
179 (princ "Instance Allocated Slots:")
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
180 (terpri)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
181 (terpri)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
182 (while names
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
183 (if (car prot) (princ "Private "))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
184 (princ "Slot: ")
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
185 (prin1 (car names))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
186 (when (not (eq (aref types i) t))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
187 (princ " type = ")
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
188 (prin1 (aref types i)))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
189 (unless (eq (car deflt) eieio-unbound)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
190 (princ " default = ")
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
191 (prin1 (car deflt)))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
192 (when (car publp)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
193 (princ " printer = ")
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
194 (prin1 (car publp)))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
195 (when (car docs)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
196 (terpri)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
197 (princ " ")
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
198 (princ (car docs))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
199 (terpri))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
200 (terpri)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
201 (setq names (cdr names)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
202 docs (cdr docs)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
203 deflt (cdr deflt)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
204 publp (cdr publp)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
205 prot (cdr prot)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
206 i (1+ i)))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
207 (setq docs (aref cv class-class-allocation-doc)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
208 names (aref cv class-class-allocation-a)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
209 types (aref cv class-class-allocation-type)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
210 i 0
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
211 prot (aref cv class-class-allocation-protection))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
212 (when names
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
213 (terpri)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
214 (princ "Class Allocated Slots:"))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
215 (terpri)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
216 (terpri)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
217 (while names
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
218 (when (car prot)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
219 (princ "Private "))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
220 (princ "Slot: ")
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
221 (prin1 (car names))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
222 (unless (eq (aref types i) t)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
223 (princ " type = ")
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
224 (prin1 (aref types i)))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
225 (condition-case nil
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
226 (let ((value (eieio-oref class (car names))))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
227 (princ " value = ")
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
228 (prin1 value))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
229 (error nil))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
230 (when (car docs)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
231 (terpri)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
232 (princ " ")
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
233 (princ (car docs))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
234 (terpri))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
235 (terpri)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
236 (setq names (cdr names)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
237 docs (cdr docs)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
238 prot (cdr prot)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
239 i (1+ i)))))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
240
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
241 (defun eieio-describe-constructor (fcn)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
242 "Describe the constructor function FCN.
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
243 Uses `eieio-describe-class' to describe the class being constructed."
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
244 (interactive
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
245 ;; Use eieio-read-class since all constructors have the same name as
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
246 ;; the class they create.
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
247 (list (eieio-read-class "Class: ")))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
248 (eieio-describe-class
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
249 fcn (lambda ()
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
250 ;; Describe the constructor part.
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
251 (princ "Object Constructor Function: ")
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
252 (prin1 fcn)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
253 (terpri)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
254 (princ "Creates an object of class ")
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
255 (prin1 fcn)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
256 (princ ".")
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
257 (terpri)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
258 (terpri)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
259 ))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
260 )
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
261
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
262 (defun eieio-build-class-alist (&optional class instantiable-only buildlist)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
263 "Return an alist of all currently active classes for completion purposes.
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
264 Optional argument CLASS is the class to start with.
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
265 If INSTANTIABLE-ONLY is non nil, only allow names of classes which
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
266 are not abstract, otherwise allow all classes.
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
267 Optional argument BUILDLIST is more list to attach and is used internally."
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
268 (let* ((cc (or class eieio-default-superclass))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
269 (sublst (aref (class-v cc) class-children)))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
270 (if (or (not instantiable-only) (not (class-abstract-p cc)))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
271 (setq buildlist (cons (cons (symbol-name cc) 1) buildlist)))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
272 (while sublst
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
273 (setq buildlist (eieio-build-class-alist
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
274 (car sublst) instantiable-only buildlist))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
275 (setq sublst (cdr sublst)))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
276 buildlist))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
277
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
278 (defvar eieio-read-class nil
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
279 "History of the function `eieio-read-class' prompt.")
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
280
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
281 (defun eieio-read-class (prompt &optional histvar instantiable-only)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
282 "Return a class chosen by the user using PROMPT.
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
283 Optional argument HISTVAR is a variable to use as history.
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
284 If INSTANTIABLE-ONLY is non nil, only allow names of classes which
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
285 are not abstract."
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
286 (intern (completing-read prompt (eieio-build-class-alist nil instantiable-only)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
287 nil t nil
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
288 (or histvar 'eieio-read-class))))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
289
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
290 (defun eieio-read-subclass (prompt class &optional histvar instantiable-only)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
291 "Return a class chosen by the user using PROMPT.
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
292 CLASS is the base class, and completion occurs across all subclasses.
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
293 Optional argument HISTVAR is a variable to use as history.
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
294 If INSTANTIABLE-ONLY is non nil, only allow names of classes which
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
295 are not abstract."
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
296 (intern (completing-read prompt
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
297 (eieio-build-class-alist class instantiable-only)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
298 nil t nil
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
299 (or histvar 'eieio-read-class))))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
300
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
301 ;;; METHOD COMPLETION / DOC
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
302
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
303 (defalias 'describe-method 'eieio-describe-generic)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
304 (defalias 'describe-generic 'eieio-describe-generic)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
305 (defalias 'eieio-describe-method 'eieio-describe-generic)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
306
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
307 (defun eieio-describe-generic (generic)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
308 "Describe the generic function GENERIC.
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
309 Also extracts information about all methods specific to this generic."
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
310 (interactive (list (eieio-read-generic "Generic Method: ")))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
311 (if (not (generic-p generic))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
312 (signal 'wrong-type-argument '(generic-p generic)))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
313 (with-output-to-temp-buffer (help-buffer) ; "*Help*"
105372
bd2966850aac Use `called-interactively-p' instead of `interactive-p'.
Juanma Barranquero <lekktu@gmail.com>
parents: 105327
diff changeset
314 (help-setup-xref (list #'eieio-describe-generic generic)
bd2966850aac Use `called-interactively-p' instead of `interactive-p'.
Juanma Barranquero <lekktu@gmail.com>
parents: 105327
diff changeset
315 (called-interactively-p 'interactive))
105237
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
316
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
317 (prin1 generic)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
318 (princ " is a generic function")
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
319 (when (generic-primary-only-p generic)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
320 (princ " with only ")
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
321 (when (generic-primary-only-one-p generic)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
322 (princ "one "))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
323 (princ "primary method")
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
324 (when (not (generic-primary-only-one-p generic))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
325 (princ "s"))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
326 )
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
327 (princ ".")
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
328 (terpri)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
329 (terpri)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
330 (let ((d (documentation generic)))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
331 (if (not d)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
332 (princ "The generic is not documented.\n")
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
333 (princ "Documentation:")
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
334 (terpri)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
335 (princ d)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
336 (terpri)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
337 (terpri)))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
338 (princ "Implementations:")
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
339 (terpri)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
340 (terpri)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
341 (let ((i 3)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
342 (prefix [ ":STATIC" ":BEFORE" ":PRIMARY" ":AFTER" ] ))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
343 ;; Loop over fanciful generics
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
344 (while (< i 6)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
345 (let ((gm (aref (get generic 'eieio-method-tree) i)))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
346 (when gm
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
347 (princ "Generic ")
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
348 (princ (aref prefix (- i 3)))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
349 (terpri)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
350 (princ (or (nth 2 gm) "Undocumented"))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
351 (terpri)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
352 (terpri)))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
353 (setq i (1+ i)))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
354 (setq i 0)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
355 ;; Loop over defined class-specific methods
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
356 (while (< i 3)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
357 (let ((gm (reverse (aref (get generic 'eieio-method-tree) i))))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
358 (while gm
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
359 (princ "`")
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
360 (prin1 (car (car gm)))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
361 (princ "'")
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
362 ;; prefix type
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
363 (princ " ")
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
364 (princ (aref prefix i))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
365 (princ " ")
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
366 ;; argument list
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
367 (let* ((func (cdr (car gm)))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
368 (arglst (eieio-lambda-arglist func)))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
369 (prin1 arglst))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
370 (terpri)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
371 ;; 3 because of cdr
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
372 (princ (or (documentation (cdr (car gm)))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
373 "Undocumented"))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
374 (setq gm (cdr gm))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
375 (terpri)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
376 (terpri)))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
377 (setq i (1+ i)))))
105813
df4934f25eef * textmodes/two-column.el (2C-split):
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 105474
diff changeset
378 (with-current-buffer (help-buffer)
105237
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
379 (buffer-string)))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
380
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
381 (defun eieio-lambda-arglist (func)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
382 "Return the argument list of FUNC, a function body."
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
383 (if (symbolp func) (setq func (symbol-function func)))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
384 (if (byte-code-function-p func)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
385 (eieio-compiled-function-arglist func)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
386 (car (cdr func))))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
387
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
388 (defun eieio-all-generic-functions (&optional class)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
389 "Return a list of all generic functions.
105474
0a64442c10e3 Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents: 105377
diff changeset
390 Optional CLASS argument returns only those functions that contain
0a64442c10e3 Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents: 105377
diff changeset
391 methods for CLASS."
105237
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
392 (let ((l nil) tree (cn (if class (symbol-name class) nil)))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
393 (mapatoms
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
394 (lambda (symbol)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
395 (setq tree (get symbol 'eieio-method-obarray))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
396 (if tree
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
397 (progn
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
398 ;; A symbol might be interned for that class in one of
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
399 ;; these three slots in the method-obarray.
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
400 (if (or (not class)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
401 (fboundp (intern-soft cn (aref tree 0)))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
402 (fboundp (intern-soft cn (aref tree 1)))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
403 (fboundp (intern-soft cn (aref tree 2))))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
404 (setq l (cons symbol l)))))))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
405 l))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
406
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
407 (defun eieio-method-documentation (generic class)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
408 "Return a list of the specific documentation of GENERIC for CLASS.
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
409 If there is not an explicit method for CLASS in GENERIC, or if that
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
410 function has no documentation, then return nil."
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
411 (let ((tree (get generic 'eieio-method-obarray))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
412 (cn (symbol-name class))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
413 before primary after)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
414 (if (not tree)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
415 nil
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
416 ;; A symbol might be interned for that class in one of
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
417 ;; these three slots in the method-obarray.
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
418 (setq before (intern-soft cn (aref tree 0))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
419 primary (intern-soft cn (aref tree 1))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
420 after (intern-soft cn (aref tree 2)))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
421 (if (not (or (fboundp before)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
422 (fboundp primary)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
423 (fboundp after)))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
424 nil
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
425 (list (if (fboundp before)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
426 (cons (eieio-lambda-arglist before)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
427 (documentation before))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
428 nil)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
429 (if (fboundp primary)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
430 (cons (eieio-lambda-arglist primary)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
431 (documentation primary))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
432 nil)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
433 (if (fboundp after)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
434 (cons (eieio-lambda-arglist after)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
435 (documentation after))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
436 nil))))))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
437
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
438 (defvar eieio-read-generic nil
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
439 "History of the `eieio-read-generic' prompt.")
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
440
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
441 (defun eieio-read-generic-p (fn)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
442 "Function used in function `eieio-read-generic'.
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
443 This is because `generic-p' is a macro.
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
444 Argument FN is the function to test."
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
445 (generic-p fn))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
446
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
447 (defun eieio-read-generic (prompt &optional historyvar)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
448 "Read a generic function from the minibuffer with PROMPT.
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
449 Optional argument HISTORYVAR is the variable to use as history."
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
450 (intern (completing-read prompt obarray 'eieio-read-generic-p
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
451 t nil (or historyvar 'eieio-read-generic))))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
452
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
453 ;;; METHOD STATS
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
454 ;;
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
455 ;; Dump out statistics about all the active methods in a session.
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
456 (defun eieio-display-method-list ()
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
457 "Display a list of all the methods and what features are used."
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
458 (interactive)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
459 (let* ((meth1 (eieio-all-generic-functions))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
460 (meth (sort meth1 (lambda (a b)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
461 (string< (symbol-name a)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
462 (symbol-name b)))))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
463 (buff (get-buffer-create "*EIEIO Method List*"))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
464 (methidx 0)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
465 (standard-output buff)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
466 (slots '(method-static
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
467 method-before
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
468 method-primary
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
469 method-after
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
470 method-generic-before
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
471 method-generic-primary
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
472 method-generic-after))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
473 (slotn '("static"
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
474 "before"
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
475 "primary"
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
476 "after"
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
477 "G bef"
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
478 "G prim"
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
479 "G aft"))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
480 (idxarray (make-vector (length slots) 0))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
481 (primaryonly 0)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
482 (oneprimary 0)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
483 )
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
484 (switch-to-buffer-other-window buff)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
485 (erase-buffer)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
486 (dolist (S slotn)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
487 (princ S)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
488 (princ "\t")
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
489 )
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
490 (princ "Method Name")
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
491 (terpri)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
492 (princ "--------------------------------------------------------------------")
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
493 (terpri)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
494 (dolist (M meth)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
495 (let ((mtree (get M 'eieio-method-tree))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
496 (P nil) (numP)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
497 (!P nil))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
498 (dolist (S slots)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
499 (let ((num (length (aref mtree (symbol-value S)))))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
500 (aset idxarray (symbol-value S)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
501 (+ num (aref idxarray (symbol-value S))))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
502 (prin1 num)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
503 (princ "\t")
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
504 (when (< 0 num)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
505 (if (eq S 'method-primary)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
506 (setq P t numP num)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
507 (setq !P t)))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
508 ))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
509 ;; Is this a primary-only impl method?
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
510 (when (and P (not !P))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
511 (setq primaryonly (1+ primaryonly))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
512 (when (= numP 1)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
513 (setq oneprimary (1+ oneprimary))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
514 (princ "*"))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
515 (princ "* ")
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
516 )
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
517 (prin1 M)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
518 (terpri)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
519 (setq methidx (1+ methidx))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
520 )
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
521 )
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
522 (princ "--------------------------------------------------------------------")
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
523 (terpri)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
524 (dolist (S slots)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
525 (prin1 (aref idxarray (symbol-value S)))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
526 (princ "\t")
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
527 )
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
528 (prin1 methidx)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
529 (princ " Total symbols")
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
530 (terpri)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
531 (dolist (S slotn)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
532 (princ S)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
533 (princ "\t")
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
534 )
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
535 (terpri)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
536 (terpri)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
537 (princ "Methods Primary Only: ")
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
538 (prin1 primaryonly)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
539 (princ "\t")
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
540 (princ (format "%d" (* (/ (float primaryonly) (float methidx)) 100)))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
541 (princ "% of total methods")
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
542 (terpri)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
543 (princ "Only One Primary Impl: ")
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
544 (prin1 oneprimary)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
545 (princ "\t")
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
546 (princ (format "%d" (* (/ (float oneprimary) (float primaryonly)) 100)))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
547 (princ "% of total primary methods")
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
548 (terpri)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
549 ))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
550
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
551 ;;; HELP AUGMENTATION
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
552 ;;
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
553 (defun eieio-help-mode-augmentation-maybee (&rest unused)
105474
0a64442c10e3 Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents: 105377
diff changeset
554 "For buffers thrown into help mode, augment for EIEIO.
105237
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
555 Arguments UNUSED are not used."
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
556 ;; Scan created buttons so far if we are in help mode.
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
557 (when (eq major-mode 'help-mode)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
558 (save-excursion
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
559 (goto-char (point-min))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
560 (let ((pos t) (inhibit-read-only t))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
561 (while pos
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
562 (if (get-text-property (point) 'help-xref) ; move off reference
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
563 (goto-char
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
564 (or (next-single-property-change (point) 'help-xref)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
565 (point))))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
566 (setq pos (next-single-property-change (point) 'help-xref))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
567 (when pos
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
568 (goto-char pos)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
569 (let* ((help-data (get-text-property (point) 'help-xref))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
570 ;(method (car help-data))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
571 (args (cdr help-data)))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
572 (when (symbolp (car args))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
573 (cond ((class-p (car args))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
574 (setcar help-data 'eieio-describe-class))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
575 ((generic-p (car args))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
576 (setcar help-data 'eieio-describe-generic))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
577 (t nil))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
578 ))))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
579 ;; start back at the beginning, and highlight some sections
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
580 (goto-char (point-min))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
581 (while (re-search-forward "^\\(Documentation\\|Implementations\\):$" nil t)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
582 (put-text-property (match-beginning 0) (match-end 0) 'face 'bold))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
583 (goto-char (point-min))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
584 (if (re-search-forward "^Specialized Methods:$" nil t)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
585 (put-text-property (match-beginning 0) (match-end 0) 'face 'bold))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
586 (goto-char (point-min))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
587 (while (re-search-forward "^\\(Instance\\|Class\\) Allocated Slots:$" nil t)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
588 (put-text-property (match-beginning 0) (match-end 0) 'face 'bold))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
589 (goto-char (point-min))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
590 (while (re-search-forward ":\\(STATIC\\|BEFORE\\|AFTER\\|PRIMARY\\)" nil t)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
591 (put-text-property (match-beginning 0) (match-end 0) 'face 'bold))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
592 (goto-char (point-min))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
593 (while (re-search-forward "^\\(Private \\)?Slot:" nil t)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
594 (put-text-property (match-beginning 0) (match-end 0) 'face 'bold))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
595 ))))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
596
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
597 ;;; SPEEDBAR SUPPORT
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
598 ;;
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
599 (eval-when-compile
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
600 (condition-case nil
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
601 (require 'speedbar)
105474
0a64442c10e3 Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents: 105377
diff changeset
602 (error (message "Error loading speedbar... ignored"))))
105237
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
603
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
604 (defvar eieio-class-speedbar-key-map nil
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
605 "Keymap used when working with a project in speedbar.")
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
606
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
607 (defun eieio-class-speedbar-make-map ()
105474
0a64442c10e3 Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents: 105377
diff changeset
608 "Make a keymap for EIEIO under speedbar."
105237
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
609 (setq eieio-class-speedbar-key-map (speedbar-make-specialized-keymap))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
610
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
611 ;; General viewing stuff
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
612 (define-key eieio-class-speedbar-key-map "\C-m" 'speedbar-edit-line)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
613 (define-key eieio-class-speedbar-key-map "+" 'speedbar-expand-line)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
614 (define-key eieio-class-speedbar-key-map "-" 'speedbar-contract-line)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
615 )
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
616
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
617 (if eieio-class-speedbar-key-map
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
618 nil
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
619 (if (not (featurep 'speedbar))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
620 (add-hook 'speedbar-load-hook (lambda ()
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
621 (eieio-class-speedbar-make-map)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
622 (speedbar-add-expansion-list
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
623 '("EIEIO"
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
624 eieio-class-speedbar-menu
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
625 eieio-class-speedbar-key-map
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
626 eieio-class-speedbar))))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
627 (eieio-class-speedbar-make-map)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
628 (speedbar-add-expansion-list '("EIEIO"
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
629 eieio-class-speedbar-menu
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
630 eieio-class-speedbar-key-map
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
631 eieio-class-speedbar))))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
632
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
633 (defvar eieio-class-speedbar-menu
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
634 ()
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
635 "Menu part in easymenu format used in speedbar while in `eieio' mode.")
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
636
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
637 (defun eieio-class-speedbar (dir-or-object depth)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
638 "Create buttons in speedbar that represents the current project.
105474
0a64442c10e3 Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents: 105377
diff changeset
639 DIR-OR-OBJECT is the object to expand, or nil, and DEPTH is the
0a64442c10e3 Fix typos.
Juanma Barranquero <lekktu@gmail.com>
parents: 105377
diff changeset
640 current expansion depth."
105237
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
641 (when (eq (point-min) (point-max))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
642 ;; This function is only called once, to start the whole deal.
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
643 ;; Ceate, and expand the default object.
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
644 (eieio-class-button eieio-default-superclass 0)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
645 (forward-line -1)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
646 (speedbar-expand-line)))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
647
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
648 (defun eieio-class-button (class depth)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
649 "Draw a speedbar button at the current point for CLASS at DEPTH."
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
650 (if (not (class-p class))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
651 (signal 'wrong-type-argument (list 'class-p class)))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
652 (let ((subclasses (aref (class-v class) class-children)))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
653 (if subclasses
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
654 (speedbar-make-tag-line 'angle ?+
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
655 'eieio-sb-expand
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
656 class
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
657 (symbol-name class)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
658 'eieio-describe-class-sb
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
659 class
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
660 'speedbar-directory-face
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
661 depth)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
662 (speedbar-make-tag-line 'angle ? nil nil
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
663 (symbol-name class)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
664 'eieio-describe-class-sb
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
665 class
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
666 'speedbar-directory-face
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
667 depth))))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
668
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
669 (defun eieio-sb-expand (text class indent)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
670 "For button TEXT, expand CLASS at the current location.
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
671 Argument INDENT is the depth of indentation."
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
672 (cond ((string-match "+" text) ;we have to expand this file
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
673 (speedbar-change-expand-button-char ?-)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
674 (speedbar-with-writable
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
675 (save-excursion
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
676 (end-of-line) (forward-char 1)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
677 (let ((subclasses (aref (class-v class) class-children)))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
678 (while subclasses
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
679 (eieio-class-button (car subclasses) (1+ indent))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
680 (setq subclasses (cdr subclasses)))))))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
681 ((string-match "-" text) ;we have to contract this node
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
682 (speedbar-change-expand-button-char ?+)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
683 (speedbar-delete-subblock indent))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
684 (t (error "Ooops... not sure what to do")))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
685 (speedbar-center-buffer-smartly))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
686
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
687 (defun eieio-describe-class-sb (text token indent)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
688 "Describe the class TEXT in TOKEN.
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
689 INDENT is the current indentation level."
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
690 (speedbar-with-attached-buffer
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
691 (eieio-describe-class token))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
692 (speedbar-maybee-jump-to-attached-frame))
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
693
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
694 (provide 'eieio-opt)
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
695
105377
7f4c7f5c0eba Add arch tagline
Miles Bader <miles@gnu.org>
parents: 105372
diff changeset
696 ;; arch-tag: 71eab5f5-462f-4fa1-8ed1-f5ca1bf9adb6
105237
1a62d24e31a6 * emacs-lisp/chart.el:
Chong Yidong <cyd@stupidchicken.com>
parents:
diff changeset
697 ;;; eieio-opt.el ends here