annotate lisp/hyperbole/hui-mini.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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 ;;!emacs
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 ;; FILE: hui-mini.el
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 ;; SUMMARY: One line command menus for Hyperbole
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 ;; USAGE: GNU Emacs Lisp Library
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 ;; KEYWORDS: hypermedia, mouse
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 ;; AUTHOR: Bob Weiner
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 ;; ORG: Brown U.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 ;; ORIG-DATE: 15-Oct-91 at 20:13:17
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 ;; LAST-MOD: 3-Nov-95 at 04:02:02 by Bob Weiner
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 ;; This file is part of Hyperbole.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 ;; Available for use and distribution under the same terms as GNU Emacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 ;; Copyright (C) 1991-1995, Free Software Foundation, Inc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 ;; Developed with support from Motorola Inc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 ;; DESCRIPTION:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 ;; DESCRIP-END.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 ;;; Other required Elisp libraries
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 (require 'hypb)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 ;;; Public variables
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 (defvar hui:menu-select "\C-m"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 "*Upper case char-string which selects the Hyperbole menu item at point.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 (defvar hui:menu-quit "Q"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 "*Upper case char-string which quits selecting from a Hyperbole menu item.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 (defvar hui:menu-abort "\C-g"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 "*Same function as 'hui:menu-quit'.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 (defvar hui:menu-top "\C-t"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 "*Character which returns to top Hyperbole menu.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 (defvar hui:menu-p nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 "Non-nil iff a current Hyperbole menu activation exists.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 (defvar hui:menus nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 "Command menus for use with the default Hyperbole user interface.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 (setq
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 hui:menus
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 (delq nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 (list (cons
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 'hyperbole
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 (append
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 (let ((version (if (= (aref hyperb:version 0) ?0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 (substring hyperb:version 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 hyperb:version)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 (list (list (concat "Hy" version ">"))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 (delq nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 (list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 '("Act" hui:hbut-act
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 "Activates button at point or prompts for explicit button.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 '("Butfile/" (menu . butfile)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 "Quick access button files menus.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 '("Doc/" (menu . doc)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 "Quick access to Hyperbole documentation.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 '("Ebut/" (menu . ebut)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 "Explicit button commands.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 '("Gbut/" (menu . gbut)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 "Global button commands.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 '("Hist" (hhist:remove current-prefix-arg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 "Jumps back to location prior to last Hyperbole button follow.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 '("Ibut/" (menu . ibut)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 "Implicit button and button type commands.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 '("Msg/" (menu . msg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 "Mail and News messaging facilities.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 (if hyperb:kotl-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 '("Otl/" (menu . otl)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 "Autonumbered outlining and hyper-node facilities."))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 '("Rolo/" (menu . rolo)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 "Hierarchical, multi-file rolodex lookup and edit commands.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 '("Win/" (menu . win)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 "Window configuration management command.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 ))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 '(butfile .
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 (("Butfile>")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 ("DirFile" (find-file hbmap:filename)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 "Edits directory-specific button file.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 ("Info"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 (id-info "(hyperbole.info)Button Files")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 "Displays manual section on button files.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 ("PersonalFile" (find-file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 (expand-file-name hbmap:filename hbmap:dir-user))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 "Edits user-specific button file.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 '(doc .
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 (("Doc>")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 ("Demo" (find-file-read-only
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 (expand-file-name "DEMO" hyperb:dir))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 "Demonstrates Hyperbole features.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 ("Files" (find-file-read-only
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 (expand-file-name "MANIFEST" hyperb:dir))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 "Summarizes Hyperbole system files. Click on an entry to view it.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 ("Glossary"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 (id-info "(hyperbole.info)Glossary")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 "Glossary of Hyperbole terms.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 ("HypbCopy" (id-info "(hyperbole.info)Top")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 "Displays general Hyperbole copyright and license details.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 ("Info" (id-info "(hyperbole.info)Top")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 "Online Info version of Hyperbole manual.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 ("MailLists" (id-info "(hyperbole.info)Mail Lists")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 "Details on Hyperbole mail list subscriptions.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 ("New" (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 (hact 'link-to-regexp-match
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 "\\*[ \t]+What's New" 2
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 (expand-file-name "README" hyperb:dir))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 (setq buffer-read-only nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 (toggle-read-only))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 "Recent changes to Hyperbole.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 ("SmartKy" (find-file-read-only (hypb:mouse-help-file))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 "Summarizes Smart Key mouse or keyboard handling.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 ("Types/" (menu . types)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 "Provides documentation on Hyperbole types.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 '(ebut .
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 (("EButton>")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 ("Act" hui:hbut-act
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 "Activates button at point or prompts for explicit button.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 ("Create" hui:ebut-create)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 ("Delete" hui:ebut-delete)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 ("Edit" hui:ebut-modify "Modifies any desired button attributes.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 ("Help/" (menu . ebut-help) "Summarizes button attributes.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 ("Info"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 (id-info "(hyperbole.info)Explicit Buttons")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 "Displays manual section on explicit buttons.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 ("Modify" hui:ebut-modify "Modifies any desired button attributes.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 ("Rename" hui:ebut-rename "Relabels an explicit button.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 ("Search" hui:ebut-search
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 "Locates and displays personally created buttons in context.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 '(ebut-help .
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 (("Help on>")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 ("BufferButs" (hui:hbut-report -1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 "Summarizes all explicit buttons in buffer.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 ("CurrentBut" (hui:hbut-report)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 "Summarizes only current button in buffer.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 ("OrderedButs" (hui:hbut-report 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 "Summarizes explicit buttons in lexicographically order.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 '(gbut .
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 (("GButton>")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 ("Act" gbut:act "Activates global button by name.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 ("Create" hui:gbut-create "Adds a global button to gbut:file.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152 ("Edit" hui:gbut-modify "Modifies global button attributes.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 ("Help" gbut:help "Reports on a global button by name.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 ("Info" (id-info "(hyperbole.info)Global Buttons")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 "Displays manual section on global buttons.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 ("Modify" hui:gbut-modify "Modifies global button attributes.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 '(ibut .
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 (("IButton>")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 ("Act" hui:hbut-act "Activates implicit button at point.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 ("DeleteIButType" (hui:htype-delete 'ibtypes)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 "Deletes specified button type.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 ("Help" hui:hbut-help "Reports on button's attributes.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 ("Info" (id-info "(hyperbole.info)Implicit Buttons")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 "Displays manual section on implicit buttons.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 ("Types" (hui:htype-help 'ibtypes 'no-sort)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 "Displays documentation for one or all implicit button types.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 '(msg .
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 (("Msg>")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 ("Compose-Hypb-Mail"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 (hmail:compose "hyperbole@hub.ucsb.edu" '(hact 'hyp-config))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 "Send a message to the Hyperbole discussion list.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 ("Edit-Hypb-List-Entry"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 (hmail:compose "hyperbole-request@hub.ucsb.edu"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 '(hact 'hyp-request))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 "Add, remove or change your entry on a the Hyperbole mail list.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 ("Modify-Hypb-Announce-Entry"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 (hmail:compose "hyperbole-announce-request@hub.ucsb.edu"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 '(hact 'hyp-request))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 "Add, remove or change your entry on the Hyperbole Announce mail list.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 (if hyperb:kotl-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 '(otl
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 . (("Otl>")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 ("All" kotl-mode:show-all "Expand all collapsed cells.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 ("Blanks" kvspec:toggle-blank-lines
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 "Toggle blank lines between cells on or off.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 ("Create" kfile:find "Create or edit an outline file.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 ("Downto" kotl-mode:hide-sublevels
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 "Hide all cells in outline deeper than a particular level.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 ("Examp" (find-file-read-only
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 (expand-file-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 "EXAMPLE.kotl" (concat hyperb:dir "kotl/")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 "Display a self-descriptive example outline file.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 ("Hide" (progn (kotl-mode:is-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 (kotl-mode:hide-tree (kcell-view:label)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 "Collapse tree rooted at point.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 ("Info"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 (id-info "(hyperbole.info)Outliner")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 "Display manual section on Hyperbole outliner.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 ("Kill" kotl-mode:kill-tree
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 "Kill ARG following trees starting from point.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 ("Link" klink:create
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 "Create and insert an implicit link at point.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 ("Overvw" kotl-mode:overview
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 "Show first line of each cell.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 ("Show" (progn (kotl-mode:is-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 (kotl-mode:show-tree (kcell-view:label)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 "Expand tree rooted at point.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 ("Top" kotl-mode:top-cells
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 "Hide all but top-level cells.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 ("Vspec" kvspec:activate
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 "Prompt for and activate a view specifiction.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 )))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 '(rolo .
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 (("Rolo>")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 ("Add" rolo-add "Add a new rolo entry.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 ("Display" rolo-display-matches
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 "Display last found rolodex matches again.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 ("Edit" rolo-edit "Edit an existing rolo entry.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 ("Info" (id-info "(hyperbole.info)Rolodex")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 "Displays manual section on Hyperbole rolodex.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 ("Kill" rolo-kill "Kill an existing rolo entry.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 ("Mail" rolo-mail-to "Mail to address following point.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 ("Order" rolo-sort "Order rolo entries in a file.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227 ("RegexFind" rolo-grep "Find entries containing a regexp.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228 ("StringFind" rolo-fgrep "Find entries containing a string.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 ("WordFind" rolo-word "Find entries containing words.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230 ("Yank" rolo-yank
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231 "Find an entry containing a string and insert it at point.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232 ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233 '(types .
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 (("Types>")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 ("ActionTypes" (hui:htype-help 'actypes)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236 "Displays documentation for one or all action types.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 ("IButTypes" (hui:htype-help 'ibtypes 'no-sort)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 "Displays documentation for one or all implicit button types.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240 '(win .
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 (("WinConfig>")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 ("AddName" wconfig-add-by-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 "Name current window configuration.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 ("DeleteName" wconfig-delete-by-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 "Delete named window configuration.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246 ("RestoreName" wconfig-restore-by-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 "Restore frame to window configuration given by name.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 ("PopRing" (progn (wconfig-delete-pop)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 (hyperbole 'win))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 "Restores window configuration from ring and removes it from ring.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251 ("SaveRing" (wconfig-ring-save)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252 "Saves current window configuration to ring.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 ("YankRing" (progn (call-interactively 'wconfig-yank-pop)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 (hyperbole 'win))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255 "Restores next window configuration from ring.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 ))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 )))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260 ;;; Public functions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263 ;;; Old name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264 (fset 'hui:menu 'hyperbole)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266 ;;; Used as autoloaded main entry point to Hyperbole (but hsite.el) is the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267 ;;; file that is autoloaded when this is invoked.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268 ;;; It brings up a menu of commands.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269 (defun hyperbole (&optional menu menu-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270 "Invokes default Hyperbole menu user interface when not already active.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271 Suitable for binding to a key, e.g. {C-h h}.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 Non-interactively, returns t if menu is actually invoked by call, else nil.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274 Two optional arguments may be given to invoke alternative menus.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275 MENU (a symbol) specifies the menu to invoke from MENU-LIST, (a
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276 Hyperbole menu list structure). MENU defaults to 'hyperbole and MENU-LIST
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277 to `hui:menus'. See `hui:menus' definition for the format of the menu list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278 structure."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281 (if (and hui:menu-p (> (minibuffer-depth) 0))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282 (progn (beep) nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283 (unwind-protect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285 (require 'hsite) ;; Since "hui-mini" may be loaded without loading
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286 ;; all of Hyperbole.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287 (hyperb:init-menubar)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288 (setq hui:menu-p t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289 (hui:menu-act (or menu 'hyperbole) menu-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290 t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291 (setq hui:menu-p nil))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293 (defun hui:menu-act (menu &optional menu-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294 "Prompts user with Hyperbole MENU (a symbol) and performs selected item.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295 Optional second argument MENU-LIST is a Hyperbole menu list structure from
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296 which to extract MENU. It defaults to `hui:menus'. See its definition for
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297 the menu list structure."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298 (let ((set-menu '(or (and menu (symbolp menu)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299 (setq menu-alist
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300 (cdr (assq menu (or menu-list hui:menus)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
301 (hypb:error "(menu-act): Invalid menu symbol arg: %s"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302 menu)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303 (show-menu t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
304 (rtn)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
305 menu-alist act-form)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306 (while (and show-menu (eval set-menu))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
307 (cond ((and (consp (setq act-form (hui:menu-select menu-alist)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
308 (cdr act-form)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309 (symbolp (cdr act-form)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
310 ;; Display another menu
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311 (setq menu (cdr act-form)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312 (act-form
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313 (let ((prefix-arg current-prefix-arg))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314 (cond ((symbolp act-form)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
315 (if (eq act-form t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
316 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
317 (setq show-menu nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
318 rtn (call-interactively act-form))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
319 ((stringp act-form)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
320 (hui:menu-help act-form)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
321 ;; Loop and show menu again.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
322 )
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
323 (t (setq show-menu nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324 rtn (eval act-form))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
325 (t (setq show-menu nil))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
326 rtn))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
327
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
328 (defun hui:menu-enter (&optional char-str)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
329 "Uses CHAR-STR or last input character as minibuffer argument."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
330 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
331 (let ((input (or char-str (aref (recent-keys) (1- (length (recent-keys)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332 (cond (hyperb:emacs19-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333 (and (not (integerp input))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334 (eventp input)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
335 (setq input (event-basic-type input))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
336 (hyperb:lemacs-p
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
337 (if (eventp input)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338 (setq input (event-to-character input)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
339 (if (or (symbolp input)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
340 (and (integerp input)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
341 (= input ?\r)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
342 (setq input (hargs:at-p)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
343 (erase-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
344 (or (symbolp input) (insert input)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
345 (exit-minibuffer))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
346
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
347 (defun hui:menu-help (help-str)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
348 "Displays HELP-STR in a small window. HELP-STR must be a string."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
349 (let* ((window-min-height 2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
350 (owind (selected-window))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
351 (buf-name (hypb:help-buf-name "Menu")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
352 (unwind-protect
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
353 (progn
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
354 (save-window-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
355 (hkey-help-show buf-name)) ;; Needed to save wconfig.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
356 (if (eq (selected-window) (minibuffer-window))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
357 (other-window 1))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
358 (if (= (length (hypb:window-list 'no-mini)) 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
359 (split-window-vertically nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
360 (select-window (hui:bottom-window))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
361 (switch-to-buffer (get-buffer-create buf-name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
362 (setq buffer-read-only nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
363 (erase-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
364 (insert "\n" help-str)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
365 (set-buffer-modified-p nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
366 (shrink-window
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
367 (- (window-height)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
368 (+ 3 (length
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
369 (delq nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
370 (mapcar (function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
371 (lambda (chr) (= chr ?\n)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
372 help-str)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
373 (select-window owind))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
374
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
375 (defun hui:menu-xemacs (&optional menu menu-list)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
376 "Returns an XEmacs menu built from Hyperbole type menus.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
377 Optional MENU (a symbol) specifies a specific submenu of optional MENU-LIST.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
378 a Hyperbole menu list structure. Otherwise, all menus are used.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
379 MENU defaults to 'hyperbole and MENU-LIST to `hui:menus'. See `hui:menus'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
380 definition for the format of the menu list structure."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
381 (mapcar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
382 (function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
383 (lambda (entry)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
384 (or (consp entry)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
385 (error "(hui:menu-xemacs): Invalid menu entry: %s" entry))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
386 (let ((label (car entry))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
387 (content (car (cdr entry))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
388 (cond ((null content) (hypb:replace-match-string ">$" label "" t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
389 ((and (consp content) (eq (car content) 'menu))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
390 (hui:menu-xemacs (cdr content)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
391 (t (vector label content 't))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
392 (cdr (assq (or menu 'hyperbole) (or menu-list hui:menus)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
393
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
394 (defun hui:menu-select (menu-alist)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
395 "Prompts user to choose the first character of any item from MENU-ALIST.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
396 Case is not significant. If chosen by direct selection with the Assist Key,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
397 returns any help string for item, else returns the action form for the item."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
398 (let* ((menu-line (hui:menu-line menu-alist))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
399 (set:equal-op 'eq)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
400 (select-char (string-to-char hui:menu-select))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
401 (quit-char (string-to-char hui:menu-quit))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
402 (abort-char (string-to-char hui:menu-abort))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
403 (top-char (string-to-char hui:menu-top))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
404 (item-keys (mapcar (function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
405 (lambda (item) (aref item 0)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
406 (mapcar 'car (cdr menu-alist))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
407 (keys (apply 'list select-char quit-char abort-char
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
408 top-char item-keys))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
409 (key 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
410 (hargs:reading-p 'hmenu)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
411 sublist)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
412 (while (not (memq (setq key (upcase
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
413 (string-to-char
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
414 (read-from-minibuffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
415 "" menu-line hui:menu-mode-map))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
416 keys))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
417 (beep)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
418 (setq hargs:reading-p 'hmenu)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
419 (discard-input))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
420 (cond ((eq key quit-char) nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
421 ((eq key abort-char) (beep) nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
422 ((eq key top-char) '(menu . hyperbole))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
423 ((and (eq key select-char)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
424 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
425 (if (search-backward " " nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
426 (progn (skip-chars-forward " ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
427 (setq key (following-char))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
428 nil) ;; Drop through.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
429 t))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
430 (t (if (setq sublist (memq key item-keys))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
431 (let* ((label-act-help-list
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
432 (nth (- (1+ (length item-keys)) (length sublist))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
433 menu-alist))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
434 (act-form (car (cdr label-act-help-list))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
435 (if (eq hargs:reading-p 'hmenu-help)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
436 (let ((help-str
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
437 (or (car (cdr (cdr label-act-help-list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
438 "No help documentation for this item.")))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
439 (concat (car label-act-help-list) "\n "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
440 help-str "\n Action: "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
441 (prin1-to-string act-form)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
442 act-form)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
443
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
444 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
445 ;;; Private functions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
446 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
447
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
448 (if (fboundp 'window-lowest-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
449 (defun hui:bottom-window ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
450 "Return a window that is at the bottom of the selected frame."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
451 (let ((winds (hypb:window-list 'no-mini))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
452 (window))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
453 (while (and (not window) winds)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
454 (if (window-lowest-p (car winds))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
455 (setq window (car winds))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
456 (setq winds (cdr winds))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
457 window))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
458 (defun hui:bottom-window ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
459 "Return a window that is at the bottom of the selected frame."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
460 (let* ((winds (hypb:window-list 'no-mini))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
461 (bot-list (mapcar
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
462 (function
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
463 (lambda (wind)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
464 (nth 3 (window-edges wind))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
465 winds))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
466 (bot (apply 'max bot-list)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
467 (nth (- (length winds) (length (memq bot bot-list))) winds))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
468
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
469 (defun hui:menu-line (menu-alist)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
470 "Returns a menu line string built from MENU-ALIST."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
471 (let ((menu-prompt (concat (car (car menu-alist)) " "))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
472 (menu-items (mapconcat 'car (cdr menu-alist) " "))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
473 menu-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
474 (setq menu-line (concat menu-prompt menu-items))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
475 ;; Narrow menu by changing 2 spaces to 1 if too wide for current frame.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
476 (if (>= (length menu-line) (1- (frame-width)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
477 (concat menu-prompt (mapconcat 'car (cdr menu-alist) " "))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
478 menu-line)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
479
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
480 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
481 ;;; Private variables
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
482 ;;; ************************************************************************
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
483
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
484 ;; Hyperbole menu mode is suitable only for specially formatted data.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
485 (put 'hui:menu-mode 'mode-class 'special)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
486
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
487 (defvar hui:menu-mode-map nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
488 "Keymap containing hui:menu commands.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
489 (if hui:menu-mode-map
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
490 nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
491 (setq hui:menu-mode-map (make-keymap))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
492 (suppress-keymap hui:menu-mode-map)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
493 (define-key hui:menu-mode-map hui:menu-quit 'hui:menu-enter)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
494 (define-key hui:menu-mode-map hui:menu-abort 'hui:menu-enter)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
495 (define-key hui:menu-mode-map hui:menu-top 'hui:menu-enter)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
496 (define-key hui:menu-mode-map hui:menu-select 'hui:menu-enter)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
497 ;;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
498 ;; This next binding is necessary since the default button1 binding under
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
499 ;; XEmacs, mouse-track, is broken under XEmacs V19.8.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
500 (and hyperb:lemacs-p window-system
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
501 (define-key hui:menu-mode-map 'button1 'mouse-set-point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
502 (let ((i 32))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
503 (while (<= i 126)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
504 (define-key hui:menu-mode-map (char-to-string i) 'hui:menu-enter)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
505 (setq i (1+ i)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
506
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
507 (provide 'hui-mini)