home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 2: Applications / Linux Cubed Series 2 - Applications.iso / editors / emacs / xemacs / xemacs-1.006 / xemacs-1 / lib / xemacs-19.13 / lisp / oobr / br-init.el < prev    next >
Encoding:
Text File  |  1995-08-26  |  7.5 KB  |  209 lines

  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:     23-Aug-95 at 16:15:14 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.                      ((scroll-up-eol) . (scroll-down-eol)))
  139.            ;;
  140.            ((br-in-browser) .
  141.             ((smart-br-dispatch) . (smart-br-assist-dispatch)))
  142.            ;;
  143.            ((eq major-mode 'Buffer-menu-mode) .
  144.             ((smart-buffer-menu) . (smart-buffer-menu-assist)))
  145.            ;;
  146.            ((eq major-mode 'dired-mode) . 
  147.             ((smart-dired) . (smart-dired-assist)))
  148.            ;;
  149.            ((eq major-mode 'tar-mode) . 
  150.             ((smart-tar) . (smart-tar-assist)))
  151.            ;;
  152.            (buffer-read-only .
  153.                     ((scroll-up) . (scroll-down)))
  154.            )))))
  155.   ;;
  156.   (if (stringp br-editor-cmd)
  157.       (let ((br-editor-cmd (downcase br-editor-cmd)))
  158.     (and (string-match "emacs" br-editor-cmd)
  159.          (setq br-editor-cmd nil))))
  160.   (if (stringp br-viewer-cmd)
  161.       (let ((br-viewer-cmd (downcase br-viewer-cmd)))
  162.     (and (string-match "emacs" br-viewer-cmd)
  163.          (setq br-viewer-cmd nil))))
  164.   ;;
  165.   (require 'br)
  166.   (require 'hmouse-br)
  167.   (require 'hmouse-drv)
  168.   ;;
  169.   ;; Loads menus under non-tty InfoDock, XEmacs or Emacs19; does nothing
  170.   ;; otherwise.
  171.   (and (not (featurep 'br-menu)) hyperb:window-system
  172.        (or hyperb:lemacs-p hyperb:emacs19-p) (require 'br-menu))
  173.   ;;
  174.   ;; Adds or replaces class entry in an Environment
  175.   (global-set-key "\C-c^" 'br-add-class-file)
  176.   ;;
  177.   ;; Goes to and from class viewer window
  178.   (global-set-key "\C-c\C-v" 'br-to-from-viewer)
  179.   ;;
  180.   (br-init-autoloads)
  181.   ;;
  182.   (if (boundp 'hmouse-bindings)
  183.       ;; Mouse support has been initialized, possibly by Hyperbole.
  184.       nil
  185.     (require 'hmouse-key)
  186.     (hmouse-setup)))
  187.  
  188. (defun br-init-autoloads ()
  189.   "Setup OO-Browser autoloaded functions."
  190.   (autoload 'br-add-class-file "br" "Add file to OO-Browser Environment" t) 
  191.   (autoload 'br-env-browse "br" "Browse an existing OO-Browser Environment" t)
  192.   (autoload 'br-env-load  "br" "Load a new OO-Browser Environment" t)
  193.   (autoload 'br-to-from-viewer  "br" "Move between list and viewer windows" t)
  194.   ;;
  195.   (autoload 'c++-browse  "c++-browse" "C++ OO-Browser" t)
  196.   (autoload 'clos-browse "clos-brows" "Common Lisp OO-Browser" t)
  197.   (autoload 'eif-browse  "eif-browse" "Eiffel OO-Browser" t)
  198.   (autoload 'info-browse "info-brows" "Info OO-Browser" t)
  199.   (autoload 'java-browse "java-brows" "Java OO-Browser" t)
  200.   (autoload 'objc-browse "objc-brows" "Objective-C OO-Browser" t)
  201.   (autoload 'smt-browse  "smt-browse" "Smalltalk OO-Browser" t)
  202.   )
  203.  
  204. ;;; ************************************************************************
  205. ;;; Internal functions
  206. ;;; ************************************************************************
  207.  
  208. (provide 'br-init)
  209.