Mercurial > hg > xemacs-beta
comparison lisp/oobr/br-info.el @ 0:376386a54a3c r19-14
Import from CVS: tag r19-14
author | cvs |
---|---|
date | Mon, 13 Aug 2007 08:45:50 +0200 |
parents | |
children | 4103f0995bd7 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:376386a54a3c |
---|---|
1 ;;!emacs | |
2 ;; | |
3 ;; FILE: br-info.el | |
4 ;; SUMMARY: Support routines for Info file hierarchy browsing. | |
5 ;; USAGE: GNU Emacs Lisp Library | |
6 ;; KEYWORDS: docs, help, hypermedia | |
7 ;; | |
8 ;; AUTHOR: Bob Weiner | |
9 ;; ORG: Motorola Inc. | |
10 ;; | |
11 ;; ORIG-DATE: 7-Dec-89 | |
12 ;; LAST-MOD: 21-Sep-95 at 12:29:58 by Bob Weiner | |
13 ;; | |
14 ;; Copyright (C) 1989-1995 Free Software Foundation, Inc. | |
15 ;; See the file BR-COPY for license information. | |
16 ;; | |
17 ;; This file is part of the OO-Browser. | |
18 ;; | |
19 ;; DESCRIPTION: | |
20 ;; | |
21 ;; See 'info-class-def-regexp' for regular expression that matches class | |
22 ;; definitions. | |
23 ;; | |
24 ;; DESCRIP-END. | |
25 | |
26 ;;; ************************************************************************ | |
27 ;;; Other required Elisp libraries | |
28 ;;; ************************************************************************ | |
29 | |
30 (require 'br-lib) | |
31 | |
32 ;;; ************************************************************************ | |
33 ;;; User visible variables | |
34 ;;; ************************************************************************ | |
35 | |
36 (defvar info-lib-search-dirs nil | |
37 "List of directories below which Info Library source files are found. | |
38 Subdirectories of Library source are also searched. A Library is a stable | |
39 group of classes.") | |
40 | |
41 (defvar info-sys-search-dirs nil | |
42 "List of directories below which Info System source files are found. | |
43 Subdirectories of System source are also searched. A System class is one | |
44 that is not yet reusable and is likely to change before release.") | |
45 | |
46 (defconst info-narrow-view-to-class t | |
47 "*Non-nil means narrow buffer to just the matching class definition when displayed.") | |
48 | |
49 ;;; ************************************************************************ | |
50 ;;; Internal functions | |
51 ;;; ************************************************************************ | |
52 | |
53 (defun info-find-nd (filename node edit) | |
54 "Show (FILENAME)NODE in current window. | |
55 If EDIT is non-nil, NODE is made editable." | |
56 (if (string-match "-[1-9][0-9]*$" filename) | |
57 (setq filename (substring filename 0 (match-beginning 0))) ) | |
58 (Info-find-node filename node t) | |
59 (if edit (let ((Info-enable-edit t)) | |
60 (Info-edit)))) | |
61 | |
62 (defun info-get-classes-from-source (filename &rest ignore) | |
63 "Scans FILENAME and returns cons of class list with parents-class alist. | |
64 Handles multiple inheritance. Assumes file existence and readability have | |
65 already been checked." | |
66 (let ((no-kill (get-file-buffer filename)) | |
67 classes class parents parent-cons) | |
68 (if no-kill | |
69 (set-buffer no-kill) | |
70 (funcall br-view-file-function filename)) | |
71 (save-restriction | |
72 (save-excursion | |
73 (widen) | |
74 (goto-char (point-min)) | |
75 (while (re-search-forward info-class-def-regexp nil t) | |
76 (setq class (buffer-substring (match-beginning 1) (match-end 1)) | |
77 parent-cons | |
78 (cons | |
79 (if (looking-at info-parent-regexp) | |
80 (list (buffer-substring | |
81 (match-beginning 1) | |
82 (match-end 1)))) | |
83 class) | |
84 classes (cons class classes) | |
85 parents (cons parent-cons parents))))) | |
86 (or no-kill (kill-buffer (current-buffer))) | |
87 (cons classes (delq nil parents)))) | |
88 | |
89 (defun info-get-parents-from-source (filename class-name) | |
90 "Scan source in FILENAME and return list of parents of CLASS-NAME. | |
91 Assume file existence has already been checked." | |
92 (or (null class-name) | |
93 (car (car (br-rassoc | |
94 class-name | |
95 (cdr (info-get-classes-from-source filename))))))) | |
96 | |
97 (defun info-select-path (paths-htable-elt &optional feature-p) | |
98 "Select proper pathname from PATHS-HTABLE-ELT based upon value of optional FEATURE-P. | |
99 Selection is between path of class definition and path for features associated | |
100 with the class." | |
101 (cdr paths-htable-elt)) | |
102 | |
103 (defun info-set-case (type) | |
104 "Return string TYPE identifier for use as a class name." | |
105 type) | |
106 | |
107 (defun info-set-case-type (class-name) | |
108 "Return string CLASS-NAME for use as a type identifier." | |
109 class-name) | |
110 | |
111 (defun info-to-class-end () | |
112 "Assuming point is at start of node, move to start of line after end of node." | |
113 (interactive) | |
114 (skip-chars-forward " \t\n") | |
115 (if (re-search-forward "[]" nil t) | |
116 (beginning-of-line) | |
117 (goto-char (point-max)))) | |
118 | |
119 (defun info-to-comments-begin () | |
120 "Skip back from current point past any preceding Info comments." | |
121 (skip-chars-forward " \t\n")) | |
122 | |
123 ;;; ************************************************************************ | |
124 ;;; Internal variables | |
125 ;;; ************************************************************************ | |
126 | |
127 (defconst info-class-name-before | |
128 "?[\n][\n\t ]*.*Node:[ \t]+" | |
129 "Regexp preceding the class name in a class definition.") | |
130 | |
131 (defconst info-identifier-chars "-_()a-zA-Z0-9 " | |
132 "String of chars and char ranges that may be used within an Info identifier.") | |
133 | |
134 (defconst info-identifier (concat "\\([a-zA-Z0-9()][" info-identifier-chars "]*\\)") | |
135 "Regular expression matching an Info identifier.") | |
136 | |
137 (defconst info-class-name-after | |
138 "[\t,\n]+" | |
139 "Regexp following the class name in a class definition.") | |
140 | |
141 (defconst info-class-def-regexp | |
142 (concat info-class-name-before info-identifier info-class-name-after) | |
143 "Regular expression used to match to class definitions in source text. | |
144 Class name identifier is grouped expression 1.") | |
145 | |
146 (defconst info-parent-regexp | |
147 (concat ".*Up:[ \t]+" info-identifier) | |
148 "Regular expression whose grouping number 1 matches Info parent identifier.") | |
149 | |
150 (defconst info-lang-prefix "info-" | |
151 "Prefix string that starts \"br-info.el\" symbol names.") | |
152 | |
153 (defconst info-src-file-regexp ".$" | |
154 "Regular expression matching a unique part of Info source.") | |
155 | |
156 (defvar info-children-htable nil | |
157 "Htable whose elements are of the form: (LIST-OF-CHILD-CLASSES . CLASS-NAME). | |
158 Used to traverse Info inheritance graph. 'br-build-children-htable' builds | |
159 this list.") | |
160 (defvar info-parents-htable nil | |
161 "Htable whose elements are of the form: (LIST-OF-PARENT-CLASSES . CLASS-NAME). | |
162 Used to traverse Info inheritance graph. 'br-build-parents-htable' builds | |
163 this list.") | |
164 (defvar info-paths-htable nil | |
165 "Htable whose elements are of the form: (LIST-OF-CLASS-NAMES . FILE-PATH). | |
166 FILE-PATH gives the location of classes found in LIST-OF-CLASS-NAMES. | |
167 'br-build-paths-htable' builds this list.") | |
168 | |
169 | |
170 (defvar info-lib-parents-htable nil | |
171 "Htable whose elements are of the form: (LIST-OF-PARENT-CLASSES . CLASS-NAME). | |
172 Only classes from stable software libraries are used to build the list.") | |
173 (defvar info-lib-paths-htable nil | |
174 "Htable whose elements are of the form: (LIST-OF-CLASS-NAMES . FILE-PATH). | |
175 FILE-PATH gives the location of classes found in LIST-OF-CLASS-NAMES. | |
176 Only classes from stable software libraries are used to build the list.") | |
177 | |
178 (defvar info-sys-parents-htable nil | |
179 "Htable whose elements are of the form: (LIST-OF-PARENT-CLASSES . CLASS-NAME). | |
180 Only classes from systems that are likely to change are used to build the list.") | |
181 (defvar info-sys-paths-htable nil | |
182 "Alist whose elements are of the form: (LIST-OF-CLASS-NAMES . FILE-PATH). | |
183 FILE-PATH gives the location of classes found in LIST-OF-CLASS-NAMES. | |
184 Only classes from systems that are likely to change are used to build the | |
185 list.") | |
186 | |
187 (defvar info-lib-prev-search-dirs nil | |
188 "Used to check if 'info-lib-classes-htable' must be regenerated.") | |
189 (defvar info-sys-prev-search-dirs nil | |
190 "Used to check if 'info-sys-classes-htable' must be regenerated.") | |
191 | |
192 (defvar info-env-spec nil | |
193 "Non-nil value means Environment specification has been given but not yet built. | |
194 Nil means current Environment has been built, though it may still require updating.") | |
195 | |
196 (provide 'br-info) |