comparison lisp/oobr/br-init.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-init.el
4 ;; SUMMARY: OO-Browser per Emacs session initialization.
5 ;; USAGE: GNU Emacs Lisp Library
6 ;; KEYWORDS: oop, tools
7 ;;
8 ;; AUTHOR: Bob Weiner
9 ;; ORG: Motorola Inc.
10 ;;
11 ;; ORIG-DATE: 18-May-90
12 ;; LAST-MOD: 1-Nov-95 at 20:22:46 by Bob Weiner
13 ;;
14 ;; Copyright (C) 1990-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 ;; DESCRIP-END.
21
22 ;;; ************************************************************************
23 ;;; Personal Variable Defaults
24 ;;; ************************************************************************
25
26 ;; >>> If you wish to edit classes displayed by the browser in an editor
27 ;; other than Emacs, set the 'br-editor-cmd' variable to the command you
28 ;; want to edit with. Arguments to the command should be placed in
29 ;; 'br-ed[1-9], with one string argument per variable'. Keep in
30 ;; mind that the command must generate a new window under your
31 ;; window system. For example, to run vi under X, one needs to use the
32 ;; command line "xterm -e vi", the settings would then be:
33 ;;
34 ;; (setq br-editor-cmd "xterm" br-ed1 "-e"
35 ;; br-ed2 "vi")
36 ;;
37 ;; This editor will only be used when the browser is run under a window
38 ;; system external to Emacs, like X. (In such a case, the variable
39 ;; 'hyperb:window-system' will be non-nil).
40 ;;
41 ;;
42 (defvar br-editor-cmd nil
43 "When non-nil, the OO-Browser uses a non-standard command for editing files.
44 This may be either a string to invoke an external program or an Emacs
45 Lisp function which takes a single file argument.")
46
47 (setq br-ed1 nil br-ed2 nil br-ed3 nil br-ed4 nil br-ed5 nil
48 br-ed6 nil br-ed7 nil br-ed8 nil br-ed9 nil)
49
50 ;;
51 ;; >>> If you want to view classes in a read-only fashion outside of Emacs,
52 ;; set the following 'br-viewer-cmd' and 'br-vw[1-9]' variables in a
53 ;; similar manner as you did for the editor variables above.
54 ;;
55 ;; For example, to use "xmore", an X-compatible version of more, as your
56 ;; viewer, use the following settings:
57 ;;
58 ;; (setq br-viewer-cmd "xmore")
59 ;;
60 (defvar br-viewer-cmd nil
61 "When non-nil, the OO-Browser uses a non-standard command for viewing files.
62 This may be either a string to invoke an external program or an Emacs
63 Lisp function which takes a single file argument.")
64
65 (setq br-vw1 nil br-vw2 nil br-vw3 nil br-vw4 nil br-vw5 nil
66 br-vw6 nil br-vw7 nil br-vw8 nil br-vw9 nil)
67
68 ;;
69 ;;
70 (defvar br-skip-dir-regexps
71 (if (eq system-type 'next-mach)
72 ;; .E is an Eiffel system directory
73 '("^RCS$" "^SCCS$" "\\.lproj$" "^obj$" "\\.E$")
74 '("^RCS$" "^SCCS$" "\\.E$"))
75 "*List of regexps matching subdirectories OO-Browser will not descend when scanning files.")
76
77
78 ;;; ************************************************************************
79 ;;; Public functions
80 ;;; ************************************************************************
81
82 (or (fboundp 'frame-width) (fset 'frame-width 'screen-width))
83 (or (fboundp 'frame-height) (fset 'frame-width 'screen-height))
84 (or (fboundp 'selected-frame)
85 (cond ((fboundp 'selected-screen)
86 (fset 'selected-frame 'selected-screen))
87 ((fboundp 'epoch::current-screen)
88 (fset 'selected-frame 'epoch::current-screen))
89 (t
90 (defun selected-frame ()
91 "Always return t since current frame is always selected."
92 t))))
93
94 (defun br-after-term-init ()
95 (let ((hypb (expand-file-name "hypb/" br-directory)))
96 (or (featurep 'hyperbole)
97 (br-member hypb load-path)
98 ;; br-site.el should have already loaded "hversion.el".
99 (load "hyperbole" t t)
100 ;; Use Hyperbole mouse and keyboard handlers included with the
101 ;; OO-Browser since Hyperbole is not available on this system.
102 (progn (or (br-member hypb load-path)
103 (setq load-path (cons hypb load-path)))
104 ;;
105 ;; Necessary to prevent action-key and assist-key from
106 ;; trying to load this Hyperbole library.
107 (provide 'hsite)
108 ;;
109 (defun hkey-either (arg)
110 "Executes `action-key' or with non-nil ARG executes `assist-key'."
111 (interactive "P")
112 (if arg (assist-key) (action-key)))
113 ;;
114 ;; A value of t for 'hkey-init' below will cause the
115 ;; Smart Keys to be bound to keyboard keys in addition to any
116 ;; mouse key bindings. Comment it out or set it to nil if you
117 ;; don't want these bindings. Or change the bindings in the
118 ;; succeeding lines.
119 (or (boundp 'hkey-init) (setq hkey-init t))
120 (and hkey-init
121 (not (global-key-binding "\M-\C-m"))
122 (global-set-key "\M-\C-m" 'hkey-either))
123 ;;
124 ;; Bind a key, {C-h A}, for Action Key help and {C-u C-h A}
125 ;; for Assist key help.
126 (and hkey-init
127 (not (where-is-internal 'hkey-help))
128 (define-key help-map "A" 'hkey-help))
129
130 ;; Setup Action and Assist keys to perform only
131 ;; browser-related actions.
132 (require 'hui-mouse)
133 (setq hkey-alist
134 '(
135 ((and (not (eobp))
136 (or (eolp) (and selective-display
137 (= (following-char) ?\^M)))) .
138 ((smart-scroll-up) .
139 (smart-scroll-down)))
140 ;;
141 ((br-in-browser) .
142 ((smart-br-dispatch) . (smart-br-assist-dispatch)))
143 ;;
144 ((eq major-mode 'Buffer-menu-mode) .
145 ((smart-buffer-menu) . (smart-buffer-menu-assist)))
146 ;;
147 ((eq major-mode 'dired-mode) .
148 ((smart-dired) . (smart-dired-assist)))
149 ;;
150 ((eq major-mode 'tar-mode) .
151 ((smart-tar) . (smart-tar-assist)))
152 ;;
153 (buffer-read-only .
154 ((scroll-up) . (scroll-down)))
155 )))))
156 ;;
157 (if (stringp br-editor-cmd)
158 (let ((br-editor-cmd (downcase br-editor-cmd)))
159 (and (string-match "emacs" br-editor-cmd)
160 (setq br-editor-cmd nil))))
161 (if (stringp br-viewer-cmd)
162 (let ((br-viewer-cmd (downcase br-viewer-cmd)))
163 (and (string-match "emacs" br-viewer-cmd)
164 (setq br-viewer-cmd nil))))
165 ;;
166 (require 'br)
167 (require 'hmouse-br)
168 (require 'hmouse-drv)
169 ;;
170 ;; Loads menus under non-tty InfoDock, XEmacs or Emacs19; does nothing
171 ;; otherwise.
172 (and (not (featurep 'br-menu)) hyperb:window-system
173 (or hyperb:lemacs-p hyperb:emacs19-p) (require 'br-menu))
174 ;;
175 ;; Adds or replaces class entry in an Environment
176 (global-set-key "\C-c^" 'br-add-class-file)
177 ;;
178 ;; Goes to and from class viewer window
179 (global-set-key "\C-c\C-v" 'br-to-from-viewer)
180 ;;
181 (br-init-autoloads)
182 ;;
183 (if (boundp 'hmouse-bindings)
184 ;; Mouse support has been initialized, possibly by Hyperbole.
185 nil
186 (require 'hmouse-key)
187 ;; See the documentation for this function for instructions on how to
188 ;; setup shifted or unshifted Action and Assist mouse buttons.
189 (hmouse-shift-buttons)))
190
191 (defun br-init-autoloads ()
192 "Setup OO-Browser autoloaded functions."
193 (autoload 'br-add-class-file "br" "Add file to OO-Browser Environment" t)
194 (autoload 'br-env-browse "br" "Browse an existing OO-Browser Environment" t)
195 (autoload 'br-env-load "br" "Load a new OO-Browser Environment" t)
196 (autoload 'br-to-from-viewer "br" "Move between list and viewer windows" t)
197 ;;
198 (autoload 'hmail:compose "hmail"
199 "Compose mail with ADDRESS and evaluation of EXPR." t)
200 (autoload 'hypb:configuration "hypb"
201 "Insert Emacs configuration information into OUT-BUF or current buffer.")
202 ;;
203 (autoload 'c++-browse "c++-browse" "C++ OO-Browser" t)
204 (autoload 'clos-browse "clos-brows" "Common Lisp OO-Browser" t)
205 (autoload 'eif-browse "eif-browse" "Eiffel OO-Browser" t)
206 (autoload 'info-browse "info-brows" "Info OO-Browser" t)
207 (autoload 'java-browse "java-brows" "Java OO-Browser" t)
208 (autoload 'objc-browse "objc-brows" "Objective-C OO-Browser" t)
209 (autoload 'smt-browse "smt-browse" "Smalltalk OO-Browser" t)
210 (autoload 'python-browse "python-browse" "Python OO-Browser" t)
211 )
212
213 ;;; ************************************************************************
214 ;;; Internal functions
215 ;;; ************************************************************************
216
217 (provide 'br-init)