comparison lisp/menubar-items.el @ 442:abe6d1db359e r21-2-36

Import from CVS: tag r21-2-36
author cvs
date Mon, 13 Aug 2007 11:35:02 +0200
parents 8de8e3f6228a
children 576fb035e263
comparison
equal deleted inserted replaced
441:72a7cfa4a488 442:abe6d1db359e
1 ;;; menubar-items.el --- Menubar and popup-menu content for XEmacs. 1 ;;; menubar-items.el --- Menubar and popup-menu content for XEmacs.
2 2
3 ;; Copyright (C) 1991-1995, 1997-1998 Free Software Foundation, Inc. 3 ;; Copyright (C) 1991-1995, 1997-1998 Free Software Foundation, Inc.
4 ;; Copyright (C) 1995 Tinker Systems and INS Engineering Corp. 4 ;; Copyright (C) 1995 Tinker Systems and INS Engineering Corp.
5 ;; Copyright (C) 1995 Sun Microsystems. 5 ;; Copyright (C) 1995 Sun Microsystems.
6 ;; Copyright (C) 1995, 1996 Ben Wing. 6 ;; Copyright (C) 1995, 1996, 2000 Ben Wing.
7 ;; Copyright (C) 1997 MORIOKA Tomohiko 7 ;; Copyright (C) 1997 MORIOKA Tomohiko.
8 8
9 ;; Maintainer: XEmacs Development Team 9 ;; Maintainer: XEmacs Development Team
10 ;; Keywords: frames, extensions, internal, dumped 10 ;; Keywords: frames, extensions, internal, dumped
11 11
12 ;; This file is part of XEmacs. 12 ;; This file is part of XEmacs.
24 ;; You should have received a copy of the GNU General Public License 24 ;; You should have received a copy of the GNU General Public License
25 ;; along with Xmacs; see the file COPYING. If not, write to the 25 ;; along with Xmacs; see the file COPYING. If not, write to the
26 ;; Free Software Foundation, 59 Temple Place - Suite 330, 26 ;; Free Software Foundation, 59 Temple Place - Suite 330,
27 ;; Boston, MA 02111-1307, USA. 27 ;; Boston, MA 02111-1307, USA.
28 28
29 ;;; Authorship:
30
31 ;; Created c. 1991 for Lucid Emacs. Originally called x-menubar.el.
32 ;; Contained four menus -- File, Edit, Buffers, Help.
33 ;; Dynamic menu changes possible only through activate-menubar-hook.
34 ;; Also contained menu manipulation funs, e.g. find-menu-item, add-menu.
35 ;; Options menu added for 19.9 by Jamie Zawinski, late 1993.
36 ;; Major reorganization c. 1994 by Ben Wing; added many items and moved
37 ;; some items to two new menus, Apps and Tools. (for 19.10?)
38 ;; Generic menubar functions moved to new file, menubar.el, by Ben Wing,
39 ;; 1995, for 19.12; also, creation of current buffers menu options,
40 ;; and buffers menu changed from purely most-recent to sorted alphabetical,
41 ;; by mode. Also added mode-popup-menu support.
42 ;; New API (add-submenu, add-menu-button) and menu filter support added
43 ;; late summer 1995 by Stig, for 19.13. Also popup-menubar-menu.
44 ;; Renamed to menubar-items.el c. 1998, with MS Win support.
45 ;; Options menu rewritten to use custom c. 1999 by ? (Jan Vroonhof?).
46 ;; Major reorganization Mar. 2000 by Ben Wing; added many items and changed
47 ;; top-level menus to File, Edit, View, Cmds, Tools, Options, Buffers.
48 ;; Accelerator spec functionality added Mar. 2000 by Ben Wing.
49
29 ;;; Commentary: 50 ;;; Commentary:
30 51
31 ;; This file is dumped with XEmacs (when window system and menubar support is 52 ;; This file is dumped with XEmacs (when window system and menubar support is
32 ;; compiled in). 53 ;; compiled in).
33 54
34 ;;; Code: 55 ;;; Code:
35 56
36 ;;; Warning-free compile 57 (defun menu-truncate-list (list n)
37 (eval-when-compile 58 (if (<= (length list) n)
38 (defvar language-environment-list) 59 list
39 (defvar bookmark-alist) 60 (butlast list (- (length list) n))))
40 (defvar language-info-alist) 61
41 (defvar current-language-environment) 62 (defun submenu-generate-accelerator-spec (list &optional omit-chars-list)
42 (defvar tutorial-supported-languages)) 63 "Add auto-generated accelerator specifications to a submenu.
64 This can be used to add accelerators to the return value of a menu filter
65 function. It correctly ignores unselectable items. It will destructively
66 modify the list passed to it. If an item already has an auto-generated
67 accelerator spec, this will be removed before the new one is added, making
68 this function idempotent.
69
70 If OMIT-CHARS-LIST is given, it should be a list of lowercase characters,
71 which will not be used as accelerators."
72 (let ((n 0))
73 (dolist (item list list)
74 (cond
75 ((vectorp item)
76 (setq n (1+ n))
77 (aset item 0
78 (concat
79 (menu-item-generate-accelerator-spec n omit-chars-list)
80 (menu-item-strip-accelerator-spec (aref item 0)))))
81 ((consp item)
82 (setq n (1+ n))
83 (setcar item
84 (concat
85 (menu-item-generate-accelerator-spec n omit-chars-list)
86 (menu-item-strip-accelerator-spec (car item)))))))))
87
88 (defun menu-item-strip-accelerator-spec (item)
89 "Strip an auto-generated accelerator spec off of ITEM.
90 ITEM should be a string. This removes specs added by
91 `menu-item-generate-accelerator-spec' and `submenu-generate-accelerator-spec'."
92 (if (string-match "%_. " item)
93 (substring item 4)
94 item))
95
96 (defun menu-item-generate-accelerator-spec (n &optional omit-chars-list)
97 "Return an accelerator specification for use with auto-generated menus.
98 This should be concat'd onto the beginning of each menu line. The spec
99 allows the Nth line to be selected by the number N. '0' is used for the
100 10th line, and 'a' through 'z' are used for the following 26 lines.
101
102 If OMIT-CHARS-LIST is given, it should be a list of lowercase characters,
103 which will not be used as accelerators."
104 (cond ((< n 10) (concat "%_" (int-to-string n) " "))
105 ((= n 10) "%_0 ")
106 ((<= n 36)
107 (setq n (- n 10))
108 (let ((m 0))
109 (while (> n 0)
110 (setq m (1+ m))
111 (while (memq (int-to-char (+ m (- (char-to-int ?a) 1)))
112 omit-chars-list)
113 (setq m (1+ m)))
114 (setq n (1- n)))
115 (if (<= m 26)
116 (concat
117 "%_"
118 (char-to-string (int-to-char (+ m (- (char-to-int ?a) 1))))
119 " ")
120 "")))
121 (t "")))
43 122
44 (defconst default-menubar 123 (defconst default-menubar
45 (purecopy-menubar 124 (purecopy-menubar
46 ;; note backquote. 125 ;; note backquote.
47 `( 126 `(
48 ("File" 127 ("%_File"
49 ["Open..." find-file] 128 ["%_Open..." find-file]
50 ["Open in Other Window..." find-file-other-window] 129 ["Open in Other %_Window..." find-file-other-window]
51 ["Open in New Frame..." find-file-other-frame] 130 ["Open in New %_Frame..." find-file-other-frame]
52 ["Insert File..." insert-file] 131 ["%_Hex Edit File..." hexl-find-file
53 ["View File..." view-file] 132 :active (fboundp 'hexl-find-file)]
133 ["%_Insert File..." insert-file]
134 ["%_View File..." view-file]
54 "------" 135 "------"
55 ["Save" save-buffer 136 ["%_Save" save-buffer
56 :active (buffer-modified-p) 137 :active (buffer-modified-p)
57 :suffix (if put-buffer-names-in-file-menu (buffer-name) "")] 138 :suffix (if put-buffer-names-in-file-menu (buffer-name) "")]
58 ["Save As..." write-file] 139 ["Save %_As..." write-file]
59 ["Save Some Buffers" save-some-buffers] 140 ["Save So%_me Buffers" save-some-buffers]
60 "-----" 141 "-----"
61 ["Print Buffer" lpr-buffer 142 ["%_Print" generic-print-buffer
62 :active (fboundp 'lpr-buffer) 143 :active (or (valid-specifier-tag-p 'msprinter)
63 :suffix (if put-buffer-names-in-file-menu (buffer-name) "")] 144 (and (not (eq system-type 'windows-nt))
64 ["Pretty-Print Buffer" ps-print-buffer-with-faces 145 (fboundp 'lpr-buffer)))
146 :suffix (if put-buffer-names-in-file-menu (concat (buffer-name) "...")
147 "...")]
148 ["Prett%_y-Print" ps-print-buffer-with-faces
65 :active (fboundp 'ps-print-buffer-with-faces) 149 :active (fboundp 'ps-print-buffer-with-faces)
66 :suffix (if put-buffer-names-in-file-menu (buffer-name) "")] 150 :suffix (if put-buffer-names-in-file-menu (buffer-name) "")]
67 "-----" 151 "-----"
68 ["New Frame" make-frame] 152 ["%_Revert Buffer" revert-buffer
69 ["Frame on Other Display..." make-frame-on-display]
70 ["Delete Frame" delete-frame
71 :active (not (eq (next-frame (selected-frame) 'nomini 'window-system)
72 (selected-frame)))]
73 "-----"
74 ["Split Window" split-window-vertically]
75 ["Un-Split (Keep This)" delete-other-windows
76 :active (not (one-window-p t))]
77 ["Un-Split (Keep Others)" delete-window
78 :active (not (one-window-p t))]
79 "-----"
80 ["Revert Buffer" revert-buffer
81 :active (or buffer-file-name revert-buffer-function) 153 :active (or buffer-file-name revert-buffer-function)
82 :suffix (if put-buffer-names-in-file-menu (buffer-name) "")] 154 :suffix (if put-buffer-names-in-file-menu (buffer-name) "")]
83 ["Delete Buffer" kill-this-buffer 155 ["Re%_cover File..." recover-file]
84 :active t 156 ["Recover S%_ession..." recover-session]
85 :suffix (if put-buffer-names-in-file-menu (buffer-name) "")]
86 "-----" 157 "-----"
87 ["Exit XEmacs" save-buffers-kill-emacs] 158 ["E%_xit XEmacs" save-buffers-kill-emacs]
88 ) 159 )
89 160
90 ("Edit" 161 ("%_Edit"
91 ["Undo" advertised-undo 162 ["%_Undo" advertised-undo
92 :active (and (not (eq buffer-undo-list t)) 163 :active (and (not (eq buffer-undo-list t))
93 (or buffer-undo-list pending-undo-list)) 164 (or buffer-undo-list pending-undo-list))
94 :suffix (if (or (eq last-command 'undo) 165 :suffix (if (or (eq last-command 'undo)
95 (eq last-command 'advertised-undo)) 166 (eq last-command 'advertised-undo))
96 "More" "")] 167 "More" "")]
97 ["Redo" redo 168 ["%_Redo" redo
98 :included (fboundp 'redo) 169 :included (fboundp 'redo)
99 :active (not (or (eq buffer-undo-list t) 170 :active (not (or (eq buffer-undo-list t)
100 (eq last-buffer-undo-list nil) 171 (eq last-buffer-undo-list nil)
101 (not (or (eq last-buffer-undo-list buffer-undo-list) 172 (not (or (eq last-buffer-undo-list buffer-undo-list)
102 (and (null (car-safe buffer-undo-list)) 173 (and (null (car-safe buffer-undo-list))
103 (eq last-buffer-undo-list 174 (eq last-buffer-undo-list
104 (cdr-safe buffer-undo-list))))) 175 (cdr-safe buffer-undo-list)))))
105 (or (eq buffer-undo-list pending-undo-list) 176 (or (eq buffer-undo-list pending-undo-list)
106 (eq (cdr buffer-undo-list) pending-undo-list)))) 177 (eq (cdr buffer-undo-list) pending-undo-list))))
107 :suffix (if (eq last-command 'redo) "More" "")] 178 :suffix (if (eq last-command 'redo) "More" "")]
108 ["Cut" kill-primary-selection 179 "----"
180 ["Cu%_t" kill-primary-selection
109 :active (selection-owner-p)] 181 :active (selection-owner-p)]
110 ["Copy" copy-primary-selection 182 ["%_Copy" copy-primary-selection
111 :active (selection-owner-p)] 183 :active (selection-owner-p)]
112 ["Paste" yank-clipboard-selection 184 ["%_Paste" yank-clipboard-selection
113 :active (selection-exists-p 'CLIPBOARD)] 185 :active (selection-exists-p 'CLIPBOARD)]
114 ["Clear" delete-primary-selection 186 ["%_Delete" delete-primary-selection
115 :active (selection-owner-p)] 187 :active (selection-owner-p)]
116 "----" 188 "----"
117 ["Search..." isearch-forward] 189 ["Select %_All" mark-whole-buffer]
118 ["Search Backward..." isearch-backward] 190 ["Select Pa%_ge" mark-page]
119 ["Replace..." query-replace]
120 "----" 191 "----"
121 ["Search (Regexp)..." isearch-forward-regexp] 192 ["%_Find..." make-search-dialog]
122 ["Search Backward (Regexp)..." isearch-backward-regexp] 193 ["R%_eplace..." query-replace]
123 ["Replace (Regexp)..." query-replace-regexp] 194 ["Replace (Rege%_xp)..." query-replace-regexp]
124 "----" 195 ["%_List Matching Lines..." list-matching-lines]
125 ["Goto Line..." goto-line] 196 ,@(when (featurep 'mule)
126 ["What Line" what-line] 197 '("----"
127 ("Bookmarks" 198 ("%_Multilingual (\"Mule\")"
128 :filter bookmark-menu-filter) 199 ("%_Describe Language Support")
129 "----" 200 ("%_Set Language Environment")
130 ["Start Macro Recording" start-kbd-macro
131 :active (not defining-kbd-macro)]
132 ["End Macro Recording" end-kbd-macro
133 :active defining-kbd-macro]
134 ["Execute Last Macro" call-last-kbd-macro
135 :active last-kbd-macro]
136 "----"
137 ["Show Message Log" show-message-log]
138 )
139
140 ,@(when (featurep 'mule)
141 '(("Mule"
142 ("Describe language support")
143 ("Set language environment")
144 "--" 201 "--"
145 ["Toggle input method" toggle-input-method] 202 ["T%_oggle Input Method" toggle-input-method]
146 ["Select input method" set-input-method] 203 ["Select %_Input Method" set-input-method]
147 ["Describe input method" describe-input-method] 204 ["D%_escribe Input Method" describe-input-method]
148 "--" 205 "--"
149 ["Describe current coding systems" 206 ["Describe Current %_Coding Systems"
150 describe-current-coding-system] 207 describe-current-coding-system]
151 ["Set coding system of buffer file" 208 ["Set Coding System of %_Buffer File..."
152 set-buffer-file-coding-system] 209 set-buffer-file-coding-system]
153 ;; not implemented yet 210 ;; not implemented yet
154 ["Set coding system of terminal" 211 ["Set Coding System of %_Terminal..."
155 set-terminal-coding-system :active nil] 212 set-terminal-coding-system :active nil]
156 ;; not implemented yet 213 ;; not implemented yet
157 ["Set coding system of keyboard" 214 ["Set Coding System of %_Keyboard..."
158 set-keyboard-coding-system :active nil] 215 set-keyboard-coding-system :active nil]
159 ["Set coding system of process" 216 ["Set Coding System of %_Process..."
160 set-buffer-process-coding-system 217 set-buffer-process-coding-system
161 :active (get-buffer-process (current-buffer))] 218 :active (get-buffer-process (current-buffer))]
162 "--" 219 "--"
163 ["Show character table" view-charset-by-menu] 220 ["Show Cha%_racter Table" view-charset-by-menu]
164 ;; not implemented yet 221 ;; not implemented yet
165 ["Show diagnosis for MULE" mule-diag :active nil] 222 ["Show Dia%_gnosis for MULE" mule-diag :active nil]
166 ["Show many languages" view-hello-file]))) 223 ["Show \"%_hello\" in Many Languages" view-hello-file]))
167 224 )
168 ("Apps" 225 )
169 ["Read Mail (VM)..." vm 226
170 :active (fboundp 'vm)] 227 ("%_View"
171 ["Read Mail (MH)..." (mh-rmail t) 228 ["%_New Frame" make-frame]
172 :active (fboundp 'mh-rmail)] 229 ["Frame on Other Displa%_y..." make-frame-on-display]
173 ["Send mail..." compose-mail 230 ["%_Delete Frame" delete-frame
174 :active (fboundp 'compose-mail)] 231 :active (not (eq (next-frame (selected-frame) 'nomini 'window-system)
175 ["Usenet News" gnus 232 (selected-frame)))]
176 :active (fboundp 'gnus)] 233 "-----"
177 ["Browse the Web" w3 234 ["%_Split Window" split-window-vertically]
178 :active (fboundp 'w3)] 235 ["S%_plit Window (Side by Side)" split-window-horizontally]
236 ["%_Un-Split (Keep This)" delete-other-windows
237 :active (not (one-window-p t))]
238 ["Un-Split (Keep %_Others)" delete-window
239 :active (not (one-window-p t))]
179 "----" 240 "----"
180 ["Spell-Check Buffer" ispell-buffer 241 ("N%_arrow"
181 :active (fboundp 'ispell-buffer)] 242 ["%_Narrow to Region" narrow-to-region :active (region-exists-p)]
182 ["Toggle VI emulation" toggle-viper-mode 243 ["Narrow to %_Page" narrow-to-page]
183 :active (fboundp 'toggle-viper-mode)] 244 ["Narrow to %_Defun" narrow-to-defun]
184 "----" 245 "----"
185 ("Calendar" 246 ["%_Widen" widen :active (or (/= (point-min) 1)
186 ["3-Month Calendar" calendar 247 (/= (point-max) (1+ (buffer-size))))]
187 :active (fboundp 'calendar)] 248 )
188 ["Diary" diary 249 "----"
189 :active (fboundp 'diary)] 250 ["Show Message %_Log" show-message-log]
190 ["Holidays" holidays 251 "----"
191 :active (fboundp 'holidays)] 252 ["%_Goto Line..." goto-line]
192 ;; we're all pagans at heart ... 253 ["%_What Line" what-line]
193 ["Phases of the Moon" phases-of-moon 254 ("%_Bookmarks"
194 :active (fboundp 'phases-of-moon)] 255 :filter bookmark-menu-filter)
195 ["Sunrise/Sunset" sunrise-sunset 256 "----"
196 :active (fboundp 'sunrise-sunset)]) 257 ["%_Jump to Previous Mark" (set-mark-command t)
197 258 :active (mark t)]
198 ("Games" 259 )
199 ["Mine Game" xmine 260
200 :active (fboundp 'xmine)] 261 ("C%_mds"
201 ["Tetris" tetris 262 ["Repeat %_Last Complex Command..." repeat-complex-command]
202 :active (fboundp 'tetris)] 263 ["E%_valuate Lisp Expression..." eval-expression]
203 ["Sokoban" sokoban 264 ["Execute %_Named Command..." execute-extended-command]
204 :active (fboundp 'sokoban)] 265 "----"
205 ["Quote from Zippy" yow 266 ["Start %_Macro Recording" start-kbd-macro
206 :active (fboundp 'yow)] 267 :included (not defining-kbd-macro)]
207 ["Psychoanalyst" doctor 268 ["End %_Macro Recording" end-kbd-macro
208 :active (fboundp 'doctor)] 269 :included defining-kbd-macro]
209 ["Psychoanalyze Zippy!" psychoanalyze-pinhead 270 ["E%_xecute Last Macro" call-last-kbd-macro
210 :active (fboundp 'psychoanalyze-pinhead)] 271 :active last-kbd-macro]
211 ["Random Flames" flame 272 ("%_Other Macro"
212 :active (fboundp 'flame)] 273 ["%_Append to Last Macro" (start-kbd-macro t)
213 ["Dunnet (Adventure)" dunnet 274 :active (and (not defining-kbd-macro) last-kbd-macro)]
214 :active (fboundp 'dunnet)] 275 ["%_Query User During Macro" kbd-macro-query
215 ["Towers of Hanoi" hanoi 276 :active defining-kbd-macro]
216 :active (fboundp 'hanoi)] 277 ["Enter %_Recursive Edit During Macro" (kbd-macro-query t)
217 ["Game of Life" life 278 :active defining-kbd-macro]
218 :active (fboundp 'life)] 279 "---"
219 ["Multiplication Puzzle" mpuz 280 ["E%_xecute Last Macro on Region Lines"
220 :active (fboundp 'mpuz)])) 281 :active (and last-kbd-macro (region-exists-p))]
221 282 "---"
222 ("Options" 283 ["%_Name Last Macro..." name-last-kbd-macro
223 ("Customize" 284 :active last-kbd-macro]
224 ("Emacs" :filter (lambda (&rest junk) 285 ["Assign Last Macro to %_Key..." assign-last-kbd-macro-to-key
225 (cdr (custom-menu-create 'emacs)))) 286 :active (and last-kbd-macro
226 ["Group..." customize-group] 287 (fboundp 'assign-last-kbd-macro-to-key))]
227 ["Variable..." customize-variable] 288 "---"
228 ["Face..." customize-face] 289 ["%_Edit Macro..." edit-kbd-macro]
229 ["Saved..." customize-saved] 290 ["Edit %_Last Macro" edit-last-kbd-macro
230 ["Set..." customize-customized] 291 :active last-kbd-macro]
231 ["Apropos..." customize-apropos] 292 "---"
232 ["Browse..." customize-browse]) 293 ["%_Insert Named Macro into Buffer..." insert-kbd-macro]
233 294 ["Read Macro from Re%_gion" read-kbd-macro
234 ("Manage Packages" 295 :active (region-exists-p)]
235 ("Add Download Site" 296 )
297 "----"
298 ("%_Abbrev"
299 ["D%_ynamic Abbrev Expand" dabbrev-expand]
300 ["Dynamic Abbrev %_Complete" dabbrev-completion]
301 ["Dynamic Abbrev Complete in %_All Buffers" (dabbrev-completion 16)]
302 "----"
303 "----"
304 ["%_Define Global Abbrev for " add-global-abbrev
305 :suffix (abbrev-string-to-be-defined nil)
306 :active abbrev-mode]
307 ["Define %_Mode-Specific Abbrev for " add-mode-abbrev
308 :suffix (abbrev-string-to-be-defined nil)
309 :active abbrev-mode]
310 ["Define Global Ex%_pansion for " inverse-add-global-abbrev
311 :suffix (inverse-abbrev-string-to-be-defined 1)
312 :active abbrev-mode]
313 ["Define Mode-Specific Expa%_nsion for " inverse-add-mode-abbrev
314 :suffix (inverse-abbrev-string-to-be-defined 1)
315 :active abbrev-mode]
316 "---"
317 ["E%_xpand Abbrev" expand-abbrev]
318 ["Expand Abbrevs in Re%_gion" expand-region-abbrevs
319 :active (region-exists-p)]
320 ["%_Unexpand Last Abbrev" unexpand-abbrev
321 :active (and (stringp last-abbrev-text)
322 (> last-abbrev-location 0))]
323 "---"
324 ["%_Kill All Abbrevs" kill-all-abbrevs]
325 ["%_Insert All Abbrevs into Buffer" insert-abbrevs]
326 ["%_List Abbrevs" list-abbrevs]
327 "---"
328 ["%_Edit Abbrevs" edit-abbrevs]
329 ["%_Redefine Abbrevs from Buffer" edit-abbrevs-redefine
330 :active (eq major-mode 'edit-abbrevs-mode)]
331 "---"
332 ["%_Save Abbrevs As..." write-abbrev-file]
333 ["L%_oad Abbrevs..." read-abbrev-file]
334 )
335 ("%_Register"
336 ["%_Copy to Register..." copy-to-register :active (region-exists-p)]
337 ["%_Paste Register..." insert-register]
338 "---"
339 ["%_Save Point to Register" point-to-register]
340 ["%_Jump to Register" register-to-point]
341 )
342 ("R%_ectangles"
343 ["%_Kill Rectangle" kill-rectangle]
344 ["%_Yank Rectangle" yank-rectangle]
345 ["Rectangle %_to Register" copy-rectangle-to-register]
346 ["Rectangle %_from Register" insert-register]
347 ["%_Clear Rectangle" clear-rectangle]
348 ["%_Open Rectangle" open-rectangle]
349 ["%_Prefix Rectangle..." string-rectangle]
350 ["Rectangle %_Mousing"
351 (customize-set-variable 'mouse-track-rectangle-p
352 (not mouse-track-rectangle-p))
353 :style toggle :selected mouse-track-rectangle-p]
354 )
355 ("%_Sort"
356 ["%_Lines in Region" sort-lines :active (region-exists-p)]
357 ["%_Paragraphs in Region" sort-paragraphs :active (region-exists-p)]
358 ["P%_ages in Region" sort-pages :active (region-exists-p)]
359 ["%_Columns in Region" sort-columns :active (region-exists-p)]
360 ["%_Regexp..." sort-regexp-fields :active (region-exists-p)]
361 )
362 ("%_Change Case"
363 ["%_Upcase Region" upcase-region :active (region-exists-p)]
364 ["%_Downcase Region" downcase-region :active (region-exists-p)]
365 ["%_Capitalize Region" capitalize-region :active (region-exists-p)]
366 ["%_Title-Case Region" capitalize-region-as-title
367 :active (region-exists-p)]
368 )
369 ("Ce%_nter"
370 ["%_Line" center-line]
371 ["%_Paragraph" center-paragraph]
372 ["%_Region" center-region :active (region-exists-p)]
373 )
374 ("%_Indent"
375 ["%_As Previous Line" indent-relative]
376 ["%_To Column..." indent-to-column]
377 "---"
378 ["%_Region" indent-region :active (region-exists-p)]
379 ["%_Balanced Expression" indent-sexp]
380 ["%_C Expression" indent-c-exp]
381 )
382 ("S%_pell-Check"
383 ["%_Buffer" ispell-buffer
384 :active (fboundp 'ispell-buffer)]
385 "---"
386 ["%_Word" ispell-word]
387 ["%_Complete Word" ispell-complete-word]
388 ["%_Region" ispell-region]
389 )
390 )
391
392 ("%_Tools"
393 ("%_Packages"
394 ("%_Add Download Site"
236 :filter (lambda (&rest junk) 395 :filter (lambda (&rest junk)
237 (package-get-download-menu))) 396 (submenu-generate-accelerator-spec
238 ["Update Package Index" package-get-update-base] 397 (package-get-download-menu))))
239 ["List & Install" pui-list-packages] 398 ["%_Update Package Index" package-get-update-base]
240 ["Update Installed Packages" package-get-update-all] 399 ["%_List and Install" pui-list-packages]
400 ["U%_pdate Installed Packages" package-get-update-all]
241 ;; hack-o-matic, we can't force a load of package-base here 401 ;; hack-o-matic, we can't force a load of package-base here
242 ;; since it triggers dialog box interactions which we can't 402 ;; since it triggers dialog box interactions which we can't
243 ;; deal with while using a menu 403 ;; deal with while using a menu
244 ("Using Custom" 404 ("Using %_Custom"
245 :filter (lambda (&rest junk) 405 :filter (lambda (&rest junk)
246 (if package-get-base 406 (if package-get-base
247 (cdr (custom-menu-create 'packages)) 407 (submenu-generate-accelerator-spec
248 '(["Please load Package Index" (lamda (&rest junk) ()) nil])))) 408 (cdr (custom-menu-create 'packages)))
409 '("Please load Package Index"))))
249 410
250 ["Help" (Info-goto-node "(xemacs)Packages")]) 411 ["%_Help" (Info-goto-node "(xemacs)Packages")])
251 412 ("%_Internet"
413 ["Read Mail %_1 (VM)..." vm
414 :active (fboundp 'vm)]
415 ["Read Mail %_2 (MH)..." (mh-rmail t)
416 :active (fboundp 'mh-rmail)]
417 ["Send %_Mail..." compose-mail
418 :active (fboundp 'compose-mail)]
419 ["Usenet %_News" gnus
420 :active (fboundp 'gnus)]
421 ["Browse the %_Web" w3
422 :active (fboundp 'w3)])
252 "---" 423 "---"
253 424 ("%_Grep"
254 ("Editing Options" 425 :filter
255 ["Overstrike" 426 (lambda (menu)
427 (if (or (not (boundp 'grep-history)) (null grep-history))
428 menu
429 (let ((items
430 (submenu-generate-accelerator-spec
431 (mapcar #'(lambda (string)
432 (vector string
433 (list 'grep string)))
434 (menu-truncate-list grep-history 10)))))
435 (append menu '("---") items))))
436 ["%_Grep..." grep :active (fboundp 'grep)]
437 ["%_Kill Grep" kill-compilation
438 :active (and (fboundp 'kill-compilation)
439 (fboundp 'compilation-find-buffer)
440 (let ((buffer (condition-case nil
441 (compilation-find-buffer)
442 (error nil))))
443 (and buffer (get-buffer-process buffer))))]
444 "---"
445 ["Grep %_All Files in Current Directory..."
446 (progn
447 (require 'compile)
448 (let ((grep-command
449 (cons (concat grep-command " *")
450 (length grep-command))))
451 (call-interactively 'grep)))
452 :active (fboundp 'grep)]
453 ["Grep %_C and C Header Files in Current Directory..."
454 (progn
455 (require 'compile)
456 (let ((grep-command
457 (cons (concat grep-command " *.[chCH]"
458 ; i wanted to also use *.cc and *.hh.
459 ; see long comment below under Perl.
460 )
461 (length grep-command))))
462 (call-interactively 'grep)))
463 :active (fboundp 'grep)]
464 ["Grep C Hea%_der Files in Current Directory..."
465 (progn
466 (require 'compile)
467 (let ((grep-command
468 (cons (concat grep-command " *.[hH]"
469 ; i wanted to also use *.hh.
470 ; see long comment below under Perl.
471 )
472 (length grep-command))))
473 (call-interactively 'grep)))
474 :active (fboundp 'grep)]
475 ["Grep %_E-Lisp Files in Current Directory..."
476 (progn
477 (require 'compile)
478 (let ((grep-command
479 (cons (concat grep-command " *.el")
480 (length grep-command))))
481 (call-interactively 'grep)))
482 :active (fboundp 'grep)]
483 ["Grep %_Perl Files in Current Directory..."
484 (progn
485 (require 'compile)
486 (let ((grep-command
487 (cons (concat grep-command " *.pl"
488 ; i wanted to use this:
489 ; " *.pl *.pm *.am"
490 ; but grep complains if it can't
491 ; match anything in a glob, and
492 ; that screws other things up.
493 ; perhaps we need to first scan
494 ; each separate glob in the directory
495 ; to see if there are any files in
496 ; that glob, and if not, omit it.
497 )
498 (length grep-command))))
499 (call-interactively 'grep)))
500 :active (fboundp 'grep)]
501 ["Grep %_HTML Files in Current Directory..."
502 (progn
503 (require 'compile)
504 (let ((grep-command
505 (cons (concat grep-command " *.*htm*")
506 (length grep-command))))
507 (call-interactively 'grep)))
508 :active (fboundp 'grep)]
509 "---"
510 ["%_Next Match" next-error
511 :active (and (fboundp 'compilation-errors-exist-p)
512 (compilation-errors-exist-p))]
513 ["Pre%_vious Match" previous-error
514 :active (and (fboundp 'compilation-errors-exist-p)
515 (compilation-errors-exist-p))]
516 ["%_First Match" first-error
517 :active (and (fboundp 'compilation-errors-exist-p)
518 (compilation-errors-exist-p))]
519 ["G%_oto Match" compile-goto-error
520 :active (and (fboundp 'compilation-errors-exist-p)
521 (compilation-errors-exist-p))]
522 "---"
523 ["%_Set Grep Command..."
524 (progn
525 (require 'compile)
526 (customize-set-variable
527 'grep-command
528 (read-shell-command "Default Grep Command: " grep-command)))
529 :active (fboundp 'grep)
530 ]
531 )
532 ("%_Compile"
533 :filter
534 (lambda (menu)
535 (if (or (not (boundp 'compile-history)) (null compile-history))
536 menu
537 (let ((items
538 (submenu-generate-accelerator-spec
539 (mapcar #'(lambda (string)
540 (vector string
541 (list 'compile string)))
542 (menu-truncate-list compile-history 10)))))
543 (append menu '("---") items))))
544 ["%_Compile..." compile :active (fboundp 'compile)]
545 ["%_Repeat Compilation" recompile :active (fboundp 'recompile)]
546 ["%_Kill Compilation" kill-compilation
547 :active (and (fboundp 'kill-compilation)
548 (fboundp 'compilation-find-buffer)
549 (let ((buffer (condition-case nil
550 (compilation-find-buffer)
551 (error nil))))
552 (and buffer (get-buffer-process buffer))))]
553 "---"
554 ["%_Next Error" next-error
555 :active (and (fboundp 'compilation-errors-exist-p)
556 (compilation-errors-exist-p))]
557 ["Pre%_vious Error" previous-error
558 :active (and (fboundp 'compilation-errors-exist-p)
559 (compilation-errors-exist-p))]
560 ["%_First Error" first-error
561 :active (and (fboundp 'compilation-errors-exist-p)
562 (compilation-errors-exist-p))]
563 ["G%_oto Error" compile-goto-error
564 :active (and (fboundp 'compilation-errors-exist-p)
565 (compilation-errors-exist-p))]
566 )
567 ("%_Debug"
568 ["%_GDB..." gdb
569 :active (fboundp 'gdb)]
570 ["%_DBX..." dbx
571 :active (fboundp 'dbx)])
572 ("%_Shell"
573 ["%_Shell" shell
574 :active (fboundp 'shell)]
575 ["S%_hell Command..." shell-command
576 :active (fboundp 'shell-command)]
577 ["Shell Command on %_Region..." shell-command-on-region
578 :active (and (fboundp 'shell-command-on-region) (region-exists-p))])
579
580 ("%_Tags"
581 ["%_Find Tag..." find-tag]
582 ["Find %_Other Window..." find-tag-other-window]
583 ["%_Next Tag..." (find-tag nil)]
584 ["N%_ext Other Window..." (find-tag-other-window nil)]
585 ["Next %_File" next-file]
586 "-----"
587 ["Tags %_Search..." tags-search]
588 ["Tags %_Replace..." tags-query-replace]
589 ["%_Continue Search/Replace" tags-loop-continue]
590 "-----"
591 ["%_Pop stack" pop-tag-mark]
592 ["%_Apropos..." tags-apropos]
593 "-----"
594 ["%_Set Tags Table File..." visit-tags-table]
595 )
596
597 "----"
598
599 ("Ca%_lendar"
600 ["%_3-Month Calendar" calendar
601 :active (fboundp 'calendar)]
602 ["%_Diary" diary
603 :active (fboundp 'diary)]
604 ["%_Holidays" holidays
605 :active (fboundp 'holidays)]
606 ;; we're all pagans at heart ...
607 ["%_Phases of the Moon" phases-of-moon
608 :active (fboundp 'phases-of-moon)]
609 ["%_Sunrise/Sunset" sunrise-sunset
610 :active (fboundp 'sunrise-sunset)])
611
612 ("Ga%_mes"
613 ["%_Mine Game" xmine
614 :active (fboundp 'xmine)]
615 ["%_Tetris" tetris
616 :active (fboundp 'tetris)]
617 ["%_Sokoban" sokoban
618 :active (fboundp 'sokoban)]
619 ["Quote from %_Zippy" yow
620 :active (fboundp 'yow)]
621 ["%_Psychoanalyst" doctor
622 :active (fboundp 'doctor)]
623 ["Ps%_ychoanalyze Zippy!" psychoanalyze-pinhead
624 :active (fboundp 'psychoanalyze-pinhead)]
625 ["%_Random Flames" flame
626 :active (fboundp 'flame)]
627 ["%_Dunnet (Adventure)" dunnet
628 :active (fboundp 'dunnet)]
629 ["Towers of %_Hanoi" hanoi
630 :active (fboundp 'hanoi)]
631 ["Game of %_Life" life
632 :active (fboundp 'life)]
633 ["M%_ultiplication Puzzle" mpuz
634 :active (fboundp 'mpuz)])
635
636 "----"
637 )
638
639 ("%_Options"
640 ("%_Advanced (Customize)"
641 ("%_Emacs" :filter (lambda (&rest junk)
642 (cdr (custom-menu-create 'emacs))))
643 ["%_Group..." customize-group]
644 ["%_Variable..." customize-variable]
645 ["%_Face..." customize-face]
646 ["%_Saved..." customize-saved]
647 ["Se%_t..." customize-customized]
648 ["%_Apropos..." customize-apropos]
649 ["%_Browse..." customize-browse])
650 "---"
651 ("%_Editing"
652 ["This Buffer %_Read Only" (toggle-read-only)
653 :style toggle :selected buffer-read-only]
654 ["%_Yank/Kill Interact With Clipboard"
655 (if (eq interprogram-cut-function 'own-clipboard)
656 (progn
657 (customize-set-variable 'interprogram-cut-function nil)
658 (customize-set-variable 'interprogram-paste-function nil))
659 (customize-set-variable 'interprogram-cut-function 'own-clipboard)
660 (customize-set-variable 'interprogram-paste-function 'get-clipboard))
661 :style toggle
662 :selected (eq interprogram-cut-function 'own-clipboard)]
663 ["%_Overstrike"
256 (progn 664 (progn
257 (setq overwrite-mode (if overwrite-mode nil 'overwrite-mode-textual)) 665 (setq overwrite-mode (if overwrite-mode nil 'overwrite-mode-textual))
258 (customize-set-variable 'overwrite-mode overwrite-mode)) 666 (customize-set-variable 'overwrite-mode overwrite-mode))
259 :style toggle :selected overwrite-mode] 667 :style toggle :selected overwrite-mode]
260 ["Case Sensitive Search" 668 ["%_Abbrev Mode"
669 (customize-set-variable 'abbrev-mode
670 (not (default-value 'abbrev-mode)))
671 :style toggle
672 :selected (default-value 'abbrev-mode)]
673 ["Active Re%_gions"
674 (customize-set-variable 'zmacs-regions (not zmacs-regions))
675 :style toggle :selected zmacs-regions]
676 "---"
677 ["%_Case Sensitive Search"
261 (customize-set-variable 'case-fold-search 678 (customize-set-variable 'case-fold-search
262 (setq case-fold-search (not case-fold-search))) 679 (setq case-fold-search (not case-fold-search)))
263 :style toggle :selected (not case-fold-search)] 680 :style toggle :selected (not case-fold-search)]
264 ["Case Matching Replace" 681 ["Case %_Matching Replace"
265 (customize-set-variable 'case-replace (not case-replace)) 682 (customize-set-variable 'case-replace (not case-replace))
266 :style toggle :selected case-replace] 683 :style toggle :selected case-replace]
267 ["Auto Delete Selection" 684 "---"
685 ("%_Newline at End of File..."
686 ["%_Don't Require"
687 (customize-set-variable 'require-final-newline nil)
688 :style radio :selected (not require-final-newline)]
689 ["%_Require"
690 (customize-set-variable 'require-final-newline t)
691 :style radio :selected (eq require-final-newline t)]
692 ["%_Ask"
693 (customize-set-variable 'require-final-newline 'ask)
694 :style radio :selected (and require-final-newline
695 (not (eq require-final-newline t)))])
696 ["Add Newline When Moving Past %_End"
697 (customize-set-variable 'next-line-add-newlines
698 (not next-line-add-newlines))
699 :style toggle :selected next-line-add-newlines])
700 ("%_Keyboard and Mouse"
701 ["%_Delete Key Deletes Selection"
268 (customize-set-variable 'pending-delete-mode (not pending-delete-mode)) 702 (customize-set-variable 'pending-delete-mode (not pending-delete-mode))
269 :style toggle 703 :style toggle
270 :selected (and (boundp 'pending-delete-mode) pending-delete-mode) 704 :selected (and (boundp 'pending-delete-mode) pending-delete-mode)
271 :active (boundp 'pending-delete-mode)] 705 :active (boundp 'pending-delete-mode)]
272 ["Active Regions" 706 ("`%_kill-line' Behavior..."
273 (customize-set-variable 'zmacs-regions (not zmacs-regions)) 707 ["Kill %_Whole Line"
274 :style toggle :selected zmacs-regions] 708 (customize-set-variable 'kill-whole-line 'always)
275 ["Mouse Paste At Text Cursor" 709 :style radio :selected (eq kill-whole-line 'always)]
710 ["Kill to %_End of Line"
711 (customize-set-variable 'kill-whole-line nil)
712 :style radio :selected (eq kill-whole-line nil)]
713 ["Kill Whole Line at %_Beg, Otherwise to End"
714 (customize-set-variable 'kill-whole-line t)
715 :style radio :selected (eq kill-whole-line t)])
716 ["Size for %_Block-Movement Commands..."
717 (customize-set-variable 'block-movement-size
718 (read-number "Block Movement Size: "
719 t block-movement-size))]
720 ["%_VI Emulation"
721 (progn
722 (toggle-viper-mode)
723 (customize-set-variable 'viper-mode viper-mode))
724 :style toggle :selected (and (boundp 'viper-mode) viper-mode)
725 :active (fboundp 'toggle-viper-mode)]
726 "----"
727 ["%_Set Key..." global-set-key]
728 ["%_Unset Key..." global-unset-key]
729 "---"
730 ["%_Mouse Paste at Text Cursor (not Clicked Location)"
276 (customize-set-variable 'mouse-yank-at-point (not mouse-yank-at-point)) 731 (customize-set-variable 'mouse-yank-at-point (not mouse-yank-at-point))
277 :style toggle :selected mouse-yank-at-point] 732 :style toggle :selected mouse-yank-at-point]
278 ("Newline at end of file..." 733 "---"
279 ["Don't require" 734 ["%_Teach Extended Commands"
280 (customize-set-variable 'require-final-newline nil)
281 :style radio :selected (not require-final-newline)]
282 ["Require"
283 (customize-set-variable 'require-final-newline t)
284 :style radio :selected (eq require-final-newline t)]
285 ["Ask"
286 (customize-set-variable 'require-final-newline 'ask)
287 :style radio :selected (and require-final-newline
288 (not (eq require-final-newline t)))])
289 ["Add Newline When Moving Past End"
290 (customize-set-variable 'next-line-add-newlines
291 (not next-line-add-newlines))
292 :style toggle :selected next-line-add-newlines]
293 )
294 ("General Options"
295 ["Teach Extended Commands"
296 (customize-set-variable 'teach-extended-commands-p 735 (customize-set-variable 'teach-extended-commands-p
297 (not teach-extended-commands-p)) 736 (not teach-extended-commands-p))
298 :style toggle :selected teach-extended-commands-p] 737 :style toggle :selected teach-extended-commands-p]
299 ["Debug On Error"
300 (customize-set-variable 'debug-on-error (not debug-on-error))
301 :style toggle :selected debug-on-error]
302 ["Debug On Quit"
303 (customize-set-variable 'debug-on-quit (not debug-on-quit))
304 :style toggle :selected debug-on-quit]
305 ) 738 )
306 ("Printing Options" 739 ("%_Printing"
307 ["Command-Line Switches for `lpr'/`lp'..." 740 ["Set Printer %_Name for Generic Print Support..."
741 (customize-set-variable
742 'printer-name
743 (read-string "Set printer name: " printer-name))]
744 "---"
745 ["Command-Line %_Switches for `lpr'/`lp'..."
308 ;; better to directly open a customization buffer, since the value 746 ;; better to directly open a customization buffer, since the value
309 ;; must be a list of strings, which is somewhat complex to prompt for. 747 ;; must be a list of strings, which is somewhat complex to prompt for.
310 (customize-variable 'lpr-switches) 748 (customize-variable 'lpr-switches)
311 (boundp 'lpr-switches)] 749 (boundp 'lpr-switches)]
312 ("Pretty-Print Paper Size" 750 ("%_Pretty-Print Paper Size"
313 ["Letter" 751 ["%_Letter"
314 (customize-set-variable 'ps-paper-type 'letter) 752 (customize-set-variable 'ps-paper-type 'letter)
315 :style radio 753 :style radio
316 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'letter)) 754 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'letter))
317 :active (boundp 'ps-paper-type)] 755 :active (boundp 'ps-paper-type)]
318 ["Letter-small" 756 ["Lette%_r-Small"
319 (customize-set-variable 'ps-paper-type 'letter-small) 757 (customize-set-variable 'ps-paper-type 'letter-small)
320 :style radio 758 :style radio
321 :selected (and (boundp 'ps-paper-type) 759 :selected (and (boundp 'ps-paper-type)
322 (eq ps-paper-type 'letter-small)) 760 (eq ps-paper-type 'letter-small))
323 :active (boundp 'ps-paper-type)] 761 :active (boundp 'ps-paper-type)]
324 ["Legal" 762 ["Le%_gal"
325 (customize-set-variable 'ps-paper-type 'legal) 763 (customize-set-variable 'ps-paper-type 'legal)
326 :style radio 764 :style radio
327 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'legal)) 765 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'legal))
328 :active (boundp 'ps-paper-type)] 766 :active (boundp 'ps-paper-type)]
329 ["Statement" 767 ["%_Statement"
330 (customize-set-variable 'ps-paper-type 'statement) 768 (customize-set-variable 'ps-paper-type 'statement)
331 :style radio 769 :style radio
332 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'statement)) 770 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'statement))
333 :active (boundp 'ps-paper-type)] 771 :active (boundp 'ps-paper-type)]
334 ["Executive" 772 ["%_Executive"
335 (customize-set-variable 'ps-paper-type 'executive) 773 (customize-set-variable 'ps-paper-type 'executive)
336 :style radio 774 :style radio
337 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'executive)) 775 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'executive))
338 :active (boundp 'ps-paper-type)] 776 :active (boundp 'ps-paper-type)]
339 ["Tabloid" 777 ["%_Tabloid"
340 (customize-set-variable 'ps-paper-type 'tabloid) 778 (customize-set-variable 'ps-paper-type 'tabloid)
341 :style radio 779 :style radio
342 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'tabloid)) 780 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'tabloid))
343 :active (boundp 'ps-paper-type)] 781 :active (boundp 'ps-paper-type)]
344 ["Ledger" 782 ["Le%_dger"
345 (customize-set-variable 'ps-paper-type 'ledger) 783 (customize-set-variable 'ps-paper-type 'ledger)
346 :style radio 784 :style radio
347 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'ledger)) 785 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'ledger))
348 :active (boundp 'ps-paper-type)] 786 :active (boundp 'ps-paper-type)]
349 ["A3" 787 ["A%_3"
350 (customize-set-variable 'ps-paper-type 'a3) 788 (customize-set-variable 'ps-paper-type 'a3)
351 :style radio 789 :style radio
352 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'a3)) 790 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'a3))
353 :active (boundp 'ps-paper-type)] 791 :active (boundp 'ps-paper-type)]
354 ["A4" 792 ["%_A4"
355 (customize-set-variable 'ps-paper-type 'a4) 793 (customize-set-variable 'ps-paper-type 'a4)
356 :style radio 794 :style radio
357 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'a4)) 795 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'a4))
358 :active (boundp 'ps-paper-type)] 796 :active (boundp 'ps-paper-type)]
359 ["A4small" 797 ["A4s%_mall"
360 (customize-set-variable 'ps-paper-type 'a4small) 798 (customize-set-variable 'ps-paper-type 'a4small)
361 :style radio 799 :style radio
362 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'a4small)) 800 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'a4small))
363 :active (boundp 'ps-paper-type)] 801 :active (boundp 'ps-paper-type)]
364 ["B4" 802 ["B%_4"
365 (customize-set-variable 'ps-paper-type 'b4) 803 (customize-set-variable 'ps-paper-type 'b4)
366 :style radio 804 :style radio
367 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'b4)) 805 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'b4))
368 :active (boundp 'ps-paper-type)] 806 :active (boundp 'ps-paper-type)]
369 ["B5" 807 ["%_B5"
370 (customize-set-variable 'ps-paper-type 'b5) 808 (customize-set-variable 'ps-paper-type 'b5)
371 :style radio 809 :style radio
372 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'b5)) 810 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'b5))
373 :active (boundp 'ps-paper-type)] 811 :active (boundp 'ps-paper-type)]
374 ) 812 )
375 ["Color Printing" 813 ["%_Color Printing"
376 (cond (ps-print-color-p 814 (cond (ps-print-color-p
377 (customize-set-variable 'ps-print-color-p nil) 815 (customize-set-variable 'ps-print-color-p nil)
378 ;; I'm wondering whether all this muck is useful. 816 ;; I'm wondering whether all this muck is useful.
379 (and (boundp 'original-face-background) 817 (and (boundp 'original-face-background)
380 original-face-background 818 original-face-background
385 (face-background-instance 'default)) 823 (face-background-instance 'default))
386 (set-face-background 'default "white"))) 824 (set-face-background 'default "white")))
387 :style toggle 825 :style toggle
388 :selected (and (boundp 'ps-print-color-p) ps-print-color-p) 826 :selected (and (boundp 'ps-print-color-p) ps-print-color-p)
389 :active (boundp 'ps-print-color-p)]) 827 :active (boundp 'ps-print-color-p)])
390 ("\"Other Window\" Location" 828 ("%_Internet"
391 ["Always in Same Frame" 829 ("%_Compose Mail With"
830 ["Default Emacs Mailer"
831 (customize-set-variable 'mail-user-agent 'sendmail-user-agent)
832 :style radio
833 :selected (eq mail-user-agent 'sendmail-user-agent)]
834 ["MH"
835 (customize-set-variable 'mail-user-agent 'mh-e-user-agent)
836 :style radio
837 :selected (eq mail-user-agent 'mh-e-user-agent)
838 :active (get 'mh-e-user-agent 'composefunc)]
839 ["GNUS"
840 (customize-set-variable 'mail-user-agent 'message-user-agent)
841 :style radio
842 :selected (eq mail-user-agent 'message-user-agent)
843 :active (get 'message-user-agent 'composefunc)]
844 )
845 ["Set My %_Email Address..."
392 (customize-set-variable 846 (customize-set-variable
393 'get-frame-for-buffer-default-instance-limit nil) 847 'user-mail-address
394 :style radio 848 (read-string "Set email address: " user-mail-address))]
395 :selected (null get-frame-for-buffer-default-instance-limit)] 849 ["Set %_Machine Email Name..."
396 ["Other Frame (2 Frames Max)" 850 (customize-set-variable
397 (customize-set-variable 'get-frame-for-buffer-default-instance-limit 2) 851 'mail-host-address
398 :style radio 852 (read-string "Set machine email name: " mail-host-address))]
399 :selected (eq 2 get-frame-for-buffer-default-instance-limit)] 853 ["Set %_SMTP Server..."
400 ["Other Frame (3 Frames Max)" 854 (progn
401 (customize-set-variable 'get-frame-for-buffer-default-instance-limit 3) 855 (require 'smtpmail)
402 :style radio 856 (customize-set-variable
403 :selected (eq 3 get-frame-for-buffer-default-instance-limit)] 857 'smtpmail-smtp-server
404 ["Other Frame (4 Frames Max)" 858 (read-string "Set SMTP server: " smtpmail-smtp-server)))
405 (customize-set-variable 'get-frame-for-buffer-default-instance-limit 4) 859 :active (and (boundp 'send-mail-function)
406 :style radio 860 (eq send-mail-function 'smtpmail-send-it))]
407 :selected (eq 4 get-frame-for-buffer-default-instance-limit)] 861 ["SMTP %_Debug Info"
408 ["Other Frame (5 Frames Max)" 862 (progn
409 (customize-set-variable 'get-frame-for-buffer-default-instance-limit 5) 863 (require 'smtpmail)
410 :style radio 864 (customize-set-variable 'smtpmail-debug-info
411 :selected (eq 5 get-frame-for-buffer-default-instance-limit)] 865 (not smtpmail-debug-info)))
412 ["Always Create New Frame"
413 (customize-set-variable 'get-frame-for-buffer-default-instance-limit 0)
414 :style radio
415 :selected (eq 0 get-frame-for-buffer-default-instance-limit)]
416 "-----"
417 ["Temp Buffers Always in Same Frame"
418 (customize-set-variable 'temp-buffer-show-function
419 'show-temp-buffer-in-current-frame)
420 :style radio
421 :selected (eq temp-buffer-show-function
422 'show-temp-buffer-in-current-frame)]
423 ["Temp Buffers Like Other Buffers"
424 (customize-set-variable 'temp-buffer-show-function nil)
425 :style radio
426 :selected (null temp-buffer-show-function)]
427 "-----"
428 ["Make current frame gnuserv target"
429 (customize-set-variable 'gnuserv-frame (if (eq gnuserv-frame t) nil t))
430 :style toggle 866 :style toggle
431 :selected (and (boundp 'gnuserv-frame) (eq gnuserv-frame t)) 867 :selected (and (boundp 'smtpmail-debug-info) smtpmail-debug-info)
432 :active (boundp 'gnuserv-frame)] 868 :active (and (boundp 'send-mail-function)
869 (eq send-mail-function 'smtpmail-send-it))]
870 "---"
871 ("%_Open URLs With"
872 ["%_Emacs-W3"
873 (customize-set-variable 'browse-url-browser-function 'browse-url-w3)
874 :style radio
875 :selected (and (boundp 'browse-url-browser-function)
876 (eq browse-url-browser-function 'browse-url-w3))
877 :active (and (boundp 'browse-url-browser-function)
878 (fboundp 'browse-url-w3)
879 (fboundp 'w3-fetch))]
880 ["%_Netscape"
881 (customize-set-variable 'browse-url-browser-function
882 'browse-url-netscape)
883 :style radio
884 :selected (and (boundp 'browse-url-browser-function)
885 (eq browse-url-browser-function 'browse-url-netscape))
886 :active (and (boundp 'browse-url-browser-function)
887 (fboundp 'browse-url-netscape))]
888 ["%_Mosaic"
889 (customize-set-variable 'browse-url-browser-function
890 'browse-url-mosaic)
891 :style radio
892 :selected (and (boundp 'browse-url-browser-function)
893 (eq browse-url-browser-function 'browse-url-mosaic))
894 :active (and (boundp 'browse-url-browser-function)
895 (fboundp 'browse-url-mosaic))]
896 ["Mosaic (%_CCI)"
897 (customize-set-variable 'browse-url-browser-function 'browse-url-cci)
898 :style radio
899 :selected (and (boundp 'browse-url-browser-function)
900 (eq browse-url-browser-function 'browse-url-cci))
901 :active (and (boundp 'browse-url-browser-function)
902 (fboundp 'browse-url-cci))]
903 ["%_IXI Mosaic"
904 (customize-set-variable 'browse-url-browser-function
905 'browse-url-iximosaic)
906 :style radio
907 :selected (and (boundp 'browse-url-browser-function)
908 (eq browse-url-browser-function 'browse-url-iximosaic))
909 :active (and (boundp 'browse-url-browser-function)
910 (fboundp 'browse-url-iximosaic))]
911 ["%_Lynx (xterm)"
912 (customize-set-variable 'browse-url-browser-function
913 'browse-url-lynx-xterm)
914 :style radio
915 :selected (and (boundp 'browse-url-browser-function)
916 (eq browse-url-browser-function 'browse-url-lynx-xterm))
917 :active (and (boundp 'browse-url-browser-function)
918 (fboundp 'browse-url-lynx-xterm))]
919 ["L%_ynx (xemacs)"
920 (customize-set-variable 'browse-url-browser-function
921 'browse-url-lynx-emacs)
922 :style radio
923 :selected (and (boundp 'browse-url-browser-function)
924 (eq browse-url-browser-function 'browse-url-lynx-emacs))
925 :active (and (boundp 'browse-url-browser-function)
926 (fboundp 'browse-url-lynx-emacs))]
927 ["%_Grail"
928 (customize-set-variable 'browse-url-browser-function
929 'browse-url-grail)
930 :style radio
931 :selected (and (boundp 'browse-url-browser-function)
932 (eq browse-url-browser-function 'browse-url-grail))
933 :active (and (boundp 'browse-url-browser-function)
934 (fboundp 'browse-url-grail))]
935 ["%_Kfm"
936 (customize-set-variable 'browse-url-browser-function
937 'browse-url-kfm)
938 :style radio
939 :selected (and (boundp 'browse-url-browser-function)
940 (eq browse-url-browser-function 'browse-url-kfm))
941 :active (and (boundp 'browse-url-browser-function)
942 (fboundp 'browse-url-kfm))]
943 ))
944 ("%_Troubleshooting"
945 ["%_Debug on Error"
946 (customize-set-variable 'debug-on-error (not debug-on-error))
947 :style toggle :selected debug-on-error]
948 ["Debug on %_Quit"
949 (customize-set-variable 'debug-on-quit (not debug-on-quit))
950 :style toggle :selected debug-on-quit]
951 ["Debug on S%_ignal"
952 (customize-set-variable 'debug-on-signal (not debug-on-signal))
953 :style toggle :selected debug-on-signal]
954 ["%_Stack Trace on Error"
955 (customize-set-variable 'stack-trace-on-error
956 (not stack-trace-on-error))
957 :style toggle :selected stack-trace-on-error]
958 ["Stack Trace on Si%_gnal"
959 (customize-set-variable 'stack-trace-on-signal
960 (not stack-trace-on-signal))
961 :style toggle :selected stack-trace-on-signal]
433 ) 962 )
434 "-----" 963 "-----"
435 ("Syntax Highlighting" 964 ("%_Display"
436 ["In This Buffer" 965 ,@(if (featurep 'scrollbar)
437 (progn ;; becomes buffer local 966 '(["%_Scrollbars"
967 (customize-set-variable 'scrollbars-visible-p
968 (not scrollbars-visible-p))
969 :style toggle
970 :selected scrollbars-visible-p]))
971 ["%_3D Modeline"
972 (customize-set-variable 'modeline-3d-p
973 (not modeline-3d-p))
974 :style toggle
975 :selected modeline-3d-p]
976 ["%_Wrap Long Lines"
977 (progn;; becomes buffer-local
978 (setq truncate-lines (not truncate-lines))
979 (customize-set-variable 'truncate-lines truncate-lines))
980 :style toggle
981 :selected (not truncate-lines)]
982 ,@(if (featurep 'toolbar)
983 '("---"
984 ["%_Toolbars Visible"
985 (customize-set-variable 'toolbar-visible-p
986 (not toolbar-visible-p))
987 :style toggle
988 :selected toolbar-visible-p]
989 ["Toolbars Ca%_ptioned"
990 (customize-set-variable 'toolbar-captioned-p
991 (not toolbar-captioned-p))
992 :style toggle
993 :active toolbar-visible-p
994 :selected toolbar-captioned-p]
995 ("Default Toolba%_r Location"
996 ["%_Top"
997 (customize-set-variable 'default-toolbar-position 'top)
998 :style radio
999 :active toolbar-visible-p
1000 :selected (eq default-toolbar-position 'top)]
1001 ["%_Bottom"
1002 (customize-set-variable 'default-toolbar-position 'bottom)
1003 :style radio
1004 :active toolbar-visible-p
1005 :selected (eq default-toolbar-position 'bottom)]
1006 ["%_Left"
1007 (customize-set-variable 'default-toolbar-position 'left)
1008 :style radio
1009 :active toolbar-visible-p
1010 :selected (eq default-toolbar-position 'left)]
1011 ["%_Right"
1012 (customize-set-variable 'default-toolbar-position 'right)
1013 :style radio
1014 :active toolbar-visible-p
1015 :selected (eq default-toolbar-position 'right)]
1016 )
1017 ))
1018 ,@(if (featurep 'gutter)
1019 '("---"
1020 ["B%_uffers Tab Visible"
1021 (customize-set-variable 'gutter-buffers-tab-visible-p
1022 (not gutter-buffers-tab-visible-p))
1023 :style toggle
1024 :selected gutter-buffers-tab-visible-p]
1025 ("Default %_Gutter Location"
1026 ["%_Top"
1027 (customize-set-variable 'default-gutter-position 'top)
1028 :style radio
1029 :selected (eq default-gutter-position 'top)]
1030 ["%_Bottom"
1031 (customize-set-variable 'default-gutter-position 'bottom)
1032 :style radio
1033 :selected (eq default-gutter-position 'bottom)]
1034 ["%_Left"
1035 (customize-set-variable 'default-gutter-position 'left)
1036 :style radio
1037 :selected (eq default-gutter-position 'left)]
1038 ["%_Right"
1039 (customize-set-variable 'default-gutter-position 'right)
1040 :style radio
1041 :selected (eq default-gutter-position 'right)]
1042 )
1043 ))
1044 "-----"
1045 ["%_Blinking Cursor"
1046 (customize-set-variable 'blink-cursor-mode (not blink-cursor-mode))
1047 :style toggle
1048 :selected (and (boundp 'blink-cursor-mode) blink-cursor-mode)
1049 :active (boundp 'blink-cursor-mode)]
1050 ["Bl%_ock Cursor"
1051 (progn
1052 (customize-set-variable 'bar-cursor nil)
1053 (force-cursor-redisplay))
1054 :style radio
1055 :selected (null bar-cursor)]
1056 ["Bar Cursor (%_1 Pixel)"
1057 (progn
1058 (customize-set-variable 'bar-cursor t)
1059 (force-cursor-redisplay))
1060 :style radio
1061 :selected (eq bar-cursor t)]
1062 ["Bar Cursor (%_2 Pixels)"
1063 (progn
1064 (customize-set-variable 'bar-cursor 2)
1065 (force-cursor-redisplay))
1066 :style radio
1067 :selected (and bar-cursor (not (eq bar-cursor t)))]
1068 "----"
1069 ("Pa%_ren Highlighting"
1070 ["%_None"
1071 (customize-set-variable 'paren-mode nil)
1072 :style radio
1073 :selected (and (boundp 'paren-mode) (not paren-mode))
1074 :active (boundp 'paren-mode)]
1075 ["%_Blinking Paren"
1076 (customize-set-variable 'paren-mode 'blink-paren)
1077 :style radio
1078 :selected (and (boundp 'paren-mode) (eq paren-mode 'blink-paren))
1079 :active (boundp 'paren-mode)]
1080 ["%_Steady Paren"
1081 (customize-set-variable 'paren-mode 'paren)
1082 :style radio
1083 :selected (and (boundp 'paren-mode) (eq paren-mode 'paren))
1084 :active (boundp 'paren-mode)]
1085 ["%_Expression"
1086 (customize-set-variable 'paren-mode 'sexp)
1087 :style radio
1088 :selected (and (boundp 'paren-mode) (eq paren-mode 'sexp))
1089 :active (boundp 'paren-mode)]
1090 ;; ["Nes%_ted Shading"
1091 ;; (customize-set-variable 'paren-mode 'nested)
1092 ;; :style radio
1093 ;; :selected (and (boundp 'paren-mode) (eq paren-mode 'nested))
1094 ;; :active (boundp 'paren-mode)]
1095 )
1096 "------"
1097 ["%_Line Numbers"
1098 (progn
1099 (customize-set-variable 'line-number-mode (not line-number-mode))
1100 (redraw-modeline))
1101 :style toggle :selected line-number-mode]
1102 ["%_Column Numbers"
1103 (progn
1104 (customize-set-variable 'column-number-mode
1105 (not column-number-mode))
1106 (redraw-modeline))
1107 :style toggle :selected column-number-mode]
1108
1109 ("\"Other %_Window\" Location"
1110 ["%_Always in Same Frame"
1111 (customize-set-variable
1112 'get-frame-for-buffer-default-instance-limit nil)
1113 :style radio
1114 :selected (null get-frame-for-buffer-default-instance-limit)]
1115 ["Other Frame (%_2 Frames Max)"
1116 (customize-set-variable 'get-frame-for-buffer-default-instance-limit
1117 2)
1118 :style radio
1119 :selected (eq 2 get-frame-for-buffer-default-instance-limit)]
1120 ["Other Frame (%_3 Frames Max)"
1121 (customize-set-variable 'get-frame-for-buffer-default-instance-limit
1122 3)
1123 :style radio
1124 :selected (eq 3 get-frame-for-buffer-default-instance-limit)]
1125 ["Other Frame (%_4 Frames Max)"
1126 (customize-set-variable 'get-frame-for-buffer-default-instance-limit
1127 4)
1128 :style radio
1129 :selected (eq 4 get-frame-for-buffer-default-instance-limit)]
1130 ["Other Frame (%_5 Frames Max)"
1131 (customize-set-variable 'get-frame-for-buffer-default-instance-limit
1132 5)
1133 :style radio
1134 :selected (eq 5 get-frame-for-buffer-default-instance-limit)]
1135 ["Always Create %_New Frame"
1136 (customize-set-variable 'get-frame-for-buffer-default-instance-limit
1137 0)
1138 :style radio
1139 :selected (eq 0 get-frame-for-buffer-default-instance-limit)]
1140 "-----"
1141 ["%_Temp Buffers Always in Same Frame"
1142 (customize-set-variable 'temp-buffer-show-function
1143 'show-temp-buffer-in-current-frame)
1144 :style radio
1145 :selected (eq temp-buffer-show-function
1146 'show-temp-buffer-in-current-frame)]
1147 ["Temp Buffers %_Like Other Buffers"
1148 (customize-set-variable 'temp-buffer-show-function nil)
1149 :style radio
1150 :selected (null temp-buffer-show-function)]
1151 "-----"
1152 ["%_Make Current Frame Gnuserv Target"
1153 (customize-set-variable 'gnuserv-frame (if (eq gnuserv-frame t) nil
1154 t))
1155 :style toggle
1156 :selected (and (boundp 'gnuserv-frame) (eq gnuserv-frame t))
1157 :active (boundp 'gnuserv-frame)]
1158 )
1159 )
1160 ("%_Menubars"
1161 ["%_Frame-Local Font Menu"
1162 (customize-set-variable 'font-menu-this-frame-only-p
1163 (not font-menu-this-frame-only-p))
1164 :style toggle
1165 :selected (and (boundp 'font-menu-this-frame-only-p)
1166 font-menu-this-frame-only-p)]
1167 ["%_Alt/Meta Selects Menu Items"
1168 (if (eq menu-accelerator-enabled 'menu-force)
1169 (customize-set-variable 'menu-accelerator-enabled nil)
1170 (customize-set-variable 'menu-accelerator-enabled 'menu-force))
1171 :style toggle
1172 :selected (eq menu-accelerator-enabled 'menu-force)]
1173 "----"
1174 ["Buffers Menu %_Length..."
1175 (customize-set-variable
1176 'buffers-menu-max-size
1177 ;; would it be better to open a customization buffer ?
1178 (let ((val
1179 (read-number
1180 "Enter number of buffers to display (or 0 for unlimited): ")))
1181 (if (eq val 0) nil val)))]
1182 ["%_Multi-Operation Buffers Sub-Menus"
1183 (customize-set-variable 'complex-buffers-menu-p
1184 (not complex-buffers-menu-p))
1185 :style toggle
1186 :selected complex-buffers-menu-p]
1187 ["S%_ubmenus for Buffer Groups"
1188 (customize-set-variable 'buffers-menu-submenus-for-groups-p
1189 (not buffers-menu-submenus-for-groups-p))
1190 :style toggle
1191 :selected buffers-menu-submenus-for-groups-p]
1192 ["%_Verbose Buffer Menu Entries"
1193 (if (eq buffers-menu-format-buffer-line-function
1194 'slow-format-buffers-menu-line)
1195 (customize-set-variable 'buffers-menu-format-buffer-line-function
1196 'format-buffers-menu-line)
1197 (customize-set-variable 'buffers-menu-format-buffer-line-function
1198 'slow-format-buffers-menu-line))
1199 :style toggle
1200 :selected (eq buffers-menu-format-buffer-line-function
1201 'slow-format-buffers-menu-line)]
1202 ("Buffers Menu %_Sorting"
1203 ["%_Most Recently Used"
1204 (progn
1205 (customize-set-variable 'buffers-menu-sort-function nil)
1206 (customize-set-variable 'buffers-menu-grouping-function nil))
1207 :style radio
1208 :selected (null buffers-menu-sort-function)]
1209 ["%_Alphabetically"
1210 (progn
1211 (customize-set-variable 'buffers-menu-sort-function
1212 'sort-buffers-menu-alphabetically)
1213 (customize-set-variable 'buffers-menu-grouping-function nil))
1214 :style radio
1215 :selected (eq 'sort-buffers-menu-alphabetically
1216 buffers-menu-sort-function)]
1217 ["%_By Major Mode, Then Alphabetically"
1218 (progn
1219 (customize-set-variable
1220 'buffers-menu-sort-function
1221 'sort-buffers-menu-by-mode-then-alphabetically)
1222 (customize-set-variable
1223 'buffers-menu-grouping-function
1224 'group-buffers-menu-by-mode-then-alphabetically))
1225 :style radio
1226 :selected (eq 'sort-buffers-menu-by-mode-then-alphabetically
1227 buffers-menu-sort-function)])
1228 "---"
1229 ["%_Ignore Scaled Fonts"
1230 (customize-set-variable 'font-menu-ignore-scaled-fonts
1231 (not font-menu-ignore-scaled-fonts))
1232 :style toggle
1233 :selected (and (boundp 'font-menu-ignore-scaled-fonts)
1234 font-menu-ignore-scaled-fonts)]
1235 )
1236 ("S%_yntax Highlighting"
1237 ["%_In This Buffer"
1238 (progn;; becomes buffer local
438 (font-lock-mode) 1239 (font-lock-mode)
439 (customize-set-variable 'font-lock-mode font-lock-mode)) 1240 (customize-set-variable 'font-lock-mode font-lock-mode))
440 :style toggle 1241 :style toggle
441 :selected (and (boundp 'font-lock-mode) font-lock-mode) 1242 :selected (and (boundp 'font-lock-mode) font-lock-mode)
442 :active (boundp 'font-lock-mode)] 1243 :active (boundp 'font-lock-mode)]
443 ["Automatic" 1244 ["%_Automatic"
444 (customize-set-variable 'font-lock-auto-fontify 1245 (customize-set-variable 'font-lock-auto-fontify
445 (not font-lock-auto-fontify)) 1246 (not font-lock-auto-fontify))
446 :style toggle 1247 :style toggle
447 :selected (and (boundp 'font-lock-auto-fontify) font-lock-auto-fontify) 1248 :selected (and (boundp 'font-lock-auto-fontify) font-lock-auto-fontify)
448 :active (fboundp 'font-lock-mode)] 1249 :active (fboundp 'font-lock-mode)]
449 "-----" 1250 "-----"
450 ["Fonts" 1251 ["Force %_Rehighlight in this Buffer"
1252 (customize-set-variable 'font-lock-auto-fontify
1253 (not font-lock-auto-fontify))
1254 :style toggle
1255 :selected (and (boundp 'font-lock-auto-fontify) font-lock-auto-fontify)
1256 :active (fboundp 'font-lock-mode)]
1257 "-----"
1258 ["%_Fonts"
451 (progn 1259 (progn
452 (require 'font-lock) 1260 (require 'font-lock)
453 (font-lock-use-default-fonts) 1261 (font-lock-use-default-fonts)
454 (customize-set-variable 'font-lock-use-fonts t) 1262 (customize-set-variable 'font-lock-use-fonts t)
455 (customize-set-variable 'font-lock-use-colors nil) 1263 (customize-set-variable 'font-lock-use-colors nil)
456 (font-lock-mode 1)) 1264 (font-lock-mode 1))
457 :style radio 1265 :style radio
458 :selected (and (boundp 'font-lock-use-fonts) font-lock-use-fonts) 1266 :selected (and (boundp 'font-lock-use-fonts) font-lock-use-fonts)
459 :active (fboundp 'font-lock-mode)] 1267 :active (fboundp 'font-lock-mode)]
460 ["Colors" 1268 ["%_Colors"
461 (progn 1269 (progn
462 (require 'font-lock) 1270 (require 'font-lock)
463 (font-lock-use-default-colors) 1271 (font-lock-use-default-colors)
464 (customize-set-variable 'font-lock-use-colors t) 1272 (customize-set-variable 'font-lock-use-colors t)
465 (customize-set-variable 'font-lock-use-fonts nil) 1273 (customize-set-variable 'font-lock-use-fonts nil)
466 (font-lock-mode 1)) 1274 (font-lock-mode 1))
467 :style radio 1275 :style radio
468 :selected (and (boundp 'font-lock-use-colors) font-lock-use-colors) 1276 :selected (and (boundp 'font-lock-use-colors) font-lock-use-colors)
469 :active (boundp 'font-lock-mode)] 1277 :active (boundp 'font-lock-mode)]
470 "-----" 1278 "-----"
471 ["Least" 1279 ["%_1 Least"
472 (progn 1280 (progn
473 (require 'font-lock) 1281 (require 'font-lock)
474 (if (or (and (not (integerp font-lock-maximum-decoration)) 1282 (if (or (and (not (integerp font-lock-maximum-decoration))
475 (not (eq t font-lock-maximum-decoration))) 1283 (not (eq t font-lock-maximum-decoration)))
476 (and (integerp font-lock-maximum-decoration) 1284 (and (integerp font-lock-maximum-decoration)
478 nil 1286 nil
479 (customize-set-variable 'font-lock-maximum-decoration nil) 1287 (customize-set-variable 'font-lock-maximum-decoration nil)
480 (font-lock-recompute-variables))) 1288 (font-lock-recompute-variables)))
481 :style radio 1289 :style radio
482 :active (fboundp 'font-lock-mode) 1290 :active (fboundp 'font-lock-mode)
483 :selected (and (boundp 'font-lock-maximium-decoration) 1291 :selected (and (boundp 'font-lock-maximum-decoration)
484 (or (and (not (integerp font-lock-maximum-decoration)) 1292 (or (and (not (integerp font-lock-maximum-decoration))
485 (not (eq t font-lock-maximum-decoration))) 1293 (not (eq t font-lock-maximum-decoration)))
486 (and (integerp font-lock-maximum-decoration) 1294 (and (integerp font-lock-maximum-decoration)
487 (<= font-lock-maximum-decoration 0))))] 1295 (<= font-lock-maximum-decoration 0))))]
488 ["More" 1296 ["%_2 More"
489 (progn 1297 (progn
490 (require 'font-lock) 1298 (require 'font-lock)
491 (if (and (integerp font-lock-maximum-decoration) 1299 (if (and (integerp font-lock-maximum-decoration)
492 (= 1 font-lock-maximum-decoration)) 1300 (= 1 font-lock-maximum-decoration))
493 nil 1301 nil
494 (customize-set-variable 'font-lock-maximum-decoration 1) 1302 (customize-set-variable 'font-lock-maximum-decoration 1)
495 (font-lock-recompute-variables))) 1303 (font-lock-recompute-variables)))
496 :style radio 1304 :style radio
497 :active (fboundp 'font-lock-mode) 1305 :active (fboundp 'font-lock-mode)
498 :selected (and (boundp 'font-lock-maximium-decoration) 1306 :selected (and (boundp 'font-lock-maximum-decoration)
499 (integerp font-lock-maximum-decoration) 1307 (integerp font-lock-maximum-decoration)
500 (= 1 font-lock-maximum-decoration))] 1308 (= 1 font-lock-maximum-decoration))]
501 ["Even More" 1309 ["%_3 Even More"
502 (progn 1310 (progn
503 (require 'font-lock) 1311 (require 'font-lock)
504 (if (and (integerp font-lock-maximum-decoration) 1312 (if (and (integerp font-lock-maximum-decoration)
505 (= 2 font-lock-maximum-decoration)) 1313 (= 2 font-lock-maximum-decoration))
506 nil 1314 nil
509 :style radio 1317 :style radio
510 :active (fboundp 'font-lock-mode) 1318 :active (fboundp 'font-lock-mode)
511 :selected (and (boundp 'font-lock-maximum-decoration) 1319 :selected (and (boundp 'font-lock-maximum-decoration)
512 (integerp font-lock-maximum-decoration) 1320 (integerp font-lock-maximum-decoration)
513 (= 2 font-lock-maximum-decoration))] 1321 (= 2 font-lock-maximum-decoration))]
514 ["Most" 1322 ["%_4 Most"
515 (progn 1323 (progn
516 (require 'font-lock) 1324 (require 'font-lock)
517 (if (or (eq font-lock-maximum-decoration t) 1325 (if (or (eq font-lock-maximum-decoration t)
518 (and (integerp font-lock-maximum-decoration) 1326 (and (integerp font-lock-maximum-decoration)
519 (>= font-lock-maximum-decoration 3))) 1327 (>= font-lock-maximum-decoration 3)))
525 :selected (and (boundp 'font-lock-maximum-decoration) 1333 :selected (and (boundp 'font-lock-maximum-decoration)
526 (or (eq font-lock-maximum-decoration t) 1334 (or (eq font-lock-maximum-decoration t)
527 (and (integerp font-lock-maximum-decoration) 1335 (and (integerp font-lock-maximum-decoration)
528 (>= font-lock-maximum-decoration 3))))] 1336 (>= font-lock-maximum-decoration 3))))]
529 "-----" 1337 "-----"
530 ["Lazy" 1338 ["Lazy %_Lock"
531 (progn ;; becomes buffer local 1339 (progn;; becomes buffer local
1340 (lazy-lock-mode)
1341 (customize-set-variable 'lazy-lock-mode lazy-lock-mode)
1342 ;; this shouldn't be necessary so there has to
1343 ;; be a redisplay bug lurking somewhere (or
1344 ;; possibly another event handler bug)
1345 (redraw-modeline))
1346 :active (and (boundp 'font-lock-mode) (boundp 'lazy-lock-mode)
1347 font-lock-mode)
1348 :style toggle
1349 :selected (and (boundp 'lazy-lock-mode) lazy-lock-mode)]
1350 ["Lazy %_Shot"
1351 (progn;; becomes buffer local
532 (lazy-shot-mode) 1352 (lazy-shot-mode)
533 (customize-set-variable 'lazy-shot-mode lazy-shot-mode) 1353 (customize-set-variable 'lazy-shot-mode lazy-shot-mode)
534 ;; this shouldn't be necessary so there has to 1354 ;; this shouldn't be necessary so there has to
535 ;; be a redisplay bug lurking somewhere (or 1355 ;; be a redisplay bug lurking somewhere (or
536 ;; possibly another event handler bug) 1356 ;; possibly another event handler bug)
537 (redraw-modeline)) 1357 (redraw-modeline))
538 :active (and (boundp 'font-lock-mode) (boundp 'lazy-shot-mode) 1358 :active (and (boundp 'font-lock-mode) (boundp 'lazy-shot-mode)
539 font-lock-mode) 1359 font-lock-mode)
540 :style toggle 1360 :style toggle
541 :selected (and (boundp 'lazy-shot-mode) lazy-shot-mode)] 1361 :selected (and (boundp 'lazy-shot-mode) lazy-shot-mode)]
542 ["Caching" 1362 ["Cac%_hing"
543 (progn ;; becomes buffer local 1363 (progn;; becomes buffer local
544 (fast-lock-mode) 1364 (fast-lock-mode)
545 (customize-set-variable 'fast-lock-mode fast-lock-mode) 1365 (customize-set-variable 'fast-lock-mode fast-lock-mode)
546 ;; this shouldn't be necessary so there has to 1366 ;; this shouldn't be necessary so there has to
547 ;; be a redisplay bug lurking somewhere (or 1367 ;; be a redisplay bug lurking somewhere (or
548 ;; possibly another event handler bug) 1368 ;; possibly another event handler bug)
550 :active (and (boundp 'font-lock-mode) (boundp 'fast-lock-mode) 1370 :active (and (boundp 'font-lock-mode) (boundp 'fast-lock-mode)
551 font-lock-mode) 1371 font-lock-mode)
552 :style toggle 1372 :style toggle
553 :selected (and (boundp 'fast-lock-mode) fast-lock-mode)] 1373 :selected (and (boundp 'fast-lock-mode) fast-lock-mode)]
554 ) 1374 )
555 ("Paren Highlighting" 1375 ("%_Font" :filter font-menu-family-constructor)
556 ["None" 1376 ("Font Si%_ze" :filter font-menu-size-constructor)
557 (customize-set-variable 'paren-mode nil) 1377 ;; ("Font Weig%_ht" :filter font-menu-weight-constructor)
558 :style radio 1378 ["Edit Fa%_ces..." (customize-face nil)]
559 :selected (and (boundp 'paren-mode) (not paren-mode))
560 :active (boundp 'paren-mode)]
561 ["Blinking Paren"
562 (customize-set-variable 'paren-mode 'blink-paren)
563 :style radio
564 :selected (and (boundp 'paren-mode) (eq paren-mode 'blink-paren))
565 :active (boundp 'paren-mode)]
566 ["Steady Paren"
567 (customize-set-variable 'paren-mode 'paren)
568 :style radio
569 :selected (and (boundp 'paren-mode) (eq paren-mode 'paren))
570 :active (boundp 'paren-mode)]
571 ["Expression"
572 (customize-set-variable 'paren-mode 'sexp)
573 :style radio
574 :selected (and (boundp 'paren-mode) (eq paren-mode 'sexp))
575 :active (boundp 'paren-mode)]
576 ;; ["Nested Shading"
577 ;; (customize-set-variable 'paren-mode 'nested)
578 ;; :style radio
579 ;; :selected (and (boundp 'paren-mode) (eq paren-mode 'nested))
580 ;; :active (boundp 'paren-mode)]
581 )
582 "-----" 1379 "-----"
583 ("Frame Appearance" 1380 ["Edit I%_nit File"
584 ["Frame-Local Font Menu" 1381 ;; #### there should be something that holds the name that the init
585 (customize-set-variable 'font-menu-this-frame-only-p 1382 ;; file should be created as, when it's not present.
586 (not font-menu-this-frame-only-p)) 1383 (progn (find-file (or user-init-file "~/.xemacs/init.el"))
587 :style toggle 1384 (or (eq major-mode 'emacs-lisp-mode)
588 :selected (and (boundp 'font-menu-this-frame-only-p) 1385 (emacs-lisp-mode)))]
589 font-menu-this-frame-only-p)] 1386 ["%_Save Options to Init File" customize-save-customized]
590 ,@(if (featurep 'scrollbar) 1387 )
591 '(["Scrollbars" 1388
592 (customize-set-variable 'scrollbars-visible-p 1389 ("%_Buffers"
593 (not scrollbars-visible-p)) 1390 :filter buffers-menu-filter
594 :style toggle 1391 ["Go To %_Previous Buffer" switch-to-other-buffer]
595 :selected scrollbars-visible-p])) 1392 ["Go To %_Buffer..." switch-to-buffer]
596 ;; I don't think this is of any interest. - dverna apr. 98 1393 "----"
597 ;; #### I beg to differ! Many FSFmacs converts hate the 3D 1394 ["%_List All Buffers" list-buffers]
598 ;; modeline, and it was perfectly fine to be able to turn them 1395 ["%_Delete Buffer" kill-this-buffer
599 ;; off through the Options menu. I would have uncommented this 1396 :suffix (if put-buffer-names-in-file-menu (buffer-name) "")]
600 ;; source, but the code for saving options would not save the 1397 "----"
601 ;; modeline 3D-ness. Grrr. --hniksic 1398 )
602 ;; ["3D Modeline" 1399
603 ;; (progn 1400 nil ; the partition: menus after this are flushright
604 ;; (if (zerop (specifier-instance modeline-shadow-thickness)) 1401
605 ;; (set-specifier modeline-shadow-thickness 2) 1402 ("%_Help"
606 ;; (set-specifier modeline-shadow-thickness 0)) 1403 ["%_About XEmacs..." about-xemacs]
607 ;; (redraw-modeline t)) 1404 "-----"
608 ;; :style toggle 1405 ["XEmacs %_News" view-emacs-news]
609 ;; :selected (let ((thickness 1406 ["%_Obtaining XEmacs" describe-distribution]
610 ;; (specifier-instance modeline-shadow-thickness))) 1407 "-----"
611 ;; (and (integerp thickness) 1408 ("%_Info (Online Docs)"
612 ;; (> thickness 0)))] 1409 ["%_Info Contents" info]
613 ["Truncate Lines" 1410 ["Lookup %_Key Binding..." Info-goto-emacs-key-command-node]
614 (progn ;; becomes buffer-local 1411 ["Lookup %_Command..." Info-goto-emacs-command-node]
615 (setq truncate-lines (not truncate-lines)) 1412 ["Lookup %_Function..." Info-elisp-ref]
616 (customize-set-variable 'truncate-lines truncate-lines)) 1413 ["Lookup %_Topic..." Info-query])
617 :style toggle 1414 ("XEmacs %_FAQ"
618 :selected truncate-lines] 1415 ["%_FAQ (local)" xemacs-local-faq]
619 ["Blinking Cursor" 1416 ["FAQ via %_WWW" xemacs-www-faq
620 (customize-set-variable 'blink-cursor-mode (not blink-cursor-mode)) 1417 :active (fboundp 'browse-url)]
621 :style toggle 1418 ["%_Home Page" xemacs-www-page
622 :selected (and (boundp 'blink-cursor-mode) blink-cursor-mode) 1419 :active (fboundp 'browse-url)])
623 :active (boundp 'blink-cursor-mode)] 1420 ("%_Tutorials"
1421 :filter tutorials-menu-filter)
1422 ("%_Samples"
1423 ["Sample .%_emacs"
1424 (find-file (locate-data-file "sample.emacs"))
1425 :active (locate-data-file "sample.emacs")]
1426 ["Sample .%_Xdefaults"
1427 (find-file (locate-data-file "sample.Xdefaults"))
1428 :active (locate-data-file "sample.Xdefaults")]
1429 ["Sample e%_nriched"
1430 (find-file (locate-data-file "enriched.doc"))
1431 :active (locate-data-file "enriched.doc")])
1432 ("%_Commands & Keys"
1433 ["%_Mode" describe-mode]
1434 ["%_Apropos..." hyper-apropos]
1435 ["Apropos %_Docs..." apropos-documentation]
624 "-----" 1436 "-----"
625 ["Block cursor" 1437 ["%_Key..." describe-key]
626 (progn 1438 ["%_Bindings" describe-bindings]
627 (customize-set-variable 'bar-cursor nil) 1439 ["%_Mouse Bindings" describe-pointer]
628 (force-cursor-redisplay)) 1440 ["%_Recent Keys" view-lossage]
629 :style radio 1441 "-----"
630 :selected (null bar-cursor)] 1442 ["%_Function..." describe-function]
631 ["Bar cursor (1 pixel)" 1443 ["%_Variable..." describe-variable]
632 (progn 1444 ["%_Locate Command..." where-is])
633 (customize-set-variable 'bar-cursor t)
634 (force-cursor-redisplay))
635 :style radio
636 :selected (eq bar-cursor t)]
637 ["Bar cursor (2 pixels)"
638 (progn
639 (customize-set-variable 'bar-cursor 2)
640 (force-cursor-redisplay))
641 :style radio
642 :selected (and bar-cursor (not (eq bar-cursor t)))]
643 "------"
644 ["Line Numbers"
645 (progn
646 (customize-set-variable 'line-number-mode (not line-number-mode))
647 (redraw-modeline))
648 :style toggle :selected line-number-mode]
649 ["Column Numbers"
650 (progn
651 (customize-set-variable 'column-number-mode
652 (not column-number-mode))
653 (redraw-modeline))
654 :style toggle :selected column-number-mode]
655 )
656 ("Menubar Appearance"
657 ["Buffers Menu Length..."
658 (customize-set-variable
659 'buffers-menu-max-size
660 ;; would it be better to open a customization buffer ?
661 (let ((val
662 (read-number
663 "Enter number of buffers to display (or 0 for unlimited): ")))
664 (if (eq val 0) nil val)))]
665 ["Multi-Operation Buffers Sub-Menus"
666 (customize-set-variable 'complex-buffers-menu-p
667 (not complex-buffers-menu-p))
668 :style toggle
669 :selected complex-buffers-menu-p]
670 ("Buffers Menu Sorting"
671 ["Most Recently Used"
672 (progn
673 (customize-set-variable 'buffers-menu-sort-function nil)
674 (customize-set-variable 'buffers-menu-grouping-function nil))
675 :style radio
676 :selected (null buffers-menu-sort-function)]
677 ["Alphabetically"
678 (progn
679 (customize-set-variable 'buffers-menu-sort-function
680 'sort-buffers-menu-alphabetically)
681 (customize-set-variable 'buffers-menu-grouping-function nil))
682 :style radio
683 :selected (eq 'sort-buffers-menu-alphabetically
684 buffers-menu-sort-function)]
685 ["By Major Mode, Then Alphabetically"
686 (progn
687 (customize-set-variable
688 'buffers-menu-sort-function
689 'sort-buffers-menu-by-mode-then-alphabetically)
690 (customize-set-variable
691 'buffers-menu-grouping-function
692 'group-buffers-menu-by-mode-then-alphabetically))
693 :style radio
694 :selected (eq 'sort-buffers-menu-by-mode-then-alphabetically
695 buffers-menu-sort-function)])
696 ["Submenus for Buffer Groups"
697 (customize-set-variable 'buffers-menu-submenus-for-groups-p
698 (not buffers-menu-submenus-for-groups-p))
699 :style toggle
700 :selected buffers-menu-submenus-for-groups-p]
701 "---"
702 ["Ignore Scaled Fonts"
703 (customize-set-variable 'font-menu-ignore-scaled-fonts
704 (not font-menu-ignore-scaled-fonts))
705 :style toggle
706 :selected (and (boundp 'font-menu-ignore-scaled-fonts)
707 font-menu-ignore-scaled-fonts)]
708 )
709 ,@(if (featurep 'toolbar)
710 '(("Toolbar Appearance"
711 ["Visible"
712 (customize-set-variable 'toolbar-visible-p
713 (not toolbar-visible-p))
714 :style toggle
715 :selected toolbar-visible-p]
716 ["Captioned"
717 (customize-set-variable 'toolbar-captioned-p
718 (not toolbar-captioned-p))
719 :style toggle
720 :selected toolbar-captioned-p]
721 ("Default Location"
722 ["Top"
723 (customize-set-variable 'default-toolbar-position 'top)
724 :style radio
725 :selected (eq default-toolbar-position 'top)]
726 ["Bottom"
727 (customize-set-variable 'default-toolbar-position 'bottom)
728 :style radio
729 :selected (eq default-toolbar-position 'bottom)]
730 ["Left"
731 (customize-set-variable 'default-toolbar-position 'left)
732 :style radio
733 :selected (eq default-toolbar-position 'left)]
734 ["Right"
735 (customize-set-variable 'default-toolbar-position 'right)
736 :style radio
737 :selected (eq default-toolbar-position 'right)]
738 )
739 )))
740 ,@(if (featurep 'gutter)
741 '(("Gutter Appearance"
742 ["Visible"
743 (customize-set-variable 'gutter-visible-p
744 (not gutter-visible-p))
745 :style toggle
746 :selected gutter-visible-p]
747 ("Default Location"
748 ["Top"
749 (customize-set-variable 'default-gutter-position 'top)
750 :style radio
751 :selected (eq default-gutter-position 'top)]
752 ["Bottom"
753 (customize-set-variable 'default-gutter-position 'bottom)
754 :style radio
755 :selected (eq default-gutter-position 'bottom)]
756 ["Left"
757 (customize-set-variable 'default-gutter-position 'left)
758 :style radio
759 :selected (eq default-gutter-position 'left)]
760 ["Right"
761 (customize-set-variable 'default-gutter-position 'right)
762 :style radio
763 :selected (eq default-gutter-position 'right)]
764 )
765 )))
766 ("Mouse"
767 ["Avoid Text..."
768 (customize-set-variable 'mouse-avoidance-mode
769 (if mouse-avoidance-mode nil 'banish))
770 :style toggle
771 :selected (and (boundp 'mouse-avoidance-mode) mouse-avoidance-mode)
772 :active (and (boundp 'mouse-avoidance-mode)
773 (device-on-window-system-p))]
774 ["strokes-mode"
775 (customize-set-variable 'strokes-mode (not strokes-mode))
776 :style toggle
777 :selected (and (boundp 'strokes-mode) strokes-mode)
778 :active (and (boundp 'strokes-mode)
779 (device-on-window-system-p))]
780 )
781 ("Open URLs With"
782 ["Emacs-W3"
783 (customize-set-variable 'browse-url-browser-function 'browse-url-w3)
784 :style radio
785 :selected (and (boundp 'browse-url-browser-function)
786 (eq browse-url-browser-function 'browse-url-w3))
787 :active (and (boundp 'browse-url-browser-function)
788 (fboundp 'browse-url-w3)
789 (fboundp 'w3-fetch))]
790 ["Netscape"
791 (customize-set-variable 'browse-url-browser-function
792 'browse-url-netscape)
793 :style radio
794 :selected (and (boundp 'browse-url-browser-function)
795 (eq browse-url-browser-function 'browse-url-netscape))
796 :active (and (boundp 'browse-url-browser-function)
797 (fboundp 'browse-url-netscape))]
798 ["Mosaic"
799 (customize-set-variable 'browse-url-browser-function
800 'browse-url-mosaic)
801 :style radio
802 :selected (and (boundp 'browse-url-browser-function)
803 (eq browse-url-browser-function 'browse-url-mosaic))
804 :active (and (boundp 'browse-url-browser-function)
805 (fboundp 'browse-url-mosaic))]
806 ["Mosaic (CCI)"
807 (customize-set-variable 'browse-url-browser-function 'browse-url-cci)
808 :style radio
809 :selected (and (boundp 'browse-url-browser-function)
810 (eq browse-url-browser-function 'browse-url-cci))
811 :active (and (boundp 'browse-url-browser-function)
812 (fboundp 'browse-url-cci))]
813 ["IXI Mosaic"
814 (customize-set-variable 'browse-url-browser-function
815 'browse-url-iximosaic)
816 :style radio
817 :selected (and (boundp 'browse-url-browser-function)
818 (eq browse-url-browser-function 'browse-url-iximosaic))
819 :active (and (boundp 'browse-url-browser-function)
820 (fboundp 'browse-url-iximosaic))]
821 ["Lynx (xterm)"
822 (customize-set-variable 'browse-url-browser-function
823 'browse-url-lynx-xterm)
824 :style radio
825 :selected (and (boundp 'browse-url-browser-function)
826 (eq browse-url-browser-function 'browse-url-lynx-xterm))
827 :active (and (boundp 'browse-url-browser-function)
828 (fboundp 'browse-url-lynx-xterm))]
829 ["Lynx (xemacs)"
830 (customize-set-variable 'browse-url-browser-function
831 'browse-url-lynx-emacs)
832 :style radio
833 :selected (and (boundp 'browse-url-browser-function)
834 (eq browse-url-browser-function 'browse-url-lynx-emacs))
835 :active (and (boundp 'browse-url-browser-function)
836 (fboundp 'browse-url-lynx-emacs))]
837 ["Grail"
838 (customize-set-variable 'browse-url-browser-function
839 'browse-url-grail)
840 :style radio
841 :selected (and (boundp 'browse-url-browser-function)
842 (eq browse-url-browser-function 'browse-url-grail))
843 :active (and (boundp 'browse-url-browser-function)
844 (fboundp 'browse-url-grail))]
845 ["Kfm"
846 (customize-set-variable 'browse-url-browser-function
847 'browse-url-kfm)
848 :style radio
849 :selected (and (boundp 'browse-url-browser-function)
850 (eq browse-url-browser-function 'browse-url-kfm))
851 :active (and (boundp 'browse-url-browser-function)
852 (fboundp 'browse-url-kfm))]
853 )
854 "-----" 1445 "-----"
855 ["Edit Faces..." (customize-face nil)] 1446 ["%_Recent Messages" view-lossage]
856 ("Font" :filter font-menu-family-constructor) 1447 ("%_Misc"
857 ("Size" :filter font-menu-size-constructor) 1448 ["%_Current Installation Info" describe-installation
858 ; ("Weight" :filter font-menu-weight-constructor)
859 "-----"
860 ["Save Options" customize-save-customized]
861 )
862
863 ("Buffers"
864 :filter buffers-menu-filter
865 ["Read Only" (toggle-read-only)
866 :style toggle :selected buffer-read-only]
867 ["List All Buffers" list-buffers]
868 "--"
869 )
870
871 ("Tools"
872 ["Grep..." grep
873 :active (fboundp 'grep)]
874 ["Compile..." compile
875 :active (fboundp 'compile)]
876 ["Shell" shell
877 :active (fboundp 'shell)]
878 ["Shell Command..." shell-command
879 :active (fboundp 'shell-command)]
880 ["Shell Command on Region..." shell-command-on-region
881 :active (and (fboundp 'shell-command-on-region) (region-exists-p))]
882 ["Debug (GDB)..." gdb
883 :active (fboundp 'gdb)]
884 ["Debug (DBX)..." dbx
885 :active (fboundp 'dbx)]
886 "-----"
887 ("Tags"
888 ["Find Tag..." find-tag]
889 ["Find Other Window..." find-tag-other-window]
890 ["Next Tag..." (find-tag nil)]
891 ["Next Other Window..." (find-tag-other-window nil)]
892 ["Next File" next-file]
893 "-----"
894 ["Tags Search..." tags-search]
895 ["Tags Replace..." tags-query-replace]
896 ["Continue Search/Replace" tags-loop-continue]
897 "-----"
898 ["Pop stack" pop-tag-mark]
899 ["Apropos..." tags-apropos]
900 "-----"
901 ["Set Tags Table File..." visit-tags-table]
902 ))
903
904 nil ; the partition: menus after this are flushright
905
906 ("Help"
907 ["About XEmacs..." about-xemacs]
908 ("Basics"
909 ["Installation" describe-installation
910 :active (boundp 'Installation-string)] 1449 :active (boundp 'Installation-string)]
911 ;; Tutorials. 1450 ["%_No Warranty" describe-no-warranty]
912 ,(if (featurep 'mule) 1451 ["XEmacs %_License" describe-copying]
913 ;; Mule tutorials. 1452 ["Find %_Packages" finder-by-keyword]
914 (let ((lang language-info-alist) 1453 ["View %_Splash Screen" xemacs-splash-buffer]
915 submenu tut) 1454 ["%_Unix Manual..." manual-entry])
916 (while lang 1455 ["Send %_Bug Report..." report-emacs-bug
917 (and (setq tut (assq 'tutorial (car lang)))
918 (not (string= (caar lang) "ASCII"))
919 (setq
920 submenu
921 (cons
922 `[,(caar lang) (help-with-tutorial nil ,(cdr tut))]
923 submenu)))
924 (setq lang (cdr lang)))
925 (append `("Tutorials"
926 :filter tutorials-menu-filter
927 ["Default" help-with-tutorial t
928 ,(concat "(" current-language-environment ")")])
929 submenu))
930 ;; Non mule tutorials.
931 (let ((lang tutorial-supported-languages)
932 submenu)
933 (while lang
934 (setq submenu
935 (cons
936 `[,(caar lang)
937 (help-with-tutorial ,(format "TUTORIAL.%s"
938 (cadr (car lang))))]
939 submenu))
940 (setq lang (cdr lang)))
941 (append '("Tutorials"
942 ["English" help-with-tutorial])
943 submenu)))
944 ["News" view-emacs-news]
945 ["Packages" finder-by-keyword]
946 ["Splash" xemacs-splash-buffer])
947 "-----"
948 ("XEmacs FAQ"
949 ["FAQ (local)" xemacs-local-faq]
950 ["FAQ via WWW" xemacs-www-faq (boundp 'browse-url-browser-function)]
951 ["Home Page" xemacs-www-page (boundp 'browse-url-browser-function)])
952 ("Samples"
953 ["Sample .emacs" (find-file (locate-data-file "sample.emacs")) (locate-data-file "sample.emacs")]
954 ["Sample .Xdefaults" (find-file (locate-data-file "sample.Xdefaults")) (locate-data-file "sample.Xdefaults")]
955 ["Sample enriched" (find-file (locate-data-file "enriched.doc")) (locate-data-file "enriched.doc")])
956 "-----"
957 ("Lookup in Info"
958 ["Key Binding..." Info-goto-emacs-key-command-node]
959 ["Command..." Info-goto-emacs-command-node]
960 ["Function..." Info-elisp-ref]
961 ["Topic..." Info-query])
962 ("Manuals"
963 ["Info" info]
964 ["Unix Manual..." manual-entry])
965 ("Commands & Keys"
966 ["Mode" describe-mode]
967 ["Apropos..." hyper-apropos]
968 ["Apropos Docs..." apropos-documentation]
969 "-----"
970 ["Key..." describe-key]
971 ["Bindings" describe-bindings]
972 ["Mouse Bindings" describe-pointer]
973 ["Recent Keys" view-lossage]
974 "-----"
975 ["Function..." describe-function]
976 ["Variable..." describe-variable]
977 ["Locate Command..." where-is])
978 "-----"
979 ["Recent Messages" view-lossage]
980 ("Misc"
981 ["No Warranty" describe-no-warranty]
982 ["XEmacs License" describe-copying]
983 ["The Latest Version" describe-distribution])
984 ["Send Bug Report..." report-emacs-bug
985 :active (fboundp 'report-emacs-bug)])))) 1456 :active (fboundp 'report-emacs-bug)]))))
986 1457
987 1458
988 (defun maybe-add-init-button () 1459 (defun maybe-add-init-button ()
989 "Don't call this. 1460 "Don't call this.
990 Adds `Load .emacs' button to menubar when starting up with -q." 1461 Adds `Load .emacs' button to menubar when starting up with -q."
991 ;; by Stig@hackvan.com 1462 (when (and (not load-user-init-file-p)
992 (cond 1463 (file-exists-p (expand-file-name ".emacs" "~")))
993 (load-user-init-file-p nil) 1464 (add-menu-button
994 ((file-exists-p (expand-file-name ".emacs" "~")) 1465 nil
995 (add-menu-button nil 1466 ["%_Load .emacs"
996 ["Load .emacs" 1467 (progn
997 (progn (delete-menu-item '("Load .emacs")) 1468 (mapc #'(lambda (buf)
998 (load-user-init-file)) 1469 (with-current-buffer buf
999 ] 1470 (delete-menu-item '("Load .emacs"))))
1000 "Help")) 1471 (buffer-list))
1001 (t nil))) 1472 (load-user-init-file))
1473 ]
1474 "Help")))
1002 1475
1003 (add-hook 'before-init-hook 'maybe-add-init-button) 1476 (add-hook 'before-init-hook 'maybe-add-init-button)
1004 1477
1005 1478
1006 ;;; The File menu 1479 ;;; The File menu
1009 1482
1010 1483
1011 ;;; The Bookmarks menu 1484 ;;; The Bookmarks menu
1012 1485
1013 (defun bookmark-menu-filter (&rest ignore) 1486 (defun bookmark-menu-filter (&rest ignore)
1487 (declare (special bookmark-alist))
1014 (let ((definedp (and (boundp 'bookmark-alist) 1488 (let ((definedp (and (boundp 'bookmark-alist)
1015 bookmark-alist 1489 bookmark-alist
1016 t))) 1490 t)))
1017 `(,(if definedp 1491 `(,(if definedp
1018 '("Jump to Bookmark" 1492 '("%_Jump to Bookmark"
1019 :filter (lambda (&rest junk) 1493 :filter (lambda (&rest junk)
1020 (mapcar #'(lambda (bmk) 1494 (submenu-generate-accelerator-spec
1021 `[,bmk (bookmark-jump ',bmk)]) 1495 (mapcar #'(lambda (bmk)
1022 (bookmark-all-names)))) 1496 `[,bmk (bookmark-jump ',bmk)])
1023 ["Jump to Bookmark" nil nil]) 1497 (bookmark-all-names)))))
1024 ["Set bookmark" bookmark-set 1498 ["%_Jump to Bookmark" nil nil])
1499 ["Set %_Bookmark" bookmark-set
1025 :active (fboundp 'bookmark-set)] 1500 :active (fboundp 'bookmark-set)]
1026 "---" 1501 "---"
1027 ["Insert contents" bookmark-menu-insert 1502 ["Insert %_Contents" bookmark-menu-insert
1028 :active (fboundp 'bookmark-menu-insert)] 1503 :active (fboundp 'bookmark-menu-insert)]
1029 ["Insert location" bookmark-menu-locate 1504 ["Insert L%_ocation" bookmark-menu-locate
1030 :active (fboundp 'bookmark-menu-locate)] 1505 :active (fboundp 'bookmark-menu-locate)]
1031 "---" 1506 "---"
1032 ["Rename bookmark" bookmark-menu-rename 1507 ["%_Rename Bookmark" bookmark-menu-rename
1033 :active (fboundp 'bookmark-menu-rename)] 1508 :active (fboundp 'bookmark-menu-rename)]
1034 ,(if definedp 1509 ,(if definedp
1035 '("Delete Bookmark" 1510 '("%_Delete Bookmark"
1036 :filter (lambda (&rest junk) 1511 :filter (lambda (&rest junk)
1037 (mapcar #'(lambda (bmk) 1512 (submenu-generate-accelerator-spec
1038 `[,bmk (bookmark-delete ',bmk)]) 1513 (mapcar #'(lambda (bmk)
1039 (bookmark-all-names)))) 1514 `[,bmk (bookmark-delete ',bmk)])
1040 ["Delete Bookmark" nil nil]) 1515 (bookmark-all-names)))))
1041 ["Edit Bookmark List" bookmark-bmenu-list ,definedp] 1516 ["%_Delete Bookmark" nil nil])
1517 ["%_Edit Bookmark List" bookmark-bmenu-list ,definedp]
1042 "---" 1518 "---"
1043 ["Save bookmarks" bookmark-save ,definedp] 1519 ["%_Save Bookmarks" bookmark-save ,definedp]
1044 ["Save bookmarks as..." bookmark-write ,definedp] 1520 ["Save Bookmarks %_As..." bookmark-write ,definedp]
1045 ["Load a bookmark file" bookmark-load 1521 ["%_Load a Bookmark File" bookmark-load
1046 :active (fboundp 'bookmark-load)]))) 1522 :active (fboundp 'bookmark-load)])))
1047 1523
1048 ;;; The Buffers menu 1524 ;;; The Buffers menu
1049 1525
1050 (defgroup buffers-menu nil 1526 (defgroup buffers-menu nil
1051 "Customization of `Buffers' menu." 1527 "Customization of `Buffers' menu."
1052 :group 'menu) 1528 :group 'menu)
1529
1530 (defvar buffers-menu-omit-chars-list '(?b ?p ?l ?d))
1053 1531
1054 (defcustom buffers-menu-max-size 25 1532 (defcustom buffers-menu-max-size 25
1055 "*Maximum number of entries which may appear on the \"Buffers\" menu. 1533 "*Maximum number of entries which may appear on the \"Buffers\" menu.
1056 If this is 10, then only the ten most-recently-selected buffers will be 1534 If this is 10, then only the ten most-recently-selected buffers will be
1057 shown. If this is nil, then all buffers will be shown. Setting this to 1535 shown. If this is nil, then all buffers will be shown. Setting this to
1094 :type '(choice (const :tag "None" nil) 1572 :type '(choice (const :tag "None" nil)
1095 function) 1573 function)
1096 :group 'buffers-menu) 1574 :group 'buffers-menu)
1097 1575
1098 (defcustom buffers-menu-format-buffer-line-function 'format-buffers-menu-line 1576 (defcustom buffers-menu-format-buffer-line-function 'format-buffers-menu-line
1099 "*The function to call to return a string to represent a buffer in the 1577 "*The function to call to return a string to represent a buffer in
1100 buffers menu. The function is passed a buffer and should return a string. 1578 the buffers menu. The function is passed a buffer and a number
1101 The default value `format-buffers-menu-line' just returns the name of 1579 (starting with 1) indicating which buffer line in the menu is being
1102 the buffer. Also check out `slow-format-buffers-menu-line' which 1580 processed and should return a string containing an accelerator
1103 returns a whole bunch of info about a buffer." 1581 spec. (Check out `menu-item-generate-accelerator-spec' as a convenient
1582 way of generating the accelerator specs.) The default value
1583 `format-buffers-menu-line' just returns the name of the buffer and
1584 uses the number as the accelerator. Also check out
1585 `slow-format-buffers-menu-line' which returns a whole bunch of info
1586 about a buffer.
1587
1588 Note: Gross Compatibility Hack: Older versions of this function prototype
1589 only expected one argument, not two. We deal gracefully with such
1590 functions by simply calling them with one argument and leaving out the
1591 line number. However, this may go away at any time, so make sure to
1592 update all of your functions of this type."
1104 :type 'function 1593 :type 'function
1105 :group 'buffers-menu) 1594 :group 'buffers-menu)
1106 1595
1107 (defcustom buffers-menu-sort-function 1596 (defcustom buffers-menu-sort-function
1108 'sort-buffers-menu-by-mode-then-alphabetically 1597 'sort-buffers-menu-by-mode-then-alphabetically
1128 The sensible values of this function are dependent on the value specified 1617 The sensible values of this function are dependent on the value specified
1129 for `buffers-menu-sort-function'." 1618 for `buffers-menu-sort-function'."
1130 :type '(choice (const :tag "None" nil) 1619 :type '(choice (const :tag "None" nil)
1131 function) 1620 function)
1132 :group 'buffers-menu) 1621 :group 'buffers-menu)
1133
1134 (defun buffers-menu-omit-invisible-buffers (buf)
1135 "For use as a value of `buffers-menu-omit-function'.
1136 Omits normally invisible buffers (those whose name begins with a space)."
1137 (not (null (string-match "\\` " (buffer-name buf)))))
1138 1622
1139 (defun sort-buffers-menu-alphabetically (buf1 buf2) 1623 (defun sort-buffers-menu-alphabetically (buf1 buf2)
1140 "For use as a value of `buffers-menu-sort-function'. 1624 "For use as a value of `buffers-menu-sort-function'.
1141 Sorts the buffers in alphabetical order by name, but puts buffers beginning 1625 Sorts the buffers in alphabetical order by name, but puts buffers beginning
1142 with a star at the end of the list." 1626 with a star at the end of the list."
1176 nil) 1660 nil)
1177 (t 1661 (t
1178 (string-lessp nam1 nam2))))) 1662 (string-lessp nam1 nam2)))))
1179 1663
1180 ;; this version is too slow on some machines. 1664 ;; this version is too slow on some machines.
1181 (defun slow-format-buffers-menu-line (buffer) 1665 ;; (vintage 1990, that is)
1666 (defun slow-format-buffers-menu-line (buffer n)
1182 "For use as a value of `buffers-menu-format-buffer-line-function'. 1667 "For use as a value of `buffers-menu-format-buffer-line-function'.
1183 This returns a string containing a bunch of info about the buffer." 1668 This returns a string containing a bunch of info about the buffer."
1184 (format "%s%s %-19s %6s %-15s %s" 1669 (concat (menu-item-generate-accelerator-spec n buffers-menu-omit-chars-list)
1185 (if (buffer-modified-p buffer) "*" " ") 1670 (format "%s%s %-19s %6s %-15s %s"
1186 (if (symbol-value-in-buffer 'buffer-read-only buffer) "%" " ") 1671 (if (buffer-modified-p buffer) "*" " ")
1187 (buffer-name buffer) 1672 (if (symbol-value-in-buffer 'buffer-read-only buffer)
1188 (buffer-size buffer) 1673 "%" " ")
1189 (symbol-value-in-buffer 'mode-name buffer) 1674 (buffer-name buffer)
1190 (or (buffer-file-name buffer) ""))) 1675 (buffer-size buffer)
1191 1676 (symbol-value-in-buffer 'mode-name buffer)
1192 (defun format-buffers-menu-line (buffer) 1677 (or (buffer-file-name buffer) ""))))
1678
1679 (defun format-buffers-menu-line (buffer n)
1193 "For use as a value of `buffers-menu-format-buffer-line-function'. 1680 "For use as a value of `buffers-menu-format-buffer-line-function'.
1194 This just returns the buffer's name." 1681 This just returns the buffer's name."
1195 (buffer-name buffer)) 1682 (concat (menu-item-generate-accelerator-spec n buffers-menu-omit-chars-list)
1683 (buffer-name buffer)))
1196 1684
1197 (defun group-buffers-menu-by-mode-then-alphabetically (buf1 buf2) 1685 (defun group-buffers-menu-by-mode-then-alphabetically (buf1 buf2)
1198 "For use as a value of `buffers-menu-grouping-function'. 1686 "For use as a value of `buffers-menu-grouping-function'.
1199 This groups buffers by major mode. It only really makes sense if 1687 This groups buffers by major mode. It only really makes sense if
1200 `buffers-menu-sorting-function' is 1688 `buffers-menu-sorting-function' is
1219 (write-file (read-file-name 1707 (write-file (read-file-name
1220 (format "Write %s to file: " 1708 (format "Write %s to file: "
1221 (buffer-name (current-buffer))))))) 1709 (buffer-name (current-buffer)))))))
1222 1710
1223 (defsubst build-buffers-menu-internal (buffers) 1711 (defsubst build-buffers-menu-internal (buffers)
1224 (let (name line) 1712 (let (name line (n 0))
1225 (mapcar 1713 (mapcar
1226 #'(lambda (buffer) 1714 #'(lambda (buffer)
1227 (if (eq buffer t) 1715 (if (eq buffer t)
1228 "---" 1716 "---"
1229 (setq line (funcall buffers-menu-format-buffer-line-function 1717 (setq n (1+ n))
1230 buffer)) 1718 (setq line
1719 ; #### a truly Kyle-friendly hack.
1720 (let ((fn buffers-menu-format-buffer-line-function))
1721 (if (= (function-max-args fn) 1)
1722 (funcall fn buffer)
1723 (funcall fn buffer n))))
1231 (if complex-buffers-menu-p 1724 (if complex-buffers-menu-p
1232 (delq nil 1725 (delq nil
1233 (list line 1726 (list line
1234 (vector "Switch to Buffer" 1727 (vector "S%_witch to Buffer"
1235 (list buffers-menu-switch-to-buffer-function 1728 (list buffers-menu-switch-to-buffer-function
1236 (setq name (buffer-name buffer))) 1729 (setq name (buffer-name buffer)))
1237 t) 1730 t)
1238 (if (eq buffers-menu-switch-to-buffer-function 1731 (if (eq buffers-menu-switch-to-buffer-function
1239 'switch-to-buffer) 1732 'switch-to-buffer)
1240 (vector "Switch to Buffer, Other Frame" 1733 (vector "Switch to Buffer, Other %_Frame"
1241 (list 'switch-to-buffer-other-frame 1734 (list 'switch-to-buffer-other-frame
1242 (setq name (buffer-name buffer))) 1735 (setq name (buffer-name buffer)))
1243 t) 1736 t)
1244 nil) 1737 nil)
1245 (if (and (buffer-modified-p buffer) 1738 (if (and (buffer-modified-p buffer)
1246 (buffer-file-name buffer)) 1739 (buffer-file-name buffer))
1247 (vector "Save Buffer" 1740 (vector "%_Save Buffer"
1248 (list 'buffer-menu-save-buffer name) t) 1741 (list 'buffer-menu-save-buffer name) t)
1249 ["Save Buffer" nil nil] 1742 ["%_Save Buffer" nil nil]
1250 ) 1743 )
1251 (vector "Save As..." 1744 (vector "Save %_As..."
1252 (list 'buffer-menu-write-file name) t) 1745 (list 'buffer-menu-write-file name) t)
1253 (vector "Delete Buffer" (list 'kill-buffer name) 1746 (vector "%_Delete Buffer" (list 'kill-buffer name)
1254 t))) 1747 t)))
1255 ;; #### We don't want buffer names to be translated, 1748 ;; #### We don't want buffer names to be translated,
1256 ;; #### so we put the buffer name in the suffix. 1749 ;; #### so we put the buffer name in the suffix.
1257 ;; #### Also, avoid losing with non-ASCII buffer names. 1750 ;; #### Also, avoid losing with non-ASCII buffer names.
1258 ;; #### We still lose, however, if complex-buffers-menu-p. --mrb 1751 ;; #### We still lose, however, if complex-buffers-menu-p. --mrb
1321 (append menu buffers) 1814 (append menu buffers)
1322 )) 1815 ))
1323 1816
1324 (defun language-environment-menu-filter (menu) 1817 (defun language-environment-menu-filter (menu)
1325 "This is the menu filter for the \"Language Environment\" submenu." 1818 "This is the menu filter for the \"Language Environment\" submenu."
1326 (mapcar (lambda (env-sym) 1819 (declare (special language-environment-list))
1327 `[ ,(capitalize (symbol-name env-sym)) 1820 (let ((n 0))
1328 (set-language-environment ',env-sym)]) 1821 (mapcar (lambda (env-sym)
1329 language-environment-list)) 1822 (setq n (1+ n))
1823 `[ ,(concat (menu-item-generate-accelerator-spec n)
1824 (capitalize (symbol-name env-sym)))
1825 (set-language-environment ',env-sym)])
1826 language-environment-list)))
1330 1827
1331 1828
1332 ;;; The Options menu 1829 ;;; The Options menu
1333 1830
1334 ;; We'll keep those variables here for a while, in order to provide a 1831 ;; We'll keep those variables here for a while, in order to provide a
1358 1855
1359 1856
1360 1857
1361 ;;; The Help menu 1858 ;;; The Help menu
1362 1859
1363 (if (featurep 'mule) 1860 (defun tutorials-menu-filter (menu-items)
1364 (defun tutorials-menu-filter (menu-items) 1861 (declare (special language-info-alist
1365 ;; If there's a tutorial for the current language environment, make it 1862 current-language-environment
1366 ;; appear first as the default one. Otherwise, use the english one. 1863 tutorial-supported-languages))
1367 (let* ((menu menu-items) 1864 (append
1368 (item (pop menu-items))) 1865 (if (featurep 'mule)
1369 (aset 1866 (if (assq 'tutorial
1370 item 3 1867 (assoc current-language-environment language-info-alist))
1371 (concat "(" 1868 `([,(concat "%_Default (" current-language-environment ")")
1372 (if (assoc 1869 help-with-tutorial]))
1373 'tutorial 1870 '(["%_English" help-with-tutorial]))
1374 (assoc current-language-environment language-info-alist)) 1871 (submenu-generate-accelerator-spec
1375 current-language-environment 1872 (if (featurep 'mule)
1376 "English") 1873 ;; Mule tutorials.
1377 ")")) 1874 (mapcan #'(lambda (lang)
1378 menu))) 1875 (let ((tut (assq 'tutorial lang)))
1379 1876 (and tut
1380 1877 (not (string= (car lang) "ASCII"))
1878 ;; skip current language, since we already
1879 ;; included it first
1880 (not (string= (car lang)
1881 current-language-environment))
1882 `([,(car lang)
1883 (help-with-tutorial nil ,(cdr tut))]))))
1884 language-info-alist)
1885 ;; Non mule tutorials.
1886 (mapcar #'(lambda (lang)
1887 `[,(car lang)
1888 (help-with-tutorial ,(format "TUTORIAL.%s"
1889 (cadr lang)))])
1890 tutorial-supported-languages)))))
1891
1381 (set-menubar default-menubar) 1892 (set-menubar default-menubar)
1382 1893
1383 1894
1384 ;;; Popup menus. 1895 ;;; Popup menus.
1385 1896
1386 (defconst default-popup-menu 1897 (defconst default-popup-menu
1387 '("XEmacs Commands" 1898 '("XEmacs Commands"
1388 ["Undo" advertised-undo 1899 ["%_Undo" advertised-undo
1389 :active (and (not (eq buffer-undo-list t)) 1900 :active (and (not (eq buffer-undo-list t))
1390 (or buffer-undo-list pending-undo-list)) 1901 (or buffer-undo-list pending-undo-list))
1391 :suffix (if (or (eq last-command 'undo) 1902 :suffix (if (or (eq last-command 'undo)
1392 (eq last-command 'advertised-undo)) 1903 (eq last-command 'advertised-undo))
1393 "More" "")] 1904 "More" "")]
1394 ["Cut" kill-primary-selection 1905 ["Cu%_t" kill-primary-selection
1395 :active (selection-owner-p)] 1906 :active (selection-owner-p)]
1396 ["Copy" copy-primary-selection 1907 ["%_Copy" copy-primary-selection
1397 :active (selection-owner-p)] 1908 :active (selection-owner-p)]
1398 ["Paste" yank-clipboard-selection 1909 ["%_Paste" yank-clipboard-selection
1399 :active (selection-exists-p 'CLIPBOARD)] 1910 :active (selection-exists-p 'CLIPBOARD)]
1400 ["Clear" delete-primary-selection 1911 ["%_Delete" delete-primary-selection
1401 :active (selection-owner-p)] 1912 :active (selection-owner-p)]
1402 "-----" 1913 "-----"
1403 ["Select Block" mark-paragraph] 1914 ["Select %_Block" mark-paragraph]
1404 ["Split Window" split-window-vertically] 1915 ["Sp%_lit Window" split-window-vertically]
1405 ["Unsplit Window" delete-other-windows] 1916 ["U%_nsplit Window" delete-other-windows]
1406 )) 1917 ))
1407
1408 (defvar global-popup-menu nil
1409 "The global popup menu. This is present in all modes.
1410 See the function `popup-menu' for a description of menu syntax.")
1411
1412 (defvar mode-popup-menu nil
1413 "The mode-specific popup menu. Automatically buffer local.
1414 This is appended to the default items in `global-popup-menu'.
1415 See the function `popup-menu' for a description of menu syntax.")
1416 (make-variable-buffer-local 'mode-popup-menu)
1417 1918
1418 ;; In an effort to avoid massive menu clutter, this mostly worthless menu is 1919 ;; In an effort to avoid massive menu clutter, this mostly worthless menu is
1419 ;; superseded by any local popup menu... 1920 ;; superseded by any local popup menu...
1420 (setq-default mode-popup-menu default-popup-menu) 1921 (setq-default mode-popup-menu default-popup-menu)
1421 1922
1422 (defvar activate-popup-menu-hook nil 1923
1423 "Function or functions run before a mode-specific popup menu is made visible. 1924 ;; misc
1424 These functions are called with no arguments, and should interrogate and
1425 modify the value of `global-popup-menu' or `mode-popup-menu' as desired.
1426 Note: this hook is only run if you use `popup-mode-menu' for activating the
1427 global and mode-specific commands; if you have your own binding for button3,
1428 this hook won't be run.")
1429
1430 (defun popup-mode-menu ()
1431 "Pop up a menu of global and mode-specific commands.
1432 The menu is computed by combining `global-popup-menu' and `mode-popup-menu'."
1433 (interactive "@_")
1434 (run-hooks 'activate-popup-menu-hook)
1435 (popup-menu
1436 (cond ((and global-popup-menu mode-popup-menu)
1437 ;; Merge global-popup-menu and mode-popup-menu
1438 (check-menu-syntax mode-popup-menu)
1439 (let* ((title (car mode-popup-menu))
1440 (items (cdr mode-popup-menu))
1441 mode-filters)
1442 ;; Strip keywords from local menu for attaching them at the top
1443 (while (and items
1444 (keywordp (car items)))
1445 ;; Push both keyword and its argument.
1446 (push (pop items) mode-filters)
1447 (push (pop items) mode-filters))
1448 (setq mode-filters (nreverse mode-filters))
1449 ;; If mode-filters contains a keyword already present in
1450 ;; `global-popup-menu', you will probably lose.
1451 (append (list (car global-popup-menu))
1452 mode-filters
1453 (cdr global-popup-menu)
1454 '("---" "---")
1455 (if popup-menu-titles (list title))
1456 (if popup-menu-titles '("---" "---"))
1457 items)))
1458 (t
1459 (or mode-popup-menu
1460 global-popup-menu
1461 (error "No menu defined in this buffer"))))))
1462
1463 (defun popup-buffer-menu (event)
1464 "Pop up a copy of the Buffers menu (from the menubar) where the mouse is clicked."
1465 (interactive "e")
1466 (let ((window (and (event-over-text-area-p event) (event-window event)))
1467 (bmenu nil))
1468 (or window
1469 (error "Pointer must be in a normal window"))
1470 (select-window window)
1471 (if current-menubar
1472 (setq bmenu (assoc "Buffers" current-menubar)))
1473 (if (null bmenu)
1474 (setq bmenu (assoc "Buffers" default-menubar)))
1475 (if (null bmenu)
1476 (error "Can't find the Buffers menu"))
1477 (popup-menu bmenu)))
1478
1479 (defun popup-menubar-menu (event)
1480 "Pop up a copy of menu that also appears in the menubar"
1481 ;; by Stig@hackvan.com
1482 (interactive "e")
1483 (let ((window (and (event-over-text-area-p event) (event-window event)))
1484 popup-menubar)
1485 (or window
1486 (error "Pointer must be in a normal window"))
1487 (select-window window)
1488 (and current-menubar (run-hooks 'activate-menubar-hook))
1489 ;; ##### Instead of having to copy this just to safely get rid of
1490 ;; any nil what we should really do is fix up the internal menubar
1491 ;; code to just ignore nil if generating a popup menu
1492 (setq popup-menubar (delete nil (copy-sequence (or current-menubar
1493 default-menubar))))
1494 (popup-menu (cons "Menubar Menu" popup-menubar))
1495 ))
1496
1497 (global-set-key 'button3 'popup-mode-menu)
1498 ;; shift button3 and shift button2 are reserved for Hyperbole
1499 (global-set-key '(meta control button3) 'popup-buffer-menu)
1500 ;; The following command is way too dangerous with Custom.
1501 ;; (global-set-key '(meta shift button3) 'popup-menubar-menu)
1502
1503 ;; Here's a test of the cool new menu features (from Stig).
1504
1505 ;;(setq mode-popup-menu
1506 ;; '("Test Popup Menu"
1507 ;; :filter cdr
1508 ;; ["this item won't appear because of the menu filter" ding t]
1509 ;; "--:singleLine"
1510 ;; "singleLine"
1511 ;; "--:doubleLine"
1512 ;; "doubleLine"
1513 ;; "--:singleDashedLine"
1514 ;; "singleDashedLine"
1515 ;; "--:doubleDashedLine"
1516 ;; "doubleDashedLine"
1517 ;; "--:noLine"
1518 ;; "noLine"
1519 ;; "--:shadowEtchedIn"
1520 ;; "shadowEtchedIn"
1521 ;; "--:shadowEtchedOut"
1522 ;; "shadowEtchedOut"
1523 ;; "--:shadowDoubleEtchedIn"
1524 ;; "shadowDoubleEtchedIn"
1525 ;; "--:shadowDoubleEtchedOut"
1526 ;; "shadowDoubleEtchedOut"
1527 ;; "--:shadowEtchedInDash"
1528 ;; "shadowEtchedInDash"
1529 ;; "--:shadowEtchedOutDash"
1530 ;; "shadowEtchedOutDash"
1531 ;; "--:shadowDoubleEtchedInDash"
1532 ;; "shadowDoubleEtchedInDash"
1533 ;; "--:shadowDoubleEtchedOutDash"
1534 ;; "shadowDoubleEtchedOutDash"
1535 ;; ))
1536 1925
1537 (defun xemacs-splash-buffer () 1926 (defun xemacs-splash-buffer ()
1538 "Redisplay XEmacs splash screen in a buffer." 1927 "Redisplay XEmacs splash screen in a buffer."
1539 (interactive) 1928 (interactive)
1540 (let ((buffer (get-buffer-create "*Splash*")) 1929 (let ((buffer (get-buffer-create "*Splash*"))