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