0
|
1 ;;!emacs
|
|
2 ;;
|
|
3 ;; FILE: hui-menu.el
|
|
4 ;; SUMMARY: InfoDock/Emacs menubar menu of Hyperbole commands.
|
|
5 ;; USAGE: GNU Emacs Lisp Library
|
|
6 ;; KEYWORDS: hypermedia, mouse
|
|
7 ;;
|
|
8 ;; AUTHOR: Bob Weiner
|
100
|
9 ;; ORG: InfoDock Associates
|
0
|
10 ;;
|
|
11 ;; ORIG-DATE: 28-Oct-94 at 10:59:44
|
114
|
12 ;; LAST-MOD: 14-Mar-97 at 01:35:02 by Bob Weiner
|
0
|
13 ;;
|
100
|
14 ;; Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
|
0
|
15 ;;
|
|
16 ;; This file is part of Hyperbole.
|
|
17 ;;
|
|
18 ;; DESCRIPTION:
|
|
19 ;; DESCRIP-END.
|
|
20
|
|
21 ;;; ************************************************************************
|
|
22 ;;; Other required Elisp libraries
|
|
23 ;;; ************************************************************************
|
|
24
|
|
25 (require 'wrolo-menu)
|
|
26
|
|
27 ;;; ************************************************************************
|
|
28 ;;; Public functions
|
|
29 ;;; ************************************************************************
|
|
30
|
|
31 ;; Add Hyperbole menu to menubar.
|
|
32 (defun hyperbole-menubar-menu ()
|
|
33 "Add the Hyperbole menu to the global menubar."
|
|
34 (if hyperb:emacs19-p (require 'lmenu))
|
|
35 (if (and (boundp 'current-menubar)
|
|
36 (or hyperb:emacs19-p current-menubar)
|
|
37 (not (car (find-menu-item current-menubar '("Hyperbole")))))
|
|
38 (let ((add-before (if (and (boundp 'infodock-menubar-type)
|
|
39 (eq infodock-menubar-type 'menubar-infodock))
|
|
40 "Key" nil)))
|
|
41 (if (fboundp 'add-submenu)
|
|
42 (add-submenu nil infodock-hyperbole-menu add-before)
|
|
43 (add-menu nil (car infodock-hyperbole-menu)
|
|
44 (cdr infodock-hyperbole-menu) add-before)))))
|
|
45
|
|
46 ;;; ************************************************************************
|
|
47 ;;; Public variables
|
|
48 ;;; ************************************************************************
|
|
49
|
100
|
50 ;; Ensure that this variable is defined to avert any error within
|
|
51 ;; the Customization menu.
|
|
52 (defvar highlight-headers-follow-url-netscape-new-window nil
|
|
53 "*Whether to make Netscape create a new window when a URL is sent to it.")
|
|
54
|
|
55 (defconst hui-menu-options
|
|
56 (append '("Display-Referents-in"
|
|
57 "----"
|
|
58 "----")
|
|
59 (mapcar (function (lambda (sym)
|
|
60 (vector
|
|
61 (capitalize (symbol-name sym))
|
|
62 (` (setq hpath:display-where '(, sym)))
|
|
63 :style 'radio
|
|
64 :selected (` (eq hpath:display-where
|
|
65 '(, sym))))))
|
|
66 (mapcar 'car hpath:display-where-alist))
|
|
67 '("----"
|
|
68 "Display-URLs-in"
|
|
69 "----"
|
|
70 "----"
|
|
71 ["Here"
|
|
72 (setq action-key-url-function 'w3-fetch
|
|
73 highlight-headers-follow-url-function
|
|
74 action-key-url-function)
|
|
75 :style radio
|
|
76 :selected (eq action-key-url-function 'w3-fetch)]
|
|
77 ["Current-Netscape-Window"
|
|
78 (setq action-key-url-function
|
|
79 'highlight-headers-follow-url-netscape
|
|
80 highlight-headers-follow-url-function
|
|
81 action-key-url-function
|
|
82 highlight-headers-follow-url-netscape-new-window
|
|
83 nil)
|
|
84 :style radio
|
|
85 :selected
|
|
86 (and (eq action-key-url-function
|
|
87 'highlight-headers-follow-url-netscape)
|
|
88 (not highlight-headers-follow-url-netscape-new-window))]
|
|
89 ["New-Netscape-Window"
|
|
90 (setq action-key-url-function
|
|
91 'highlight-headers-follow-url-netscape
|
|
92 highlight-headers-follow-url-function
|
|
93 action-key-url-function
|
|
94 highlight-headers-follow-url-netscape-new-window
|
|
95 t)
|
|
96 :style radio
|
|
97 :selected
|
|
98 (and (eq action-key-url-function
|
|
99 'highlight-headers-follow-url-netscape)
|
|
100 highlight-headers-follow-url-netscape-new-window)]
|
|
101 ["Mosaic"
|
|
102 (setq action-key-url-function
|
|
103 'highlight-headers-follow-url-mosaic
|
|
104 highlight-headers-follow-url-function
|
|
105 action-key-url-function)
|
|
106 :style radio
|
|
107 :selected (eq action-key-url-function
|
|
108 'highlight-headers-follow-url-mosaic)]
|
|
109 )
|
|
110 '("----"
|
|
111 "Smart-Key-Press-at-Eol"
|
|
112 "----"
|
|
113 "----"
|
|
114 ["Scrolls-a-Windowful"
|
|
115 (setq smart-scroll-proportional nil)
|
|
116 :style radio :selected (null smart-scroll-proportional)]
|
|
117 ["Scrolls-Proportionally"
|
|
118 (setq smart-scroll-proportional t)
|
|
119 :style radio :selected smart-scroll-proportional]
|
114
|
120 )
|
|
121 '("----"
|
|
122 ["Toggle-Rolodex-Dates" rolo-toggle-datestamps
|
|
123 :style toggle :selected (and (boundp 'wrolo-add-hook)
|
|
124 (listp wrolo-add-hook)
|
|
125 (memq 'rolo-set-date wrolo-add-hook))]
|
100
|
126 ))
|
|
127 "Untitled menu of Hyperbole options.")
|
|
128
|
0
|
129 ;;; Don't change this name; doing so will break the way InfoDock
|
|
130 ;;; initializes the Hyperbole menu.
|
|
131 (defconst infodock-hyperbole-menu
|
|
132 (delq nil
|
|
133 (list
|
|
134 "Hyperbole"
|
114
|
135 :config 'Hyperbole
|
100
|
136 '["About" (hypb:display-file-with-logo
|
|
137 (expand-file-name "ABOUT" hyperb:dir)) t]
|
|
138 '["Manual" (id-info "(hyperbole.info)Top") t]
|
0
|
139 "----"
|
100
|
140 '["Activate-Button-at-Point" hui:hbut-current-act t]
|
0
|
141 '["Back-to-Prior-Location" (hhist:remove current-prefix-arg) t]
|
|
142 '("Button-File"
|
|
143 ["Manual" (id-info "(hyperbole.info)Button Files") t]
|
|
144 "----"
|
|
145 ["Edit-Per-Directory-File" (find-file hbmap:filename) t]
|
|
146 ["Edit-Personal-File" (find-file
|
|
147 (expand-file-name
|
|
148 hbmap:filename hbmap:dir-user)) t]
|
|
149 )
|
100
|
150 (cons "Customization" hui-menu-options)
|
0
|
151 '("Documentation"
|
|
152 ["Manual" (id-info "(hyperbole.info)Top") t]
|
|
153 "----"
|
|
154 ["Copyright" (id-info "(hyperbole.info)Top") t]
|
|
155 ["Demonstration" (find-file-read-only
|
|
156 (expand-file-name "DEMO" hyperb:dir)) t]
|
|
157 ["Manifest" (find-file-read-only
|
|
158 (expand-file-name "MANIFEST" hyperb:dir)) t]
|
|
159 ["Glossary" (id-info "(hyperbole.info)Glossary") t]
|
|
160 ["Mail-Lists" (id-info "(hyperbole.info)Mail Lists") t]
|
|
161 ["New-Features" (progn
|
|
162 (hact 'link-to-regexp-match
|
|
163 "\\*[ \t]+What's New" 2
|
|
164 (expand-file-name "README" hyperb:dir))
|
|
165 (setq buffer-read-only nil)
|
|
166 (toggle-read-only)) t]
|
|
167 ["Smart-Key-Summary" (id-browse-file (hypb:mouse-help-file)) t]
|
|
168 )
|
|
169 '("Explicit-Button"
|
100
|
170 :filter hui-menu-explicit-buttons
|
|
171 ["Activate" hui:hbut-act t]
|
0
|
172 ["Create" hui:ebut-create t]
|
|
173 ["Delete" hui:ebut-delete t]
|
|
174 ["Edit" hui:ebut-modify t]
|
|
175 ("Help"
|
|
176 ["Manual" (id-info "(hyperbole.info)Location") t]
|
|
177 "----"
|
|
178 ["Buffer-Buttons" (hui:hbut-report -1) t]
|
|
179 ["Current-Button" (hui:hbut-report) t]
|
|
180 ["Ordered-Buttons" (hui:hbut-report 1) t]
|
|
181 )
|
|
182 ["Modify" hui:ebut-modify t]
|
|
183 ["Rename" hui:ebut-rename t]
|
|
184 ["Search" hui:ebut-search t]
|
|
185 )
|
|
186 '("Global-Button"
|
100
|
187 :filter hui-menu-global-buttons
|
0
|
188 ["Create" hui:gbut-create t]
|
|
189 ["Edit" hui:gbut-modify t]
|
|
190 ["Help" gbut:help t]
|
|
191 ["Modify" hui:gbut-modify t]
|
|
192 )
|
|
193 '("Implicit-Button"
|
|
194 ["Manual" (id-info "(hyperbole.info)Implicit Buttons") t]
|
|
195 "----"
|
100
|
196 ["Activate-at-Point" hui:hbut-current-act t]
|
0
|
197 ["Delete-Type" (hui:htype-delete 'ibtypes) t]
|
|
198 ["Help" hui:hbut-help t]
|
|
199 ["Types" (hui:htype-help 'ibtypes 'no-sort) t]
|
|
200 )
|
|
201 '("Mail-Lists"
|
|
202 ["Manual" (id-info "(hyperbole.info)Suggestion or Bug Reporting")
|
|
203 t]
|
|
204 "----"
|
|
205 ["Change-Hyperbole-Address"
|
100
|
206 (hmail:compose "hyperbole-request@infodock.com"
|
0
|
207 '(hact 'hyp-request)) t]
|
|
208 ["Change-Hyperbole-Announce-Address"
|
100
|
209 (hmail:compose "hyperbole-request@infodock.com"
|
0
|
210 '(hact 'hyp-request)) t]
|
|
211 ["Mail-to-Hyperbole-List"
|
100
|
212 (hmail:compose "hyperbole@infodock.com" '(hact 'hyp-config)) t]
|
0
|
213 )
|
|
214 (if hyperb:kotl-p
|
|
215 '("Outline"
|
|
216 ["Manual" (id-info "(hyperbole.info)Outliner") t]
|
|
217 ["Example" (find-file-read-only
|
|
218 (expand-file-name
|
|
219 "EXAMPLE.kotl" (concat hyperb:dir "kotl/")))
|
|
220 t]
|
|
221 "----"
|
|
222 ["Create-File" kfile:find t]
|
|
223 ["View-File" kfile:view t]
|
|
224 "----"
|
|
225 ["Collapse-Tree" (progn (kotl-mode:is-p)
|
|
226 (kotl-mode:hide-tree
|
|
227 (kcell-view:label))) t]
|
|
228 ["Create-Link" klink:create t]
|
|
229 ["Expand-All-Trees" kotl-mode:show-all t]
|
|
230 ["Expand-Tree" (progn (kotl-mode:is-p)
|
|
231 (kotl-mode:show-tree
|
|
232 (kcell-view:label))) t]
|
|
233 ["Show-Top-Level-Only" kotl-mode:hide-body t]
|
|
234 ))
|
|
235 infodock-wrolo-menu
|
|
236 '("Types"
|
|
237 ["Action-Types-Manual"
|
|
238 (id-info "(hyperbole.info)Action Types") t]
|
|
239 ["Implicit-Button-Types-Manual"
|
|
240 (id-info "(hyperbole.info)Implicit Buttons") t]
|
|
241 "----"
|
|
242 ["Action-Types" (hui:htype-help 'actypes) t]
|
|
243 ["Implicit-Button-Types" (hui:htype-help 'ibtypes 'no-sort) t]
|
|
244 )
|
|
245 '("Window-Configuration"
|
|
246 ["Manual" (id-info "(hyperbole.info)Window Configurations") t]
|
|
247 "----"
|
|
248 ["Name-Configuration" wconfig-add-by-name t]
|
|
249 ["Delete-Name" wconfig-delete-by-name t]
|
|
250 ["Restore-Name" wconfig-restore-by-name t]
|
|
251 "----"
|
|
252 ["Pop-from-Ring" wconfig-delete-pop t]
|
|
253 ["Save-to-Ring" wconfig-ring-save t]
|
|
254 ["Yank-from-Ring" wconfig-yank-pop t]
|
|
255 )
|
|
256 '["Quit" (progn
|
|
257 ;; Delete Hyperbole menu item from all menubars.
|
|
258 (mapcar
|
|
259 (function
|
|
260 (lambda (buf)
|
|
261 (set-buffer buf)
|
|
262 (if (assoc "Hyperbole" current-menubar)
|
|
263 (delete-menu-item '("Hyperbole")))))
|
|
264 (buffer-list))
|
|
265 ;;
|
|
266 ;; Remove Hyperbole button comment from future
|
|
267 ;; outgoing mail.
|
|
268 (if (boundp 'smail:comment)
|
|
269 (setq smail:comment "")))
|
|
270 t]
|
|
271 )))
|
|
272
|
|
273 ;;; ************************************************************************
|
100
|
274 ;;; Private functions
|
|
275 ;;; ************************************************************************
|
|
276
|
|
277 (defvar hui-menu-max-list-length 24
|
|
278 "Positive integer that caps the length of a dynamic menu list.")
|
|
279
|
|
280 (defvar hui-menu-order-explicit-buttons t
|
|
281 "When non-nil (default), explicit button menu list is lexicographically ordered.
|
|
282 Otherwise, explicit buttons are listed in their order of appearance within
|
|
283 the current buffer.")
|
|
284
|
|
285 ;; List explicit buttons in the current buffer for menu activation.
|
|
286 (defun hui-menu-explicit-buttons (rest-of-menu)
|
|
287 (delq nil
|
|
288 (append
|
|
289 '(["Manual" (id-info "(hyperbole.info)Explicit Buttons") t]
|
|
290 "----")
|
|
291 (let ((labels (ebut:list))
|
|
292 (cutoff))
|
|
293 (if labels
|
|
294 (progn
|
|
295 ;; Cutoff list if too long.
|
|
296 (if (setq cutoff (nthcdr (1- hui-menu-max-list-length) labels))
|
|
297 (setcdr cutoff nil))
|
|
298 (delq nil
|
|
299 (append
|
|
300 '("----"
|
|
301 ["Alphabetize-List"
|
|
302 (setq hui-menu-order-explicit-buttons
|
|
303 (not hui-menu-order-explicit-buttons))
|
|
304 :style toggle :selected hui-menu-order-explicit-buttons]
|
|
305 "Activate:")
|
|
306 (mapcar (function (lambda (label)
|
|
307 (vector label `(ebut:act ,label) t)))
|
|
308 (if hui-menu-order-explicit-buttons
|
|
309 (sort labels 'string-lessp)
|
|
310 labels))
|
|
311 (if cutoff '(". . ."))
|
|
312 '("----" "----"))))))
|
|
313 rest-of-menu)))
|
|
314
|
|
315 ;; List existing global buttons for menu activation.
|
|
316 (defun hui-menu-global-buttons (rest-of-menu)
|
|
317 (delq nil
|
|
318 (append
|
|
319 '(["Manual" (id-info "(hyperbole.info)Global Buttons") t]
|
|
320 "----")
|
|
321 (let ((labels (gbut:label-list))
|
|
322 (cutoff))
|
|
323 (if labels
|
|
324 (progn
|
|
325 ;; Cutoff list if too long.
|
|
326 (if (setq cutoff (nthcdr (1- hui-menu-max-list-length) labels))
|
|
327 (setcdr cutoff nil))
|
|
328 (delq nil
|
|
329 (append
|
|
330 '("----" "Activate:")
|
|
331 (mapcar (function (lambda (label)
|
|
332 (vector label `(gbut:act ,label) t)))
|
|
333 (sort labels 'string-lessp))
|
|
334 (if cutoff '(". . ."))
|
|
335 '("----" "----"))))))
|
|
336 rest-of-menu)))
|
|
337
|
|
338 ;;; ************************************************************************
|
0
|
339 ;;; Private variables
|
|
340 ;;; ************************************************************************
|
|
341
|
|
342 (provide 'hui-menu)
|