4 ;; SUMMARY: Smalltalk source code browser.
5 ;; USAGE: GNU Emacs Lisp Library
6 ;; KEYWORDS: oop, tools
11 ;; ORIG-DATE: 26-Jul-90
12 ;; LAST-MOD: 10-May-01 at 12:54:27 by Bob Weiner
14 ;; Copyright (C) 1990-1995, 1997 BeOpen.com
15 ;; See the file BR-COPY for license information.
17 ;; This file is part of the OO-Browser.
21 ;; Use `smt-browse' to invoke the Smalltalk OO-Browser. Prefix arg
22 ;; prompts for name of Environment file.
26 ;;; ************************************************************************
27 ;;; Other required Elisp libraries
28 ;;; ************************************************************************
30 (mapcar 'require '(br-start br br-smt))
32 ;;; ************************************************************************
34 ;;; ************************************************************************
37 (defun smt-browse (&optional env-file no-ui)
38 "Invoke the Smalltalk OO-Browser.
39 This allows browsing through Smalltalk library and system class hierarchies.
40 With an optional non-nil prefix argument ENV-FILE, prompt for Environment
41 file to use. Alternatively, a string value of ENV-FILE is used as the
42 Environment file name. See also the file \"br-help\"."
44 (let ((same-lang (equal br-lang-prefix smt-lang-prefix))
49 ;; Save other language Environment in memory
50 (if br-lang-prefix (br-env-copy nil))
51 (setq br-lang-prefix smt-lang-prefix
52 *br-save-wconfig* nil))
53 ;; `same-env' non-nil means the new Env is the previous Env or the most
54 ;; recent previous Env of the same language as the new Env
55 (setq same-env (or (equal smt-env-file env-file)
57 (or smt-lib-search-dirs smt-sys-search-dirs))))
60 ;; If we just switched languages, restore the cached data for the new
62 (if same-lang nil (br-env-copy t))
63 ;; Environment may appear to be the same but its loading may have
64 ;; been interrupted, so ensure all variables are initialized properly.
65 (smt-browse-setup env-file)
66 (if (or (null br-paths-htable) (equal br-paths-htable br-empty-htable))
68 (br-env-try-load (or env-file br-env-file) br-env-file))))
70 ;; Create default Environment file specification if needed and none
73 (t (or env-file (file-exists-p smt-env-file)
74 (br-env-create smt-env-file smt-lang-prefix))
75 (or env-file (setq env-file smt-env-file))
77 ;; Start browsing a new Environment.
79 (smt-browse-setup env-file)
80 (setq load-succeeded (br-env-init env-file same-lang nil))
82 (setq *br-save-wconfig* nil
83 smt-env-file br-env-file
84 smt-env-name br-env-name
85 smt-sys-search-dirs br-sys-search-dirs
86 smt-lib-search-dirs br-lib-search-dirs))))
91 (or (and same-lang same-env) (br-refresh))))
93 (t (message "(smt-browse): You must build the Environment to browse it.")))))
95 ;; Don't filter Environment classes when listed.
96 (defalias 'smt-class-list-filter 'br-class-list-identity)
98 (defun smt-class-definition-regexp (class)
99 "Return regexp to uniquely match the definition of CLASS name."
100 (concat smt-class-name-before (regexp-quote class)
101 smt-class-name-after))
103 ;;; ************************************************************************
104 ;;; Internal functions
105 ;;; ************************************************************************
107 (defun smt-browse-setup (env-file)
108 "Setup language-dependent functions for OO-Browser."
110 (defalias 'br-lang-mode
111 (cond ((featurep 'smalltalk-mode) 'smalltalk-mode)
112 ((load "st" 'missing-ok 'nomessage)
113 (provide 'smalltalk-mode))
114 (t 'fundamental-mode)))
115 (br-setup-constants env-file))
117 (provide 'smt-browse)