comparison lisp/menubar-items.el @ 404:2f8bb876ab1d r21-2-32

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