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 / hyperbole / hinit.el < prev    next >
Encoding:
Text File  |  1995-06-14  |  4.1 KB  |  121 lines

  1. ;;!emacs
  2. ;;
  3. ;; FILE:         hinit.el
  4. ;; SUMMARY:      Standard initializations for Hyperbole hypertext system.
  5. ;; USAGE:        GNU Emacs Lisp Library
  6. ;; KEYWORDS:     hypermedia
  7. ;;
  8. ;; AUTHOR:       Bob Weiner
  9. ;; ORG:          Brown U.
  10. ;;
  11. ;; ORIG-DATE:     1-Oct-91 at 02:32:51
  12. ;; LAST-MOD:     13-Jun-95 at 16:26:41 by Bob Weiner
  13. ;;
  14. ;; This file is part of Hyperbole.
  15. ;; Available for use and distribution under the same terms as GNU Emacs.
  16. ;;
  17. ;; Copyright (C) 1991-1995, Free Software Foundation, Inc.
  18. ;; Developed with support from Motorola Inc.
  19. ;;
  20. ;; DESCRIPTION:  
  21. ;; DESCRIP-END.
  22.  
  23. ;;; ************************************************************************
  24. ;;; Public variables
  25. ;;; ************************************************************************
  26.  
  27. (defvar   hyperb:host-domain nil
  28.   "<@domain-name> for current host.  Set automatically by 'hyperb:init'.")
  29.  
  30. ;;; ************************************************************************
  31. ;;; Other required Elisp libraries
  32. ;;; ************************************************************************
  33.  
  34. (require 'hvar)
  35.  
  36. (mapcar 'require '(hui-mouse hypb hui hui-menus hbmap hibtypes))
  37.  
  38. ;;; ************************************************************************
  39. ;;; Public functions
  40. ;;; ************************************************************************
  41.  
  42. (if (not (fboundp 'br-in-browser))
  43.     ;; Then the OO-Browser is not loaded, so we can never be within the
  44.     ;; browser.  Define this as a dummy function that always returns nil
  45.     ;; until the OO-Browser is ever loaded..
  46.     (defun br-in-browser ()
  47.       "Always returns nil since the OO-Browser is not loaded."
  48.       nil))
  49.  
  50. (defun hyperb:init ()
  51.   "Standard configuration routine for Hyperbole."
  52.   (interactive)
  53.   (run-hooks 'hyperb:init-hook)
  54.   (hyperb:check-dir-user)
  55.   (or hyperb:host-domain (setq hyperb:host-domain (hypb:domain-name)))
  56.   (hyperb:act-set)
  57.   ;;
  58.   ;; Save button attribute file whenever same dir file is saved and
  59.   ;; 'ebut:hattr-save' is non-nil.
  60.   ;;
  61.   (var:append 'write-file-hooks '(hattr:save))
  62.   ;;
  63.   (hyperb:init-menubar))
  64.  
  65. (defun hyperb:init-menubar ()
  66.   "Add a pulldown menu for Hyperbole, if appropriate."
  67.   (and hyperb:window-system
  68.        (or hyperb:lemacs-p
  69.        (if hyperb:emacs19-p
  70.            (require 'lmenu)))
  71.        (require 'hui-menu)
  72.        ;; XEmacs or Emacs19 under a window system; add Hyperbole menu to
  73.        ;; menubar.
  74.        (hyperbole-menubar-menu)))
  75.  
  76. (defun hyperb:act-set ()
  77.   "COORDINATION IS NOT YET OPERATIONAL.  hui-coord.el IS NOT INCLUDED.
  78. Sets Hyperbole action command to uncoordinated or coordinated operation.
  79. Coordinated is used when 'hcoord:hosts' is a non-nil list.
  80. See \"hui-coord.el\"."
  81.   (interactive)
  82.   (fset 'hyperb:act (if (and (boundp 'hcoord:hosts) hcoord:hosts)
  83.              'hcoord:act 'hbut:act)))
  84.  
  85.  
  86. ;;; ************************************************************************
  87. ;;; Private functions
  88. ;;; ************************************************************************
  89.  
  90. (defun hyperb:check-dir-user ()
  91.   "Ensures 'hbmap:dir-user' exists and is writable or signals an error."
  92.   (if (or (null hbmap:dir-user) (not (stringp hbmap:dir-user))
  93.       (and (setq hbmap:dir-user (file-name-as-directory
  94.                      (expand-file-name hbmap:dir-user)))
  95.            (file-directory-p hbmap:dir-user)
  96.            (not (file-writable-p hbmap:dir-user))))
  97.       (error
  98.        "(hyperb:init): 'hbmap:dir-user' must be a writable directory name."))
  99.   (let ((hbmap:dir-user (directory-file-name hbmap:dir-user)))
  100.     (or (file-directory-p hbmap:dir-user)   ;; Exists and is writable.
  101.     (let* ((parent-dir (file-name-directory
  102.                 (directory-file-name hbmap:dir-user))))
  103.       (cond
  104.        ((not (file-directory-p parent-dir))
  105.         (error
  106.          "(hyperb:init): 'hbmap:dir-user' parent dir does not exist."))
  107.        ((not (file-writable-p parent-dir))
  108.         (error
  109.          "(hyperb:init): 'hbmap:dir-user' parent directory not writable."))
  110.        ((hypb:call-process-p "mkdir" nil nil hbmap:dir-user)
  111.         (or (file-writable-p hbmap:dir-user)
  112.         (or (progn (hypb:chmod '+ 700 hbmap:dir-user)
  113.                (file-writable-p hbmap:dir-user))
  114.             (error "(hyperb:init): Can't write to 'hbmap:dir-user'.")
  115.             )))
  116.        (t (error "(hyperb:init): 'hbmap:dir-user' create failed."))))))
  117.   t)
  118.  
  119. (provide 'hinit)
  120.  
  121.