Mercurial > emacs
annotate lisp/eieio/eieio-doc.el @ 104425:4d608806c00b
cedet/semantic/symref/idutils.el: Fix require statement.
author | Chong Yidong <cyd@stupidchicken.com> |
---|---|
date | Sat, 29 Aug 2009 22:14:05 +0000 |
parents | 7602fd69cd93 |
children |
rev | line source |
---|---|
104401
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
1 ;;; eieio-doc.el --- create texinfo documentation for an eieio class |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
2 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
3 ;;; Copyright (C) 1996, 1998, 1999, 2000, 2001, 2004, 2005 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
4 ;;; Free Software Foundation, Inc. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
5 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
6 ;; Author: Eric M. Ludlam <zappo@gnu.org> |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
7 ;; Version: 0.2 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
8 ;; Keywords: OO, lisp, docs |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
9 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
10 ;; This file is part of GNU Emacs. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
11 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
12 ;; GNU Emacs is free software: you can redistribute it and/or modify |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
13 ;; it under the terms of the GNU General Public License as published by |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
14 ;; the Free Software Foundation, either version 3 of the License, or |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
15 ;; (at your option) any later version. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
16 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
17 ;; GNU Emacs is distributed in the hope that it will be useful, |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
20 ;; GNU General Public License for more details. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
21 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
22 ;; You should have received a copy of the GNU General Public License |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
23 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
24 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
25 ;;; Commentary: |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
26 ;; |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
27 ;; Outputs into the current buffer documentation in texinfo format |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
28 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
29 (require 'eieio-opt) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
30 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
31 ;; for a class, all it's children, and all it's slots. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
32 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
33 ;;; Code: |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
34 (defvar eieiodoc-currently-in-node nil |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
35 "String representing the node we go BACK to.") |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
36 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
37 (defvar eieiodoc-current-section-level nil |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
38 "String represending what type of section header to use.") |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
39 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
40 (defvar eieiodoc-prev-class nil |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
41 "Non-nil when while `eieiodoc-recurse' is running. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
42 Can be referenced from the recursed function.") |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
43 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
44 (defvar eieiodoc-next-class nil |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
45 "Non-nil when `eieiodoc-recurse' is running. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
46 Can be referenced from the recursed function.") |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
47 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
48 (defun eieiodoc-class-nuke (root-class indexstring &optional skiplist) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
49 "Call `eieiodoc-class' after nuking everything from POINT on. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
50 ROOT-CLASS, INDEXSTRING, and SKIPLIST are the same as `eieiodoc-class'." |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
51 (delete-region (point) (point-max)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
52 (sit-for 0) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
53 (eieiodoc-class root-class indexstring skiplist)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
54 |
104404
7602fd69cd93
eieio-doc.el (eieiodoc--class-indexstring, defvar eieiodoc--class-root): New vars.
Chong Yidong <cyd@stupidchicken.com>
parents:
104401
diff
changeset
|
55 (defvar eieiodoc--class-indexstring) |
7602fd69cd93
eieio-doc.el (eieiodoc--class-indexstring, defvar eieiodoc--class-root): New vars.
Chong Yidong <cyd@stupidchicken.com>
parents:
104401
diff
changeset
|
56 (defvar eieiodoc--class-root) |
7602fd69cd93
eieio-doc.el (eieiodoc--class-indexstring, defvar eieiodoc--class-root): New vars.
Chong Yidong <cyd@stupidchicken.com>
parents:
104401
diff
changeset
|
57 |
104401
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
58 (defun eieiodoc-class (root-class indexstring &optional skiplist) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
59 "Create documentation starting with ROOT-CLASS. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
60 The first job is to create an indented menu of all the classes |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
61 starting with `root-class' and including all it's children. Once this |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
62 is done, @nodes are created for all the subclasses. Each node is then |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
63 documented with a description of the class, a brief inheritance tree |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
64 \(with xrefs) and a list of all slots in a big table. Where each slot |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
65 is inherited from is also documented. In addition, each class is |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
66 documented in the index referenced by INDEXSTRING, a two letter code |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
67 described in the texinfo manual. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
68 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
69 The optional third argument SKIPLIST is a list of object not to put |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
70 into any menus, nodes or lists." |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
71 (interactive |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
72 (list (intern-soft |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
73 (completing-read "Class: " (eieio-build-class-alist) nil t)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
74 (read-string "Index name (2 chars): "))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
75 (if (looking-at "[ \t\n]+@end ignore") |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
76 (goto-char (match-end 0))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
77 (save-excursion |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
78 (setq eieiodoc-currently-in-node |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
79 (if (re-search-backward "@node \\([^,]+\\)" nil t) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
80 (buffer-substring (match-beginning 1) (match-end 1)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
81 "Top") |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
82 eieiodoc-current-section-level |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
83 (if (re-search-forward "@\\(chapter\\|\\(sub\\)*section\\)" |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
84 (+ (point) 500) t) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
85 (progn |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
86 (goto-char (match-beginning 0)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
87 (cond ((looking-at "@chapter") "section") |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
88 ((looking-at "@section") "subsection") |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
89 ((looking-at "@\\(sub\\)+section") "subsubsection") |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
90 (t "subsubsection"))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
91 "subsubsection"))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
92 (save-excursion |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
93 (eieiodoc-main-menu root-class skiplist) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
94 (insert "\n") |
104404
7602fd69cd93
eieio-doc.el (eieiodoc--class-indexstring, defvar eieiodoc--class-root): New vars.
Chong Yidong <cyd@stupidchicken.com>
parents:
104401
diff
changeset
|
95 (let ((eieiodoc--class-indexstring indexstring) |
7602fd69cd93
eieio-doc.el (eieiodoc--class-indexstring, defvar eieiodoc--class-root): New vars.
Chong Yidong <cyd@stupidchicken.com>
parents:
104401
diff
changeset
|
96 (eieiodoc--class-root root-class)) |
7602fd69cd93
eieio-doc.el (eieiodoc--class-indexstring, defvar eieiodoc--class-root): New vars.
Chong Yidong <cyd@stupidchicken.com>
parents:
104401
diff
changeset
|
97 (eieiodoc-recurse root-class 'eieiodoc-one-node nil skiplist)))) |
104401
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
98 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
99 (defun eieiodoc-main-menu (class skiplist) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
100 "Create a menu of all classes under CLASS indented the correct amount. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
101 SKIPLIST is a list of objects to skip" |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
102 (end-of-line) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
103 (insert "\n@menu\n") |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
104 (eieiodoc-recurse class (lambda (class level) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
105 (insert "* " (make-string level ? ) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
106 (symbol-name class) " ::\n")) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
107 nil skiplist) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
108 (insert "@end menu\n")) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
109 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
110 (defun eieiodoc-one-node (class level) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
111 "Create a node for CLASS, and for all subclasses of CLASS in order. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
112 This function should only be called by `eieiodoc-class' |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
113 Argument LEVEL is the current level of recursion we have hit." |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
114 (message "Building node for %s" class) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
115 (insert "\n@node " (symbol-name class) ", " |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
116 (if eieiodoc-next-class (symbol-name eieiodoc-next-class) " ") ", " |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
117 (if eieiodoc-prev-class (symbol-name eieiodoc-prev-class) " ") ", " |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
118 eieiodoc-currently-in-node "\n" |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
119 "@comment node-name, next, previous, up\n" |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
120 "@" eieiodoc-current-section-level " " (symbol-name class) "\n" |
104404
7602fd69cd93
eieio-doc.el (eieiodoc--class-indexstring, defvar eieiodoc--class-root): New vars.
Chong Yidong <cyd@stupidchicken.com>
parents:
104401
diff
changeset
|
121 "@" eieiodoc--class-indexstring |
7602fd69cd93
eieio-doc.el (eieiodoc--class-indexstring, defvar eieiodoc--class-root): New vars.
Chong Yidong <cyd@stupidchicken.com>
parents:
104401
diff
changeset
|
122 "index " (symbol-name class) "\n\n") |
104401
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
123 ;; Now lets create a nifty little inheritance tree |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
124 (let ((cl class) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
125 (revlist nil) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
126 (depth 0)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
127 (while cl |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
128 (setq revlist (cons cl revlist) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
129 cl (class-parent cl))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
130 (insert "@table @asis\n@item Inheritance Tree:\n") |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
131 (while revlist |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
132 (insert "@table @code\n@item " |
104404
7602fd69cd93
eieio-doc.el (eieiodoc--class-indexstring, defvar eieiodoc--class-root): New vars.
Chong Yidong <cyd@stupidchicken.com>
parents:
104401
diff
changeset
|
133 (if (and (child-of-class-p (car revlist) eieiodoc--class-root) |
104401
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
134 (not (eq class (car revlist)))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
135 (concat "@w{@xref{" (symbol-name (car revlist)) "}.}") |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
136 (symbol-name (car revlist))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
137 "\n") |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
138 (setq revlist (cdr revlist) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
139 depth (1+ depth))) |
104404
7602fd69cd93
eieio-doc.el (eieiodoc--class-indexstring, defvar eieiodoc--class-root): New vars.
Chong Yidong <cyd@stupidchicken.com>
parents:
104401
diff
changeset
|
140 (let ((clist (reverse (aref (class-v class) class-children)))) |
104401
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
141 (if (not clist) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
142 (insert "No children") |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
143 (insert "@table @asis\n@item Children:\n") |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
144 (while clist |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
145 (insert "@w{@xref{" (symbol-name (car clist)) "}") |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
146 (if (cdr clist) (insert ",") (insert ".")) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
147 (insert "} ") |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
148 (setq clist (cdr clist))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
149 (insert "\n@end table\n") |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
150 )) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
151 (while (> depth 0) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
152 (insert "\n@end table\n") |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
153 (setq depth (1- depth))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
154 (insert "@end table\n\n ")) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
155 ;; Now lets build some documentation by extracting information from |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
156 ;; the class description vector |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
157 (let* ((cv (class-v class)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
158 (docs (aref cv class-public-doc)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
159 (names (aref cv class-public-a)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
160 (deflt (aref cv class-public-d)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
161 (prot (aref cv class-protection)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
162 (typev (aref cv class-public-type)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
163 (i 0) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
164 (set-one nil) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
165 (anchor nil) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
166 ) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
167 ;; doc of the class itself |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
168 (insert (eieiodoc-texify-docstring (documentation class) class) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
169 "\n\n@table @asis\n") |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
170 (if names |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
171 (progn |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
172 (setq anchor (point)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
173 (insert "@item Slots:\n\n@table @code\n") |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
174 (while names |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
175 (if (eieiodoc-one-attribute class (car names) (car docs) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
176 (car prot) (car deflt) (aref typev i)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
177 (setq set-one t)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
178 (setq names (cdr names) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
179 docs (cdr docs) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
180 prot (cdr prot) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
181 deflt (cdr deflt) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
182 i (1+ i))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
183 (insert "@end table\n\n") |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
184 (if (not set-one) (delete-region (point) anchor)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
185 )) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
186 (insert "@end table\n") |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
187 ;; Finally, document all the methods associated with this class. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
188 (let ((methods (eieio-all-generic-functions class)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
189 (doc nil)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
190 (if (not methods) nil |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
191 (if (string= eieiodoc-current-section-level "subsubsection") |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
192 (insert "@" eieiodoc-current-section-level) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
193 (insert "@sub" eieiodoc-current-section-level)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
194 (insert " Specialized Methods\n\n") |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
195 (while methods |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
196 (setq doc (eieio-method-documentation (car methods) class)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
197 (insert "@deffn Method " (symbol-name (car methods))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
198 (if (not doc) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
199 (insert "\n Undocumented") |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
200 (if (car doc) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
201 (progn |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
202 (insert " :BEFORE ") |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
203 (eieiodoc-output-deffn-args (car (car doc))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
204 (insert "\n") |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
205 (eieiodoc-insert-and-massage-docstring-with-args |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
206 (cdr (car doc)) (car (car doc)) class))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
207 (setq doc (cdr doc)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
208 (if (car doc) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
209 (progn |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
210 (insert " :PRIMARY ") |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
211 (eieiodoc-output-deffn-args (car (car doc))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
212 (insert "\n") |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
213 (eieiodoc-insert-and-massage-docstring-with-args |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
214 (cdr (car doc)) (car (car doc)) class))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
215 (setq doc (cdr doc)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
216 (if (car doc) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
217 (progn |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
218 (insert " :AFTER ") |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
219 (eieiodoc-output-deffn-args (car (car doc))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
220 (insert "\n") |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
221 (eieiodoc-insert-and-massage-docstring-with-args |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
222 (cdr (car doc)) (car (car doc)) class))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
223 (insert "\n@end deffn\n\n")) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
224 (setq methods (cdr methods))))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
225 )) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
226 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
227 (defun eieiodoc-insert-and-massage-docstring-with-args (doc arglst class) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
228 "Update DOC with texinfo strings using ARGLST with @var. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
229 Argument CLASS is the class passed to `eieiodoc-texify-docstring'." |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
230 (let ((start (point)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
231 (end nil) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
232 (case-fold-search nil)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
233 ;; Insert the text |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
234 (insert (eieiodoc-texify-docstring doc class)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
235 (setq end (point)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
236 (save-restriction |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
237 (narrow-to-region start end) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
238 (save-excursion |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
239 ;; Now find arguments |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
240 (while arglst |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
241 (goto-char (point-min)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
242 (while (re-search-forward (upcase (symbol-name (car arglst))) nil t) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
243 (replace-match "@var{\\&}" t)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
244 (setq arglst (cdr arglst))))))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
245 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
246 (defun eieiodoc-output-deffn-args (arglst) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
247 "Output ARGLST for a deffn." |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
248 (while arglst |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
249 (insert (symbol-name (car arglst)) " ") |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
250 (setq arglst (cdr arglst)))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
251 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
252 (defun eieiodoc-one-attribute (class attribute doc priv deflt type) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
253 "Create documentation of CLASS for a single ATTRIBUTE. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
254 Assume this attribute is inside a table, so it is initiated with the |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
255 @item indicator. If this attribute is not inserted (because it is |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
256 contained in the parent) then return nil, else return t. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
257 DOC is the documentation to use, PRIV is non-nil if it is a private slot, |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
258 and DEFLT is the default value. TYPE is the symbol describing what type |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
259 validation is done on that slot." |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
260 (let ((pv (eieiodoc-parent-diff class attribute)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
261 (ia (eieio-attribute-to-initarg class attribute)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
262 (set-me nil)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
263 (if (or (eq pv t) (not ia)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
264 nil ;; same in parent or no init arg |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
265 (setq set-me t) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
266 (insert "@item " (if priv "Private: " "") |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
267 (symbol-name ia)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
268 (if (and type (not (eq type t))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
269 (insert "\nType: @code{" (format "%S" type) "}")) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
270 (if (not (eq deflt eieio-unbound)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
271 (insert " @*\nDefault Value: @code{"(format "%S" deflt) "}")) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
272 (insert "\n\n") |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
273 (if (eq pv 'default) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
274 ;; default differs only, xref the parent |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
275 ;; This should be upgraded to actually search for the last |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
276 ;; differing default (or the original.) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
277 (insert "@xref{" (symbol-name (class-parent class)) "}.\n") |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
278 (insert (if doc (eieiodoc-texify-docstring doc class) "Not Documented") |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
279 "\n@refill\n\n"))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
280 set-me)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
281 ;;; |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
282 ;; Utilities |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
283 ;; |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
284 (defun eieiodoc-recurse (rclass func &optional level skiplist) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
285 "Recurse down all children of RCLASS, calling FUNC on each one. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
286 LEVEL indicates the current depth below the first call we are. The |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
287 function FUNC will be called with RCLASS and LEVEL. This will then |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
288 recursivly call itself once for each child class of RCLASS. The |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
289 optional fourth argument SKIPLIST is a list of objects to ignore while |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
290 recursing." |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
291 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
292 (if (not level) (setq level 0)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
293 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
294 ;; we reverse the children so they appear in the same order as it |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
295 ;; does in the code that creates them. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
296 (let* ((children (reverse (aref (class-v rclass) class-children))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
297 (ocnc eieiodoc-next-class) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
298 (eieiodoc-next-class (or (car children) ocnc)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
299 (eieiodoc-prev-class eieiodoc-prev-class)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
300 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
301 (if (not (member rclass skiplist)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
302 (progn |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
303 (apply func (list rclass level)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
304 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
305 (setq eieiodoc-prev-class rclass))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
306 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
307 (while children |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
308 (setq eieiodoc-next-class (or (car (cdr children)) ocnc)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
309 (setq eieiodoc-prev-class (eieiodoc-recurse (car children) func (1+ level))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
310 (setq children (cdr children))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
311 ;; return the previous class so that the prev/next node gets it right |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
312 eieiodoc-prev-class)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
313 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
314 (defun eieiodoc-parent-diff (class slot) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
315 "Return nil if the parent of CLASS does not have slot SLOT. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
316 Return t if it does, and return 'default if the default has changed." |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
317 (let ((df nil) (err t) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
318 (scoped-class (class-parent class)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
319 (eieio-skip-typecheck)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
320 (condition-case nil |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
321 (setq df (eieio-oref-default (class-parent class) slot) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
322 err nil) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
323 (invalid-slot-name (setq df nil)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
324 (error (setq df nil))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
325 (if err |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
326 nil |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
327 (if (equal df (eieio-oref-default class slot)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
328 t |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
329 'default)))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
330 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
331 (defun eieiodoc-texify-docstring (string class) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
332 "Take STRING, (a normal doc string), and convert it into a texinfo string. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
333 For instances where CLASS is the class being referenced, do not Xref |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
334 that class. |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
335 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
336 `function' => @dfn{function} |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
337 `variable' => @code{variable} |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
338 `class' => @code{class} @xref{class} |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
339 `unknown' => @code{unknonwn} |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
340 'quoteme => @code{quoteme} |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
341 non-nil => non-@code{nil} |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
342 t => @code{t} |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
343 :tag => @code{:tag} |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
344 [ stuff ] => @code{[ stuff ]} |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
345 Key => @kbd{Key}" |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
346 (while (string-match "`\\([-a-zA-Z0-9]+\\)'" string) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
347 (let* ((vs (substring string (match-beginning 1) (match-end 1))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
348 (v (intern-soft vs))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
349 (setq string |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
350 (concat |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
351 (replace-match (concat |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
352 (if (and (not (class-p v))(fboundp v)) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
353 "@dfn{" "@code{") |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
354 vs "}" |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
355 (if (and (class-p v) (not (eq v class))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
356 (concat " @xref{" vs "}."))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
357 nil t string))))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
358 (while (string-match "\\( \\|^\\|-\\)\\(nil\\|t\\|'[-a-zA-Z0-9]+\\|:[-a-zA-Z0-9]+\\)\\([ ,]\\|$\\)" string) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
359 (setq string (replace-match "@code{\\2}" t nil string 2))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
360 (while (string-match "\\( \\|^\\)\\(\\[[^]]+\\]\\)\\( \\|$\\)" string) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
361 (setq string (replace-match "@code{\\2}" t nil string 2))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
362 (while (string-match "\\( \\|^\\)\\(\\(\\(C-\\|M-\\|S-\\)+\\([^ \t\n]\\|RET\\|SPC\\|TAB\\)\\)\\|\\(RET\\|SPC\\|TAB\\)\\)\\( \\|$\\)" string) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
363 (setq string (replace-match "@kbd{\\2}" t nil string 2))) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
364 string) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
365 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
366 (provide 'eieio-doc) |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
367 |
2efe3dc24373
Add files for the EIEIO library.
Chong Yidong <cyd@stupidchicken.com>
parents:
diff
changeset
|
368 ;;; eieio-doc.el ends here |