comparison lisp/oobr/br.el @ 100:4be1180a9e89 r20-1b2

Import from CVS: tag r20-1b2
author cvs
date Mon, 13 Aug 2007 09:15:11 +0200
parents 131b0175ea99
children cca96a509cfe
comparison
equal deleted inserted replaced
99:2d83cbd90d8d 100:4be1180a9e89
4 ;; SUMMARY: Browse object-oriented code. 4 ;; SUMMARY: Browse object-oriented code.
5 ;; USAGE: GNU Emacs Lisp Library 5 ;; USAGE: GNU Emacs Lisp Library
6 ;; KEYWORDS: matching, oop, tools 6 ;; KEYWORDS: matching, oop, tools
7 ;; 7 ;;
8 ;; AUTHOR: Bob Weiner 8 ;; AUTHOR: Bob Weiner
9 ;; ORG: Motorola Inc. 9 ;; ORG: InfoDock Associates
10 ;; 10 ;;
11 ;; ORIG-DATE: 12-Dec-89 11 ;; ORIG-DATE: 12-Dec-89
12 ;; LAST-MOD: 21-Sep-95 at 12:39:17 by Bob Weiner 12 ;; LAST-MOD: 21-Feb-97 at 16:45:11 by Bob Weiner
13 ;; 13 ;;
14 ;; Copyright (C) 1989-1995 Free Software Foundation, Inc. 14 ;; Copyright (C) 1989-1996 Free Software Foundation, Inc.
15 ;; See the file BR-COPY for license information. 15 ;; See the file BR-COPY for license information.
16 ;; 16 ;;
17 ;; This file is part of the OO-Browser. 17 ;; This file is part of the OO-Browser.
18 ;; 18 ;;
19 ;; DESCRIPTION: 19 ;; DESCRIPTION:
59 59
60 (defconst br-min-width-window 25 60 (defconst br-min-width-window 25
61 "*Minimum width of a browser class list window. 61 "*Minimum width of a browser class list window.
62 This together with the frame width determines the number of such windows.") 62 This together with the frame width determines the number of such windows.")
63 63
64 ;; -f treats upper and lower case the same in sorting, also makes 'a' sort 64 ;; -f treats upper and lower case the same in sorting, also makes `a' sort
65 ;; list before '[a]', so default classes appear at the end of the list, 65 ;; list before `[a]', so default classes appear at the end of the list,
66 ;; typically. 66 ;; typically.
67 ;; -u leaves only unique elements in the sorted list 67 ;; -u leaves only unique elements in the sorted list
68 (defvar br-sort-options "-fu" 68 (defvar br-sort-options "-fu"
69 "*String of options to send to the operating system `sort' command. 69 "*String of options to send to the operating system `sort' command.
70 Use nil for none. This is used by the OO-Browser (br-order) command only 70 Use nil for none. This is used by the OO-Browser (br-order) command only
112 (set-window-configuration *br-save-wconfig*) 112 (set-window-configuration *br-save-wconfig*)
113 (br-window-setup) 113 (br-window-setup)
114 (if br-inhibit-version 114 (if br-inhibit-version
115 (br-top-classes t) 115 (br-top-classes t)
116 (br-version) 116 (br-version)
117 (message "Press {h} for for help.") 117 (message "Press {h} for help; use {C-c #} to see version and credits again.")
118 ;; Display all classes. 118 ;; Display all classes.
119 (br-top-classes t) 119 (br-top-classes t)
120 (message "Press {h} for for help.") 120 (message "Press {h} for help; use {C-c #} to see version and credits again.")
121 ;; Wait for 60 seconds or until a single key sequence is given. 121 ;; Wait for 60 seconds or until a single key sequence is given.
122 (sit-for 60) 122 (sit-for 60)
123 (message "")) 123 (message ""))
124 (br-help)) 124 (br-help))
125 (run-hooks 'br-mode-hook 125 (run-hooks 'br-mode-hook
130 "Add a file of classes to the current Environment. 130 "Add a file of classes to the current Environment.
131 Interactively or when optional CLASS-PATH is nil, CLASS-PATH defaults to the 131 Interactively or when optional CLASS-PATH is nil, CLASS-PATH defaults to the
132 current buffer file pathname. If optional LIB-TABLE-P is non-nil, add to 132 current buffer file pathname. If optional LIB-TABLE-P is non-nil, add to
133 Library Environment, otherwise add to System Environment. If optional 133 Library Environment, otherwise add to System Environment. If optional
134 SAVE-FILE is t, the Environment is then stored to the filename given by 134 SAVE-FILE is t, the Environment is then stored to the filename given by
135 'br-env-file'. If SAVE-FILE is non-nil and not t, its string value is used 135 `br-env-file'. If SAVE-FILE is non-nil and not t, its string value is used
136 as the file to which to save the Environment." 136 as the file to which to save the Environment."
137 (interactive 137 (interactive
138 (list (read-file-name (concat "Class file name to add" 138 (list (read-file-name (concat "Class file name to add"
139 (if buffer-file-name 139 (if buffer-file-name
140 (concat " (default \"" 140 (concat " (default \""
189 ((br-env-save save-file)))) 189 ((br-env-save save-file))))
190 190
191 (defun br-ancestors (&optional arg features-flag) 191 (defun br-ancestors (&optional arg features-flag)
192 "Display ancestor tree whose root is the current class. 192 "Display ancestor tree whose root is the current class.
193 With optional prefix ARG, display all ancestor trees whose roots are in the 193 With optional prefix ARG, display all ancestor trees whose roots are in the
194 current listing. If ARG = -1 or 'br-invert-ancestors' is t, the current 194 current listing. If ARG = -1 or `br-invert-ancestors' is t, the current
195 class ancestry tree is inverted. That is, it shows branches going down 195 class ancestry tree is inverted. That is, it shows branches going down
196 towards the root class, so that parents appear above children. If ARG < -1 or 196 towards the root class, so that parents appear above children. If ARG < -1 or
197 'br-invert-ancestors' is t and ARG > 1, then the ancestry trees of all 197 `br-invert-ancestors' is t and ARG > 1, then the ancestry trees of all
198 classes in the current listing are inverted. 198 classes in the current listing are inverted.
199 199
200 Optional second argument, FEATURES-FLAG non-nil means display features under 200 Optional second argument, FEATURES-FLAG non-nil means display features under
201 each ancestor class." 201 each ancestor class."
202 (interactive "p") 202 (interactive "p")
286 has-categories (or has-categories 286 has-categories (or has-categories
287 class-and-categories)) 287 class-and-categories))
288 (cons class class-and-categories))) 288 (cons class class-and-categories)))
289 class-list))) 289 class-list)))
290 (cond ((not class-list) 290 (cond ((not class-list)
291 (message "(OO-Browser): Apply 'br-categories' to a class.") (beep)) 291 (message "(OO-Browser): Apply `br-categories' to a class.") (beep))
292 ((not has-categories) 292 ((not has-categories)
293 (message "No class categories.") (beep)) 293 (message "No class categories.") (beep))
294 (t 294 (t
295 (br-add-level-hist) 295 (br-add-level-hist)
296 (br-next-buffer nil) 296 (br-next-buffer nil)
330 has-children 330 has-children
331 (or has-children children)) 331 (or has-children children))
332 (cons parent children))) 332 (cons parent children)))
333 class-list))) 333 class-list)))
334 (cond ((not children-list) 334 (cond ((not children-list)
335 (message "(OO-Browser): Apply 'br-children' to a class.") 335 (message "(OO-Browser): Apply `br-children' to a class.")
336 (beep)) 336 (beep))
337 ((not has-children) 337 ((not has-children)
338 (message "No children.") (beep)) 338 (message "No children.") (beep))
339 (t 339 (t
340 (br-add-level-hist) 340 (br-add-level-hist)
467 (t (error "(OO-Browser): No entry for current line in current Environment")))))) 467 (t (error "(OO-Browser): No entry for current line in current Environment"))))))
468 468
469 (defun br-edit (&optional prompt class) 469 (defun br-edit (&optional prompt class)
470 "Edit a class in the viewer window. 470 "Edit a class in the viewer window.
471 Select viewer window. With optional prefix arg PROMPT, prompt for class 471 Select viewer window. With optional prefix arg PROMPT, prompt for class
472 name. Optional CLASS is the one to edit." 472 name. Optional CLASS is the one to edit. Return t if class is displayed or
473 sent to an external viewer, else nil."
473 (interactive "P") 474 (interactive "P")
474 (or br-editor-cmd 475 (or br-editor-cmd
475 (br-in-view-window-p) 476 (br-in-view-window-p)
476 (setq *br-prev-listing-window* (selected-window))) 477 (setq *br-prev-listing-window* (selected-window)))
477 (br-view prompt t class)) 478 (br-view prompt t class))
478 479
479 (defun br-edit-ext (editor-cmd file) 480 (defun br-edit-ext (editor-cmd file)
480 "Invoke a non-standard EDITOR-CMD on FILE. 481 "Invoke a non-standard EDITOR-CMD on FILE.
481 See also 'br-editor-cmd'." 482 See also `br-editor-cmd'."
482 (interactive "fFile to edit: ") 483 (interactive "fFile to edit: ")
483 (or editor-cmd (setq editor-cmd br-editor-cmd)) 484 (or editor-cmd (setq editor-cmd br-editor-cmd))
484 (if (not (stringp editor-cmd)) ;; must be a Lisp function that takes a 485 (if (not (stringp editor-cmd)) ;; must be a Lisp function that takes a
485 ;; single, file arg 486 ;; single, file arg
486 (funcall editor-cmd file) 487 (funcall editor-cmd file)
507 (interactive) 508 (interactive)
508 (if (fboundp 'br-insert-class-info) 509 (if (fboundp 'br-insert-class-info)
509 (let ((class-name (br-find-class-name))) 510 (let ((class-name (br-find-class-name)))
510 (if class-name 511 (if class-name
511 (progn 512 (progn
512 (message "Building '%s' class info..." class-name) 513 (message "Building `%s' class info..." class-name)
513 ; (sit-for 2) ; Why should we pause here? 514 (sit-for 2)
514 (br-store-class-info class-name) 515 (br-store-class-info class-name)
515 (message "Building '%s' class info...Done" class-name) 516 (message "Building `%s' class info...Done" class-name)
516 (br-funcall-in-view-window 517 (br-funcall-in-view-window
517 (concat br-buffer-prefix-info "Info") 518 (concat br-buffer-prefix-info "Info*")
518 'br-insert-class-info)) 519 'br-insert-class-info))
519 (error "Move point to a class name line."))) 520 (error "Move point to a class name line.")))
520 (beep) 521 (beep)
521 (message "No class information function for this language."))) 522 (message "No class information function for this language.")))
522 523
566 (error "(br-feature): Can't find definition of: '%s'" ftr-sig)))) 567 (error "(br-feature): Can't find definition of: '%s'" ftr-sig))))
567 568
568 (defun br-features (arg) 569 (defun br-features (arg)
569 "Display features/elements of the current class (prefix ARG = 1) or of the current listing if ARG is other than 0 or 1. 570 "Display features/elements of the current class (prefix ARG = 1) or of the current listing if ARG is other than 0 or 1.
570 571
571 With ARG = 0, the value of the variable, 'br-inherited-features-flag', is 572 With ARG = 0, the value of the variable, `br-inherited-features-flag', is
572 toggled and no other action is taken. 573 toggled and no other action is taken.
573 574
574 If 'br-inherited-features-flag' is t, all features of each class are shown. 575 If `br-inherited-features-flag' is t, all features of each class are shown.
575 If nil, only lexically included features are shown and if the features of a 576 If nil, only lexically included features are shown and if the features of a
576 single class are requested and none are defined, the class definition is 577 single class are requested and none are defined, the class definition is
577 displayed so that its feature declarations may be browsed." 578 displayed so that its feature declarations may be browsed."
578 (interactive "p") 579 (interactive "p")
579 (cond ((and (integerp arg) (= arg 0)) 580 (cond ((and (integerp arg) (= arg 0))
594 (if (not (br-in-view-window-p)) (br-to-from-viewer)) 595 (if (not (br-in-view-window-p)) (br-to-from-viewer))
595 (if (string-match br-feature-signature-regexp element) 596 (if (string-match br-feature-signature-regexp element)
596 (br-find-feature element) 597 (br-find-feature element)
597 (br-find-class element)))) 598 (br-find-class element))))
598 element 599 element
599 (error "(OO-Browser): '%s' definition not found." element))) 600 (error "(OO-Browser): `%s' definition not found." element)))
600 601
601 (defun br-help (&optional file) 602 (defun br-help (&optional file)
602 "Display browser operation help information in viewer window." 603 "Display browser operation help information in viewer window."
603 (interactive) 604 (interactive)
604 (or file (setq file "br-help")) 605 (or file (setq file "br-help"))
631 (skip-chars-forward " \t") 632 (skip-chars-forward " \t")
632 (if (looking-at br-feature-entry) 633 (if (looking-at br-feature-entry)
633 (list (br-find-feature-entry))))))) 634 (list (br-find-feature-entry)))))))
634 (if (or (null ftr-list) (null (car ftr-list))) 635 (if (or (null ftr-list) (null (car ftr-list)))
635 (error 636 (error
636 "(OO-Browser): 'br-implementors' must be applied to a feature.") 637 "(OO-Browser): `br-implementors' must be applied to a feature.")
637 (message "Computing implementors...") 638 (message "Computing implementors...")
638 (br-add-level-hist) 639 (br-add-level-hist)
639 (br-next-listing-window -1) 640 (br-next-listing-window -1)
640 (br-next-buffer (concat "p" child-level)) 641 (br-next-buffer (concat "p" child-level))
641 (let ((buffer-read-only) (implementor-tags) (classes) 642 (let ((buffer-read-only) (implementor-tags) (classes)
704 class-and-features)) 705 class-and-features))
705 (cons class class-and-features))) 706 (cons class class-and-features)))
706 class-list))) 707 class-list)))
707 (cond ((not class-list) 708 (cond ((not class-list)
708 (beep) 709 (beep)
709 (message "(OO-Browser): Apply 'br-features' to a class.")) 710 (message "(OO-Browser): Apply `br-features' to a class."))
710 ((not has-features) 711 ((not has-features)
711 (if (and (= (length class-list) 1) 712 (if (and (= (length class-list) 1)
712 (br-class-path (car class-list))) 713 (br-class-path (car class-list)))
713 (if (br-view nil nil (car class-list)) 714 (if (br-view nil nil (car class-list))
714 (message 715 (message
766 (or expr (setq expr (read-string 767 (or expr (setq expr (read-string
767 (concat (if again (format "(%s matches) " matched)) 768 (concat (if again (format "(%s matches) " matched))
768 (if arg 769 (if arg
769 "Find Environment class string matches" 770 "Find Environment class string matches"
770 "Find Environment class regular expression matches") 771 "Find Environment class regular expression matches")
771 (if again " (RTN to end): " ": "))))) 772 (if again " (RET to end): " ": ")))))
772 (if (and again (equal expr "")) 773 (if (and again (equal expr ""))
773 nil 774 nil
774 (let* ((match-expr (if arg (regexp-quote expr) expr)) 775 (let* ((match-expr (if arg (regexp-quote expr) expr))
775 (classes 776 (classes
776 (delq nil (mapcar 777 (delq nil (mapcar
802 (or expr (setq expr (read-string 803 (or expr (setq expr (read-string
803 (concat (if again (format "(%s matches) " matched)) 804 (concat (if again (format "(%s matches) " matched))
804 (if arg 805 (if arg
805 "Find string matches in listing" 806 "Find string matches in listing"
806 "Find regular expression matches in listing") 807 "Find regular expression matches in listing")
807 (if again " (RTN to end): " ": "))))) 808 (if again " (RET to end): " ": ")))))
808 (if (and again (equal expr "")) 809 (if (and again (equal expr ""))
809 nil 810 nil
810 (let* ((match-expr (if arg (regexp-quote expr) expr)) 811 (let* ((match-expr (if arg (regexp-quote expr) expr))
811 (buffer-read-only)) 812 (buffer-read-only))
812 (goto-char (point-min)) 813 (goto-char (point-min))
891 (setq parents (br-get-parents class) 892 (setq parents (br-get-parents class)
892 has-parents (or has-parents parents)) 893 has-parents (or has-parents parents))
893 (cons class parents))) 894 (cons class parents)))
894 class-list))) 895 class-list)))
895 (cond ((not parents-list) 896 (cond ((not parents-list)
896 (message "(OO-Browser): Apply 'br-parents' to a class.") (beep)) 897 (message "(OO-Browser): Apply `br-parents' to a class.") (beep))
897 ((not has-parents) 898 ((not has-parents)
898 (message "No parents.") (beep)) 899 (message "No parents.") (beep))
899 (t 900 (t
900 (let ((child-level (br-buffer-level))) 901 (let ((child-level (br-buffer-level)))
901 (br-add-level-hist) 902 (br-add-level-hist)
953 class-and-protocols)) 954 class-and-protocols))
954 (cons class class-and-protocols))) 955 (cons class class-and-protocols)))
955 class-list))) 956 class-list)))
956 (cond ((not class-list) 957 (cond ((not class-list)
957 (beep) 958 (beep)
958 (message "(OO-Browser): Apply 'br-protocols' to a class.")) 959 (message "(OO-Browser): Apply `br-protocols' to a class."))
959 ((not has-protocols) 960 ((not has-protocols)
960 (message "No class protocols.") (beep)) 961 (message "No class protocols.") (beep))
961 (t 962 (t
962 (br-add-level-hist) 963 (br-add-level-hist)
963 (br-next-buffer nil) 964 (br-next-buffer nil)
1003 1004
1004 (defun br-report-bug () 1005 (defun br-report-bug ()
1005 "Send a message to the OO-Browser discussion list." 1006 "Send a message to the OO-Browser discussion list."
1006 (interactive) 1007 (interactive)
1007 (if (br-in-browser) (br-to-view-window)) 1008 (if (br-in-browser) (br-to-view-window))
1008 (hmail:compose "oo-browser@hub.ucsb.edu" '(hypb:configuration))) 1009 (hmail:compose "oo-browser@infodock.com" '(hypb:configuration)))
1009 1010
1010 (defun br-sys-rebuild () 1011 (defun br-sys-rebuild ()
1011 "Rescan System components of the current Environment." 1012 "Rescan System components of the current Environment."
1012 (interactive) 1013 (interactive)
1013 (if (call-interactively 'br-build-sys-htable) 1014 (if (call-interactively 'br-build-sys-htable)
1040 (other-window 1)) 1041 (other-window 1))
1041 (setq *br-prev-listing-window* nil)) 1042 (setq *br-prev-listing-window* nil))
1042 (br-to-view-window))) 1043 (br-to-view-window)))
1043 1044
1044 (defun br-toggle-c-tags () 1045 (defun br-toggle-c-tags ()
1045 "Toggle the value of the 'br-c-tags-flag' flag." 1046 "Toggle the value of the `br-c-tags-flag' flag."
1046 (interactive) 1047 (interactive)
1047 (setq br-c-tags-flag (not br-c-tags-flag)) 1048 (setq br-c-tags-flag (not br-c-tags-flag))
1048 (message "C constructs will %sbe added to C-based language Environments." 1049 (message "C constructs will %sbe added to C-based language Environments."
1049 (if br-c-tags-flag "" "not "))) 1050 (if br-c-tags-flag "" "not ")))
1050 1051
1051 (defun br-toggle-keep-viewed () 1052 (defun br-toggle-keep-viewed ()
1052 "Toggle the value of the 'br-keep-viewed-classes' flag." 1053 "Toggle the value of the `br-keep-viewed-classes' flag."
1053 (interactive) 1054 (interactive)
1054 (setq br-keep-viewed-classes (not br-keep-viewed-classes)) 1055 (setq br-keep-viewed-classes (not br-keep-viewed-classes))
1055 (message "Viewed classes will no%s be kept after use." 1056 (message "Viewed classes will no%s be kept after use."
1056 (if br-keep-viewed-classes "w" "t"))) 1057 (if br-keep-viewed-classes "w" "t")))
1057 1058
1092 (goto-char (point-min)))) 1093 (goto-char (point-min))))
1093 1094
1094 (defun br-version () 1095 (defun br-version ()
1095 "Display browser version number and credits." 1096 "Display browser version number and credits."
1096 (interactive) 1097 (interactive)
1097 (br-file-to-viewer "BR-VERSION")
1098 (br-funcall-in-view-window 1098 (br-funcall-in-view-window
1099 (concat br-buffer-prefix-info "Help") 1099 (concat br-buffer-prefix-info "Help*")
1100 (function (lambda () 1100 (function (lambda ()
1101 (insert-file-contents (br-pathname "BR-VERSION"))
1102 (hypb:display-file-with-logo)
1101 (if (re-search-forward "<VERSION>" nil t) 1103 (if (re-search-forward "<VERSION>" nil t)
1102 (replace-match br-version t t)) 1104 (replace-match br-version t t))
1103 (center-line) 1105 (center-line)
1104 (set-buffer-modified-p nil))) 1106 (set-buffer-modified-p nil)))))
1105 t))
1106 1107
1107 (defun br-view-entry (&optional prompt) 1108 (defun br-view-entry (&optional prompt)
1108 "Displays source for any browser listing entry. 1109 "Displays source for any browser listing entry.
1109 Optional prefix arg PROMPT means prompt for entry name." 1110 Optional prefix arg PROMPT means prompt for entry name."
1110 (interactive "P") 1111 (interactive "P")
1127 1128
1128 (defun br-view (&optional prompt writable class) 1129 (defun br-view (&optional prompt writable class)
1129 "Displays class file in viewer window. 1130 "Displays class file in viewer window.
1130 Optional prefix arg PROMPT means prompt for class name. Non-nil WRITABLE means 1131 Optional prefix arg PROMPT means prompt for class name. Non-nil WRITABLE means
1131 allow editing, otherwise display in read-only mode. Non-nil CLASS is class to 1132 allow editing, otherwise display in read-only mode. Non-nil CLASS is class to
1132 display. 1133 display. Return t if class is displayed or sent to an external viewer, else nil."
1133
1134 Return t if class is displayed or sent to an external viewer, else nil."
1135 (interactive "P") 1134 (interactive "P")
1136 (or class (setq class (if prompt (br-complete-class-name) 1135 (or class (setq class (if prompt (br-complete-class-name)
1137 (br-find-class-name)))) 1136 (br-find-class-name))))
1138 (cond ((null class) 1137 (cond ((null class)
1139 (beep) 1138 (beep)
1170 t))) 1169 t)))
1171 (or writable (select-window owind))))))) 1170 (or writable (select-window owind)))))))
1172 1171
1173 (defun br-view-ext (viewer-cmd file) 1172 (defun br-view-ext (viewer-cmd file)
1174 "Invoke a non-standard VIEWER-CMD on FILE. 1173 "Invoke a non-standard VIEWER-CMD on FILE.
1175 See also 'br-viewer-cmd'." 1174 See also `br-viewer-cmd'."
1176 (interactive "fFile to view: ") 1175 (interactive "fFile to view: ")
1177 (or viewer-cmd (setq viewer-cmd br-viewer-cmd)) 1176 (or viewer-cmd (setq viewer-cmd br-viewer-cmd))
1178 (if (not (stringp viewer-cmd)) ;; must be a Lisp function that takes a 1177 (if (not (stringp viewer-cmd)) ;; must be a Lisp function that takes a
1179 ;; single, file arg 1178 ;; single, file arg
1180 (funcall viewer-cmd file) 1179 (funcall viewer-cmd file)
1354 (defun br-browser-buffer-p (&optional buffer) 1353 (defun br-browser-buffer-p (&optional buffer)
1355 "Returns t iff optional BUFFER or current buffer is an OO-Browser specific buffer." 1354 "Returns t iff optional BUFFER or current buffer is an OO-Browser specific buffer."
1356 (equal 0 (string-match (concat br-buffer-prefix-inher 1355 (equal 0 (string-match (concat br-buffer-prefix-inher
1357 "\\|" br-buffer-prefix-categ 1356 "\\|" br-buffer-prefix-categ
1358 "\\|" br-buffer-prefix-blank 1357 "\\|" br-buffer-prefix-blank
1359 "\\|" br-buffer-prefix-info) 1358 "\\|" (regexp-quote br-buffer-prefix-info))
1360 (buffer-name buffer)))) 1359 (buffer-name buffer))))
1361 1360
1362 (defun br-buffer-level () 1361 (defun br-buffer-level ()
1363 "Returns current listing buffer level as a string." 1362 "Returns current listing buffer level as a string."
1364 (let* ((name (buffer-name)) 1363 (let* ((name (buffer-name))
1500 1499
1501 (defun br-file-to-viewer (filename) 1500 (defun br-file-to-viewer (filename)
1502 "Display FILENAME from OO-Browser source directory in browser viewer window. 1501 "Display FILENAME from OO-Browser source directory in browser viewer window.
1503 FILENAME should not contain any path information." 1502 FILENAME should not contain any path information."
1504 (br-funcall-in-view-window 1503 (br-funcall-in-view-window
1505 (concat br-buffer-prefix-info "Help") 1504 (concat br-buffer-prefix-info "Help*")
1506 (function (lambda () 1505 (function (lambda ()
1507 (insert-file-contents (br-pathname filename)) 1506 (insert-file-contents (br-pathname filename))
1508 (set-buffer-modified-p nil))))) 1507 (set-buffer-modified-p nil)))))
1509 1508
1510 (defun br-in-browser () 1509 (defun br-in-browser ()
1511 "Return selected frame if the OO-Browser is active in it, else return nil." 1510 "Return selected frame if the OO-Browser is active in it, else return nil."
1512 (cond ((not (eq br-in-browser (selected-frame))) nil) 1511 (cond ((not (eq br-in-browser (selected-frame))) nil)
1513 ((one-window-p 'nomini) 1512 ((or (one-window-p 'nomini)
1513 (and (fboundp 'window-list)
1514 (< (length (window-list)) 3)))
1514 (setq br-in-browser nil)) 1515 (setq br-in-browser nil))
1515 (t br-in-browser))) 1516 (t br-in-browser)))
1516 1517
1517 1518
1518 (defun br-in-top-buffer-p () 1519 (defun br-in-top-buffer-p ()
1578 (defun br-narrow-to-class () 1579 (defun br-narrow-to-class ()
1579 (cond ((= (point-min) (point-max)) nil) 1580 (cond ((= (point-min) (point-max)) nil)
1580 ((br-find-class-name) 1581 ((br-find-class-name)
1581 (narrow-to-region (match-beginning 0) (match-end 0))) 1582 (narrow-to-region (match-beginning 0) (match-end 0)))
1582 (t (error 1583 (t (error
1583 "(OO-Browser): 'br-narrow-to-class', current entry is not a class")))) 1584 "(OO-Browser): `br-narrow-to-class', current entry is not a class"))))
1584 1585
1585 (defun br-narrow-to-feature () 1586 (defun br-narrow-to-feature ()
1586 "Narrow buffer to current feature entry." 1587 "Narrow buffer to current feature entry."
1587 (if (br-feature-at-p) 1588 (if (br-feature-at-p)
1588 (narrow-to-region (match-beginning 0) (match-end 0)) 1589 (narrow-to-region (match-beginning 0) (match-end 0))
1589 (error 1590 (error
1590 "(OO-Browser): 'br-narrow-to-feature' no current feature."))) 1591 "(OO-Browser): `br-narrow-to-feature' no current feature.")))
1591 1592
1592 (defun br-feature-at-p () 1593 (defun br-feature-at-p ()
1593 "Returns t iff point is on a feature listing line." 1594 "Returns t iff point is on a feature listing line."
1594 (save-excursion 1595 (save-excursion
1595 (beginning-of-line) 1596 (beginning-of-line)
1629 1630
1630 (defun br-pathname (filename) 1631 (defun br-pathname (filename)
1631 "Return full pathname for FILENAME in browser Elisp directory." 1632 "Return full pathname for FILENAME in browser Elisp directory."
1632 (if br-directory 1633 (if br-directory
1633 (expand-file-name filename br-directory) 1634 (expand-file-name filename br-directory)
1634 (error "The 'br-directory' variable must be set to a string value."))) 1635 (error "The `br-directory' variable must be set to a string value.")))
1635 1636
1636 (defun br-protocol-entry-p () 1637 (defun br-protocol-entry-p ()
1637 "Return non-nil if point is within a protocol listing entry line." 1638 "Return non-nil if point is within a protocol listing entry line."
1638 (and (string-equal br-lang-prefix "objc-") 1639 (and (string-equal br-lang-prefix "objc-")
1639 (save-excursion 1640 (save-excursion
1886 1887
1887 (defvar br-lib-search-dirs nil 1888 (defvar br-lib-search-dirs nil
1888 "List of directories below which OO source files and other library 1889 "List of directories below which OO source files and other library
1889 directories are found. A library is a stable group of OO classes. Do not 1890 directories are found. A library is a stable group of OO classes. Do not
1890 set this variable directly. Each OO language library which invokes 1891 set this variable directly. Each OO language library which invokes
1891 'br-browse' should set it.") 1892 `br-browse' should set it.")
1892 1893
1893 (defvar br-sys-search-dirs nil 1894 (defvar br-sys-search-dirs nil
1894 "List of directories below which OO source files and other system 1895 "List of directories below which OO source files and other system
1895 directories are found. A system is a group of OO classes that are likely to 1896 directories are found. A system is a group of OO classes that are likely to
1896 change. Do not set this variable directly. Each OO language library which 1897 change. Do not set this variable directly. Each OO language library which
1897 invokes 'br-browse' should set it.") 1898 invokes `br-browse' should set it.")
1898 1899
1899 (defvar *br-level-hist* nil 1900 (defvar *br-level-hist* nil
1900 "Internal history of visited listing windows and buffers.") 1901 "Internal history of visited listing windows and buffers.")
1901 1902
1902 (defvar *br-prev-listing-window* nil 1903 (defvar *br-prev-listing-window* nil
1910 "Saves window configuration between invocations of the browser.") 1911 "Saves window configuration between invocations of the browser.")
1911 1912
1912 (defconst br-buffer-prefix-categ "Categ-Lvl-") 1913 (defconst br-buffer-prefix-categ "Categ-Lvl-")
1913 (defconst br-buffer-prefix-inher "Inher-Lvl-") 1914 (defconst br-buffer-prefix-inher "Inher-Lvl-")
1914 (defconst br-buffer-prefix-blank "Blank-") 1915 (defconst br-buffer-prefix-blank "Blank-")
1915 (defconst br-buffer-prefix-info "OO-Browser ") 1916 (defconst br-buffer-prefix-info "*OO-Browser ")
1916 (defvar br-buffer-prefix br-buffer-prefix-inher 1917 (defvar br-buffer-prefix br-buffer-prefix-inher
1917 "Browser buffer name prefix.") 1918 "Browser buffer name prefix.")
1918 1919
1919 1920
1920 (defvar br-mode-map nil 1921 (defvar br-mode-map nil
1933 (define-key br-mode-map "C" 'br-categories) 1934 (define-key br-mode-map "C" 'br-categories)
1934 (define-key br-mode-map "\M-c" 'br-class-stats) 1935 (define-key br-mode-map "\M-c" 'br-class-stats)
1935 (define-key br-mode-map "\C-c\C-c" 'br-env-create) 1936 (define-key br-mode-map "\C-c\C-c" 'br-env-create)
1936 (define-key br-mode-map "d" 'br-descendants) 1937 (define-key br-mode-map "d" 'br-descendants)
1937 (define-key br-mode-map "\C-c\C-d" 'br-delete) 1938 (define-key br-mode-map "\C-c\C-d" 'br-delete)
1938 ;; {M-d} is used down below for 'br-tree' 1939 ;; {M-d} is used down below for `br-tree'
1939 (define-key br-mode-map "e" 'br-edit-entry) 1940 (define-key br-mode-map "e" 'br-edit-entry)
1940 (define-key br-mode-map "\M-e" 'br-env-stats) 1941 (define-key br-mode-map "\M-e" 'br-env-stats)
1941 (define-key br-mode-map "\C-c\C-e" 'br-env-rebuild) 1942 (define-key br-mode-map "\C-c\C-e" 'br-env-rebuild)
1942 (define-key br-mode-map "f" 'br-features) 1943 (define-key br-mode-map "f" 'br-features)
1943 (define-key br-mode-map "F" 'br-feature-signature) 1944 (define-key br-mode-map "F" 'br-feature-signature)
1944 ;; {M-f} is used down below for 'br-tree-features-toggle' 1945 ;; {M-f} is used down below for `br-tree-features-toggle'
1945 ;; {M-g} is used down below for 'br-tree-graph' 1946 ;; {M-g} is used down below for `br-tree-graph'
1946 (define-key br-mode-map "?" 'br-help) 1947 (define-key br-mode-map "?" 'br-help)
1947 (define-key br-mode-map "h" 'br-help) 1948 (define-key br-mode-map "h" 'br-help)
1948 (define-key br-mode-map "H" 'br-help-ms) ;; mouse help 1949 (define-key br-mode-map "H" 'br-help-ms) ;; mouse help
1949 (define-key br-mode-map "i" 'br-entry-info) 1950 (define-key br-mode-map "i" 'br-entry-info)
1950 (define-key br-mode-map "I" 'br-implementors) 1951 (define-key br-mode-map "I" 'br-implementors)
1951 (define-key br-mode-map "\C-c\C-k" 'br-kill) 1952 (define-key br-mode-map "\C-c\C-k" 'br-kill)
1952 ;; {M-k} is used down below for 'br-tree-kill' 1953 ;; {M-k} is used down below for `br-tree-kill'
1953 (define-key br-mode-map "l" 'br-lib-top-classes) 1954 (define-key br-mode-map "l" 'br-lib-top-classes)
1954 (define-key br-mode-map "L" 'br-lib-rebuild) 1955 (define-key br-mode-map "L" 'br-lib-rebuild)
1955 (define-key br-mode-map "\C-c\C-l" 'br-env-load) 1956 (define-key br-mode-map "\C-c\C-l" 'br-env-load)
1956 (define-key br-mode-map "m" 'br-match) 1957 (define-key br-mode-map "m" 'br-match)
1957 (define-key br-mode-map "M" 'br-match-entries) 1958 (define-key br-mode-map "M" 'br-match-entries)
1994 (define-key br-mode-map "\M-k" 'br-tree-kill)))) 1995 (define-key br-mode-map "\M-k" 'br-tree-kill))))
1995 1996
1996 (defvar br-tmp-class-set nil 1997 (defvar br-tmp-class-set nil
1997 "Set of classes created for temporary use by br-*-trees functions.") 1998 "Set of classes created for temporary use by br-*-trees functions.")
1998 (defvar br-tmp-depth 0 1999 (defvar br-tmp-depth 0
1999 "Temporary variable indicating inheritance depth of class in 'br-ancestor-trees'.") 2000 "Temporary variable indicating inheritance depth of class in `br-ancestor-trees'.")
2000 2001
2001 (provide 'br) 2002 (provide 'br)