1 ;;; hsys-hbase.el --- Hyperbole support for the Hyperbase system.
3 ;; Copyright (C) 1991, 1995, Free Software Foundation, Inc.
4 ;; Developed with support from Motorola Inc.
6 ;; Author: Bob Weiner, Brown U.
7 ;; Maintainer: Mats Lidell <matsl@contactor.se>
8 ;; Keywords: comm, hypermedia
10 ;; This file is part of GNU Hyperbole.
12 ;; GNU Hyperbole is free software; you can redistribute it and/or
13 ;; modify it under the terms of the GNU General Public License as
14 ;; published by the Free Software Foundation; either version 3, or (at
15 ;; your option) any later version.
17 ;; GNU Hyperbole is distributed in the hope that it will be useful,
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 ;; General Public License for more details.
22 ;; You should have received a copy of the GNU General Public License
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the
24 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
25 ;; Boston, MA 02110-1301, USA.
29 ;; For information and the source to HyperBase and follow-on hypermedia
30 ;; work, see: ftp://ftp.iesd.auc.dk/pub/packages/hypertext/
32 ;; In order to use this package, you must have the HyperBase system
33 ;; and must start up a HyperBase server and then load the HyperBase
34 ;; Epoch support software that comes with the HyperBase system.
36 ;; Then load this package and Hyperbole will do the following when
37 ;; in a Hyperbase buffer:
39 ;; Action Key press on a button follows the link, within any other
40 ;; text, closes current Epoch screen and kills node buffer.
42 ;; Assist Key press shows attributes for the current button or
43 ;; for the current node buffer, if no current button.
49 ;;; Other required Elisp libraries
59 "Detects link buttons in buffers that communicate with the Hyperbase system.
60 Hyperbase is a hypertext database system that interfaces to Emacs."
61 (and (boundp 'ehts-mode) ehts-mode
62 (let ((lbl (or (ebut:label-p 'as-label "[-> " "]")
65 (hact 'hyperbase lbl))))
67 (defact hyperbase (linkname)
68 "Follows LINKNAME in a buffer that communicates with the Hyperbase system.
69 If LINKNAME equals t, closes the current Epoch screen and kill the
70 buffer of the current Hyperbase node.
71 Hyperbase is a hypertext database system that interfaces to Emacs."
72 ;; From hb-EHTS.el by:
73 ;; Uffe Kock Wiil (kock@iesd.auc.dk)
74 ;; Claus Bo Nielsen (cbn@cci.dk)
76 (if (equal linkname "no-but")
77 (progn (ehts-mouse-kill-screen-and-buffer t)
78 (and (fboundp 'epoch::select-screen)
79 (epoch::select-screen)))
80 (let ((linknum (cdr (assoc linkname ehts-node-link-alist))) tonode)
82 (if (< (ehts-hb-sys-call "read" linknum "to data node no" nil t) 0)
85 (error "Can't read \"to data node no\" in link, panic !!!")))
87 (setq tonode (ehts-read-4bytes))
88 (if (< (ehts-hb-sys-call "read" tonode "n name" nil t) 0)
91 (error "Can't read \"name\" in data node, panic !!!")))
92 (ehts-get-node (ehts-read-null-string))
93 (and (fboundp 'hproperty:but-create-all)
94 (hproperty:but-create-all "[-> " "]"))
101 (defun hyperbase:init ()
102 "Show initial set of Hyperbase buttons."
103 (if (assoc (user-full-name) ehts-node-name-alist)
105 (ehts-get-node (user-full-name))
107 (setq buffer "*Ehts Welcome*")
108 (setq screen (ehts-find-buffer-screen buffer))
110 (switch-to-buffer (user-full-name))
111 (remove-screen screen)))
112 (if (assoc "dir ehts help" ehts-node-name-alist)
114 (ehts-get-node "dir ehts help")
116 (setq buffer "*Ehts Welcome*")
117 (setq screen (ehts-find-buffer-screen buffer))
119 (switch-to-buffer "dir ehts help")
120 (remove-screen screen)
121 (hproperty:but-create "[-> " "]"))))))
123 (defun hyperbase:help (&optional but)
124 "Displays attributes of a link button BUT if on one or of the current node.
125 Hyperbase is a hypertext database system that interfaces to Emacs."
126 (interactive (list (ibut:at-p)))
127 (or (and (boundp 'ehts-mode) ehts-mode)
128 (error "(hyperbase:help): Not in a Hyperbase mode buffer."))
130 (or (and (symbolp but)
131 (let ((lbl (ebut:key-to-label (hattr:get but 'lbl-key))))
132 (if (not (equal lbl "no-but")) lbl)))
136 ;;; Private functions
139 (defun hyperbase:already-displayed-p (name)
140 "Test if a buffer allready is displayed."
142 (setq screenid (ehts-find-buffer-screen name))
145 (switch-screen screenid)
149 (defun hyperbase:attr-help (node-link-spec)
150 "Show the attributes of a node or a button link from NODE-LINK-SPEC.
151 A string value of NODE-LINK-SPEC means show attributes for that button link.
152 A buffer value means show attributes for the node in that buffer."
154 (or (stringp node-link-spec) (bufferp node-link-spec)
155 (error "(hyperbase-show-attributes): Non-string or buffer argument."))
156 (let (entity name string number buffer screenid)
157 (setq buffer (if (bufferp node-link-spec) (buffer-name node-link-spec))
158 entity (cdr (assoc (if buffer "node" "link") node-link-list))
159 buffer (or buffer (buffer-name)))
160 (if (eq (string-match "Attributes - " buffer) 0)
164 (setq name (concat "Attributes - " buffer))
165 (if (not (hyperbase:already-displayed-p name))
167 (setq number (cdr (assoc buffer ehts-node-name-alist))
168 string (ehts-create-node-attribute-string number))
169 (ehts-setup-attribute-screen name string entity buffer))))
170 (if (eq ehts-node-link-alist '())
171 (error "No links in this node."))
172 (setq name (concat "Attributes - "
173 (car (assoc node-link-spec ehts-node-link-alist))))
174 (if (not (hyperbase:already-displayed-p name))
176 (setq number (cdr (assoc (substring name 13)
177 ehts-node-link-alist))
178 string (ehts-create-link-attribute-string number))
179 (ehts-setup-attribute-screen name string entity buffer)))))))
182 ;;; Private variables
185 (provide 'hsys-hbase)
187 ;;; hsys-hbase.el ends here