1 ;;; menubar-items.el --- Menubar and popup-menu content for XEmacs.
3 ;; Copyright (C) 1991-1995, 1997-1998 Free Software Foundation, Inc.
4 ;; Copyright (C) 1995 Tinker Systems and INS Engineering Corp.
5 ;; Copyright (C) 1995 Sun Microsystems.
6 ;; Copyright (C) 1995, 1996, 2000 Ben Wing.
7 ;; Copyright (C) 1997 MORIOKA Tomohiko.
9 ;; Maintainer: XEmacs Development Team
10 ;; Keywords: frames, extensions, internal, dumped
12 ;; This file is part of XEmacs.
14 ;; XEmacs is free software; you can redistribute it and/or modify it
15 ;; under the terms of the GNU General Public License as published by
16 ;; the Free Software Foundation; either version 2, or (at your option)
19 ;; XEmacs is distributed in the hope that it will be useful, but
20 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
21 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 ;; General Public License for more details.
24 ;; You should have received a copy of the GNU General Public License
25 ;; along with Xmacs; see the file COPYING. If not, write to the
26 ;; Free Software Foundation, 59 Temple Place - Suite 330,
27 ;; Boston, MA 02111-1307, USA.
31 ;; Created c. 1991 for Lucid Emacs. Originally called x-menubar.el.
32 ;; Contained four menus -- File, Edit, Buffers, Help.
33 ;; Dynamic menu changes possible only through activate-menubar-hook.
34 ;; Also contained menu manipulation funs, e.g. find-menu-item, add-menu.
35 ;; Options menu added for 19.9 by Jamie Zawinski, late 1993.
36 ;; Major reorganization c. 1994 by Ben Wing; added many items and moved
37 ;; some items to two new menus, Apps and Tools. (for 19.10?)
38 ;; Generic menubar functions moved to new file, menubar.el, by Ben Wing,
39 ;; 1995, for 19.12; also, creation of current buffers menu options,
40 ;; and buffers menu changed from purely most-recent to sorted alphabetical,
41 ;; by mode. Also added mode-popup-menu support.
42 ;; New API (add-submenu, add-menu-button) and menu filter support added
43 ;; late summer 1995 by Stig, for 19.13. Also popup-menubar-menu.
44 ;; Renamed to menubar-items.el c. 1998, with MS Win support.
45 ;; Options menu rewritten to use custom c. 1999 by ? (Jan Vroonhof?).
46 ;; Major reorganization Mar. 2000 by Ben Wing; added many items and changed
47 ;; top-level menus to File, Edit, View, Cmds, Tools, Options, Buffers.
48 ;; Accelerator spec functionality added Mar. 2000 by Ben Wing.
52 ;; This file is dumped with XEmacs (when window system and menubar support is
57 (defun menu-truncate-list (list n)
58 (if (<= (length list) n)
60 (butlast list (- (length list) n))))
62 (defun submenu-generate-accelerator-spec (list &optional omit-chars-list)
63 "Add auto-generated accelerator specifications to a submenu.
64 This can be used to add accelerators to the return value of a menu filter
65 function. It correctly ignores unselectable items. It will destructively
66 modify the list passed to it. If an item already has an auto-generated
67 accelerator spec, this will be removed before the new one is added, making
68 this function idempotent.
70 If OMIT-CHARS-LIST is given, it should be a list of lowercase characters,
71 which will not be used as accelerators."
73 (dolist (item list list)
79 (menu-item-generate-accelerator-spec n omit-chars-list)
80 (menu-item-strip-accelerator-spec (aref item 0)))))
85 (menu-item-generate-accelerator-spec n omit-chars-list)
86 (menu-item-strip-accelerator-spec (car item)))))))))
88 (defun menu-item-strip-accelerator-spec (item)
89 "Strip an auto-generated accelerator spec off of ITEM.
90 ITEM should be a string. This removes specs added by
91 `menu-item-generate-accelerator-spec' and `submenu-generate-accelerator-spec'."
92 (if (string-match "%_. " item)
96 (defun menu-item-generate-accelerator-spec (n &optional omit-chars-list)
97 "Return an accelerator specification for use with auto-generated menus.
98 This should be concat'd onto the beginning of each menu line. The spec
99 allows the Nth line to be selected by the number N. '0' is used for the
100 10th line, and 'a' through 'z' are used for the following 26 lines.
102 If OMIT-CHARS-LIST is given, it should be a list of lowercase characters,
103 which will not be used as accelerators."
104 (cond ((< n 10) (concat "%_" (int-to-string n) " "))
111 (while (memq (int-to-char (+ m (- (char-to-int ?a) 1)))
118 (char-to-string (int-to-char (+ m (- (char-to-int ?a) 1))))
123 (defconst default-menubar
124 ; (purecopy-menubar ;purespace is dead
128 ["%_Open..." find-file]
129 ["Open in Other %_Window..." find-file-other-window]
130 ["Open in New %_Frame..." find-file-other-frame]
131 ["%_Hex Edit File..." hexl-find-file
132 :active (fboundp 'hexl-find-file)]
133 ["%_Insert File..." insert-file]
134 ["%_View File..." view-file]
136 ["%_Save" save-buffer
137 :active (buffer-modified-p)
138 :suffix (if put-buffer-names-in-file-menu (buffer-name) "")]
139 ["Save %_As..." write-file]
140 ["Save So%_me Buffers" save-some-buffers]
142 ["%_Print" generic-print-buffer
143 :active (or (valid-specifier-tag-p 'msprinter)
144 (and (not (eq system-type 'windows-nt))
145 (fboundp 'lpr-buffer)))
146 :suffix (if put-buffer-names-in-file-menu (concat (buffer-name) "...")
148 ["Prett%_y-Print" ps-print-buffer-with-faces
149 :active (fboundp 'ps-print-buffer-with-faces)
150 :suffix (if put-buffer-names-in-file-menu (buffer-name) "")]
152 ["%_Revert Buffer" revert-buffer
153 :active (or buffer-file-name revert-buffer-function)
154 :suffix (if put-buffer-names-in-file-menu (buffer-name) "")]
155 ["Re%_cover File..." recover-file]
156 ["Recover S%_ession..." recover-session]
158 ["E%_xit XEmacs" save-buffers-kill-emacs]
162 ["%_Undo" advertised-undo
163 :active (and (not (eq buffer-undo-list t))
164 (or buffer-undo-list pending-undo-list))
165 :suffix (if (or (eq last-command 'undo)
166 (eq last-command 'advertised-undo))
169 :included (fboundp 'redo)
170 :active (not (or (eq buffer-undo-list t)
171 (eq last-buffer-undo-list nil)
172 (not (or (eq last-buffer-undo-list buffer-undo-list)
173 (and (null (car-safe buffer-undo-list))
174 (eq last-buffer-undo-list
175 (cdr-safe buffer-undo-list)))))
176 (or (eq buffer-undo-list pending-undo-list)
177 (eq (cdr buffer-undo-list) pending-undo-list))))
178 :suffix (if (eq last-command 'redo) "More" "")]
180 ["Cu%_t" kill-primary-selection
181 :active (selection-owner-p)]
182 ["%_Copy" copy-primary-selection
183 :active (selection-owner-p)]
184 ["%_Paste" yank-clipboard-selection
185 :active (selection-exists-p 'CLIPBOARD)]
186 ["%_Delete" delete-primary-selection
187 :active (selection-owner-p)]
189 ["Select %_All" mark-whole-buffer]
190 ["Select Pa%_ge" mark-page]
192 ["%_Find..." make-search-dialog]
193 ["R%_eplace..." query-replace]
194 ["Replace (Rege%_xp)..." query-replace-regexp]
195 ["%_List Matching Lines..." list-matching-lines]
196 ,@(when (featurep 'mule)
198 ("%_Multilingual (\"Mule\")"
199 ("%_Describe Language Support")
200 ("%_Set Language Environment")
202 ["T%_oggle Input Method" toggle-input-method]
203 ["Select %_Input Method" set-input-method]
204 ["D%_escribe Input Method" describe-input-method]
206 ["Describe Current %_Coding Systems"
207 describe-current-coding-system]
208 ["Set Coding System of %_Buffer File..."
209 set-buffer-file-coding-system]
210 ;; not implemented yet
211 ["Set Coding System of %_Terminal..."
212 set-terminal-coding-system :active nil]
213 ;; not implemented yet
214 ["Set Coding System of %_Keyboard..."
215 set-keyboard-coding-system :active nil]
216 ["Set Coding System of %_Process..."
217 set-buffer-process-coding-system
218 :active (get-buffer-process (current-buffer))]
220 ["Show Cha%_racter Table" view-charset-by-menu]
221 ;; not implemented yet
222 ["Show Dia%_gnosis for MULE" mule-diag :active nil]
223 ["Show \"%_hello\" in Many Languages" view-hello-file]))
228 ["%_New Frame" make-frame]
229 ["Frame on Other Displa%_y..." make-frame-on-display]
230 ["%_Delete Frame" delete-frame
231 :active (not (eq (next-frame (selected-frame) 'nomini 'window-system)
234 ["%_Split Window" split-window-vertically]
235 ["S%_plit Window (Side by Side)" split-window-horizontally]
236 ["%_Un-Split (Keep This)" delete-other-windows
237 :active (not (one-window-p t))]
238 ["Un-Split (Keep %_Others)" delete-window
239 :active (not (one-window-p t))]
242 ["%_Narrow to Region" narrow-to-region :active (region-exists-p)]
243 ["Narrow to %_Page" narrow-to-page]
244 ["Narrow to %_Defun" narrow-to-defun]
246 ["%_Widen" widen :active (or (/= (point-min) 1)
247 (/= (point-max) (1+ (buffer-size))))]
250 ["Show Message %_Log" show-message-log]
252 ["%_Goto Line..." goto-line]
253 ["%_What Line" what-line]
255 :filter bookmark-menu-filter)
257 ["%_Jump to Previous Mark" (set-mark-command t)
262 ["Repeat %_Last Complex Command..." repeat-complex-command]
263 ["E%_valuate Lisp Expression..." eval-expression]
264 ["Execute %_Named Command..." execute-extended-command]
266 ["Start %_Macro Recording" start-kbd-macro
267 :included (not defining-kbd-macro)]
268 ["End %_Macro Recording" end-kbd-macro
269 :included defining-kbd-macro]
270 ["E%_xecute Last Macro" call-last-kbd-macro
271 :active last-kbd-macro]
273 ["%_Append to Last Macro" (start-kbd-macro t)
274 :active (and (not defining-kbd-macro) last-kbd-macro)]
275 ["%_Query User During Macro" kbd-macro-query
276 :active defining-kbd-macro]
277 ["Enter %_Recursive Edit During Macro" (kbd-macro-query t)
278 :active defining-kbd-macro]
280 ["E%_xecute Last Macro on Region Lines"
281 :active (and last-kbd-macro (region-exists-p))]
283 ["%_Name Last Macro..." name-last-kbd-macro
284 :active last-kbd-macro]
285 ["Assign Last Macro to %_Key..." assign-last-kbd-macro-to-key
286 :active (and last-kbd-macro
287 (fboundp 'assign-last-kbd-macro-to-key))]
289 ["%_Edit Macro..." edit-kbd-macro]
290 ["Edit %_Last Macro" edit-last-kbd-macro
291 :active last-kbd-macro]
293 ["%_Insert Named Macro into Buffer..." insert-kbd-macro]
294 ["Read Macro from Re%_gion" read-kbd-macro
295 :active (region-exists-p)]
299 ["D%_ynamic Abbrev Expand" dabbrev-expand]
300 ["Dynamic Abbrev %_Complete" dabbrev-completion]
301 ["Dynamic Abbrev Complete in %_All Buffers" (dabbrev-completion 16)]
304 ["%_Define Global Abbrev for " add-global-abbrev
305 :suffix (abbrev-string-to-be-defined nil)
307 ["Define %_Mode-Specific Abbrev for " add-mode-abbrev
308 :suffix (abbrev-string-to-be-defined nil)
310 ["Define Global Ex%_pansion for " inverse-add-global-abbrev
311 :suffix (inverse-abbrev-string-to-be-defined 1)
313 ["Define Mode-Specific Expa%_nsion for " inverse-add-mode-abbrev
314 :suffix (inverse-abbrev-string-to-be-defined 1)
317 ["E%_xpand Abbrev" expand-abbrev]
318 ["Expand Abbrevs in Re%_gion" expand-region-abbrevs
319 :active (region-exists-p)]
320 ["%_Unexpand Last Abbrev" unexpand-abbrev
321 :active (and (stringp last-abbrev-text)
322 (> last-abbrev-location 0))]
324 ["%_Kill All Abbrevs" kill-all-abbrevs]
325 ["%_Insert All Abbrevs into Buffer" insert-abbrevs]
326 ["%_List Abbrevs" list-abbrevs]
328 ["%_Edit Abbrevs" edit-abbrevs]
329 ["%_Redefine Abbrevs from Buffer" edit-abbrevs-redefine
330 :active (eq major-mode 'edit-abbrevs-mode)]
332 ["%_Save Abbrevs As..." write-abbrev-file]
333 ["L%_oad Abbrevs..." read-abbrev-file]
336 ["%_Copy to Register..." copy-to-register :active (region-exists-p)]
337 ["%_Paste Register..." insert-register]
339 ["%_Save Point to Register" point-to-register]
340 ["%_Jump to Register" register-to-point]
343 ["%_Kill Rectangle" kill-rectangle]
344 ["%_Yank Rectangle" yank-rectangle]
345 ["Rectangle %_to Register" copy-rectangle-to-register]
346 ["Rectangle %_from Register" insert-register]
347 ["%_Clear Rectangle" clear-rectangle]
348 ["%_Open Rectangle" open-rectangle]
349 ["%_Prefix Rectangle..." string-rectangle]
350 ["Rectangle %_Mousing"
351 (customize-set-variable 'mouse-track-rectangle-p
352 (not mouse-track-rectangle-p))
353 :style toggle :selected mouse-track-rectangle-p]
356 ["%_Lines in Region" sort-lines :active (region-exists-p)]
357 ["%_Paragraphs in Region" sort-paragraphs :active (region-exists-p)]
358 ["P%_ages in Region" sort-pages :active (region-exists-p)]
359 ["%_Columns in Region" sort-columns :active (region-exists-p)]
360 ["%_Regexp..." sort-regexp-fields :active (region-exists-p)]
363 ["%_Upcase Region" upcase-region :active (region-exists-p)]
364 ["%_Downcase Region" downcase-region :active (region-exists-p)]
365 ["%_Capitalize Region" capitalize-region :active (region-exists-p)]
366 ["%_Title-Case Region" capitalize-region-as-title
367 :active (region-exists-p)]
370 ["%_Line" center-line]
371 ["%_Paragraph" center-paragraph]
372 ["%_Region" center-region :active (region-exists-p)]
375 ["%_As Previous Line" indent-relative]
376 ["%_To Column..." indent-to-column]
378 ["%_Region" indent-region :active (region-exists-p)]
379 ["%_Balanced Expression" indent-sexp]
380 ["%_C Expression" indent-c-exp]
383 ["%_Buffer" ispell-buffer
384 :active (fboundp 'ispell-buffer)]
386 ["%_Word" ispell-word]
387 ["%_Complete Word" ispell-complete-word]
388 ["%_Region" ispell-region]
394 ("%_Add Download Site"
395 :filter (lambda (&rest junk)
396 (submenu-generate-accelerator-spec
397 (package-get-download-menu))))
398 ["%_Update Package Index" package-get-update-base]
399 ["%_List and Install" pui-list-packages]
400 ["U%_pdate Installed Packages" package-get-update-all]
401 ;; hack-o-matic, we can't force a load of package-base here
402 ;; since it triggers dialog box interactions which we can't
403 ;; deal with while using a menu
405 :filter (lambda (&rest junk)
407 (submenu-generate-accelerator-spec
408 (cdr (custom-menu-create 'packages)))
409 '("Please load Package Index"))))
411 ["%_Help" (Info-goto-node "(xemacs)Packages")])
413 ["Read Mail %_1 (VM)..." vm
414 :active (fboundp 'vm)]
415 ["Read Mail %_2 (MH)..." (mh-rmail t)
416 :active (fboundp 'mh-rmail)]
417 ["Send %_Mail..." compose-mail
418 :active (fboundp 'compose-mail)]
419 ["Usenet %_News" gnus
420 :active (fboundp 'gnus)]
421 ["Browse the %_Web" w3
422 :active (fboundp 'w3)])
427 (if (or (not (boundp 'grep-history)) (null grep-history))
430 (submenu-generate-accelerator-spec
431 (mapcar #'(lambda (string)
433 (list 'grep string)))
434 (menu-truncate-list grep-history 10)))))
435 (append menu '("---") items))))
436 ["%_Grep..." grep :active (fboundp 'grep)]
437 ["%_Kill Grep" kill-compilation
438 :active (and (fboundp 'kill-compilation)
439 (fboundp 'compilation-find-buffer)
440 (let ((buffer (condition-case nil
441 (compilation-find-buffer)
443 (and buffer (get-buffer-process buffer))))]
445 ["Grep %_All Files in Current Directory..."
449 (cons (concat grep-command " *")
450 (length grep-command))))
451 (call-interactively 'grep)))
452 :active (fboundp 'grep)]
453 ["Grep %_C and C Header Files in Current Directory..."
457 (cons (concat grep-command " *.[chCH]"
458 ; i wanted to also use *.cc and *.hh.
459 ; see long comment below under Perl.
461 (length grep-command))))
462 (call-interactively 'grep)))
463 :active (fboundp 'grep)]
464 ["Grep C Hea%_der Files in Current Directory..."
468 (cons (concat grep-command " *.[hH]"
469 ; i wanted to also use *.hh.
470 ; see long comment below under Perl.
472 (length grep-command))))
473 (call-interactively 'grep)))
474 :active (fboundp 'grep)]
475 ["Grep %_E-Lisp Files in Current Directory..."
479 (cons (concat grep-command " *.el")
480 (length grep-command))))
481 (call-interactively 'grep)))
482 :active (fboundp 'grep)]
483 ["Grep %_Perl Files in Current Directory..."
487 (cons (concat grep-command " *.pl"
488 ; i wanted to use this:
490 ; but grep complains if it can't
491 ; match anything in a glob, and
492 ; that screws other things up.
493 ; perhaps we need to first scan
494 ; each separate glob in the directory
495 ; to see if there are any files in
496 ; that glob, and if not, omit it.
498 (length grep-command))))
499 (call-interactively 'grep)))
500 :active (fboundp 'grep)]
501 ["Grep %_HTML Files in Current Directory..."
505 (cons (concat grep-command " *.*htm*")
506 (length grep-command))))
507 (call-interactively 'grep)))
508 :active (fboundp 'grep)]
510 ["%_Next Match" next-error
511 :active (and (fboundp 'compilation-errors-exist-p)
512 (compilation-errors-exist-p))]
513 ["Pre%_vious Match" previous-error
514 :active (and (fboundp 'compilation-errors-exist-p)
515 (compilation-errors-exist-p))]
516 ["%_First Match" first-error
517 :active (and (fboundp 'compilation-errors-exist-p)
518 (compilation-errors-exist-p))]
519 ["G%_oto Match" compile-goto-error
520 :active (and (fboundp 'compilation-errors-exist-p)
521 (compilation-errors-exist-p))]
523 ["%_Set Grep Command..."
526 (customize-set-variable
528 (read-shell-command "Default Grep Command: " grep-command)))
529 :active (fboundp 'grep)
535 (if (or (not (boundp 'compile-history)) (null compile-history))
538 (submenu-generate-accelerator-spec
539 (mapcar #'(lambda (string)
541 (list 'compile string)))
542 (menu-truncate-list compile-history 10)))))
543 (append menu '("---") items))))
544 ["%_Compile..." compile :active (fboundp 'compile)]
545 ["%_Repeat Compilation" recompile :active (fboundp 'recompile)]
546 ["%_Kill Compilation" kill-compilation
547 :active (and (fboundp 'kill-compilation)
548 (fboundp 'compilation-find-buffer)
549 (let ((buffer (condition-case nil
550 (compilation-find-buffer)
552 (and buffer (get-buffer-process buffer))))]
554 ["%_Next Error" next-error
555 :active (and (fboundp 'compilation-errors-exist-p)
556 (compilation-errors-exist-p))]
557 ["Pre%_vious Error" previous-error
558 :active (and (fboundp 'compilation-errors-exist-p)
559 (compilation-errors-exist-p))]
560 ["%_First Error" first-error
561 :active (and (fboundp 'compilation-errors-exist-p)
562 (compilation-errors-exist-p))]
563 ["G%_oto Error" compile-goto-error
564 :active (and (fboundp 'compilation-errors-exist-p)
565 (compilation-errors-exist-p))]
569 :active (fboundp 'gdb)]
571 :active (fboundp 'dbx)])
574 :active (fboundp 'shell)]
575 ["S%_hell Command..." shell-command
576 :active (fboundp 'shell-command)]
577 ["Shell Command on %_Region..." shell-command-on-region
578 :active (and (fboundp 'shell-command-on-region) (region-exists-p))])
581 ["%_Find Tag..." find-tag]
582 ["Find %_Other Window..." find-tag-other-window]
583 ["%_Next Tag..." (find-tag nil)]
584 ["N%_ext Other Window..." (find-tag-other-window nil)]
585 ["Next %_File" next-file]
587 ["Tags %_Search..." tags-search]
588 ["Tags %_Replace..." tags-query-replace]
589 ["%_Continue Search/Replace" tags-loop-continue]
591 ["%_Pop stack" pop-tag-mark]
592 ["%_Apropos..." tags-apropos]
594 ["%_Set Tags Table File..." visit-tags-table]
600 ["%_3-Month Calendar" calendar
601 :active (fboundp 'calendar)]
603 :active (fboundp 'diary)]
604 ["%_Holidays" holidays
605 :active (fboundp 'holidays)]
606 ;; we're all pagans at heart ...
607 ["%_Phases of the Moon" phases-of-moon
608 :active (fboundp 'phases-of-moon)]
609 ["%_Sunrise/Sunset" sunrise-sunset
610 :active (fboundp 'sunrise-sunset)])
614 :active (fboundp 'xmine)]
616 :active (fboundp 'tetris)]
618 :active (fboundp 'sokoban)]
619 ["Quote from %_Zippy" yow
620 :active (fboundp 'yow)]
621 ["%_Psychoanalyst" doctor
622 :active (fboundp 'doctor)]
623 ["Ps%_ychoanalyze Zippy!" psychoanalyze-pinhead
624 :active (fboundp 'psychoanalyze-pinhead)]
625 ["%_Random Flames" flame
626 :active (fboundp 'flame)]
627 ["%_Dunnet (Adventure)" dunnet
628 :active (fboundp 'dunnet)]
629 ["Towers of %_Hanoi" hanoi
630 :active (fboundp 'hanoi)]
631 ["Game of %_Life" life
632 :active (fboundp 'life)]
633 ["M%_ultiplication Puzzle" mpuz
634 :active (fboundp 'mpuz)])
640 ("%_Advanced (Customize)"
641 ("%_Emacs" :filter (lambda (&rest junk)
642 (cdr (custom-menu-create 'emacs))))
643 ["%_Group..." customize-group]
644 ["%_Variable..." customize-variable]
645 ["%_Face..." customize-face]
646 ["%_Saved..." customize-saved]
647 ["Se%_t..." customize-customized]
648 ["%_Apropos..." customize-apropos]
649 ["%_Browse..." customize-browse])
652 ["This Buffer %_Read Only" (toggle-read-only)
653 :style toggle :selected buffer-read-only]
654 ["%_Yank/Kill Interact With Clipboard"
655 (if (eq interprogram-cut-function 'own-clipboard)
657 (customize-set-variable 'interprogram-cut-function nil)
658 (customize-set-variable 'interprogram-paste-function nil))
659 (customize-set-variable 'interprogram-cut-function 'own-clipboard)
660 (customize-set-variable 'interprogram-paste-function 'get-clipboard))
662 :selected (eq interprogram-cut-function 'own-clipboard)]
665 (setq overwrite-mode (if overwrite-mode nil 'overwrite-mode-textual))
666 (customize-set-variable 'overwrite-mode overwrite-mode))
667 :style toggle :selected overwrite-mode]
669 (customize-set-variable 'abbrev-mode
670 (not (default-value 'abbrev-mode)))
672 :selected (default-value 'abbrev-mode)]
674 (customize-set-variable 'zmacs-regions (not zmacs-regions))
675 :style toggle :selected zmacs-regions]
677 ["%_Case Sensitive Search"
678 (customize-set-variable 'case-fold-search
679 (setq case-fold-search (not case-fold-search)))
680 :style toggle :selected (not case-fold-search)]
681 ["Case %_Matching Replace"
682 (customize-set-variable 'case-replace (not case-replace))
683 :style toggle :selected case-replace]
685 ("%_Newline at End of File..."
687 (customize-set-variable 'require-final-newline nil)
688 :style radio :selected (not require-final-newline)]
690 (customize-set-variable 'require-final-newline t)
691 :style radio :selected (eq require-final-newline t)]
693 (customize-set-variable 'require-final-newline 'ask)
694 :style radio :selected (and require-final-newline
695 (not (eq require-final-newline t)))])
696 ["Add Newline When Moving Past %_End"
697 (customize-set-variable 'next-line-add-newlines
698 (not next-line-add-newlines))
699 :style toggle :selected next-line-add-newlines])
700 ("%_Keyboard and Mouse"
701 ["%_Delete Key Deletes Selection"
702 (customize-set-variable 'pending-delete-mode (not pending-delete-mode))
704 :selected (and (boundp 'pending-delete-mode) pending-delete-mode)
705 :active (boundp 'pending-delete-mode)]
706 ("`%_kill-line' Behavior..."
708 (customize-set-variable 'kill-whole-line 'always)
709 :style radio :selected (eq kill-whole-line 'always)]
710 ["Kill to %_End of Line"
711 (customize-set-variable 'kill-whole-line nil)
712 :style radio :selected (eq kill-whole-line nil)]
713 ["Kill Whole Line at %_Beg, Otherwise to End"
714 (customize-set-variable 'kill-whole-line t)
715 :style radio :selected (eq kill-whole-line t)])
716 ["Size for %_Block-Movement Commands..."
717 (customize-set-variable 'block-movement-size
718 (read-number "Block Movement Size: "
719 t block-movement-size))]
723 (customize-set-variable 'viper-mode viper-mode))
724 :style toggle :selected (and (boundp 'viper-mode) viper-mode)
725 :active (fboundp 'toggle-viper-mode)]
727 ["%_Set Key..." global-set-key]
728 ["%_Unset Key..." global-unset-key]
730 ["%_Mouse Paste at Text Cursor (not Clicked Location)"
731 (customize-set-variable 'mouse-yank-at-point (not mouse-yank-at-point))
732 :style toggle :selected mouse-yank-at-point]
734 ["%_Teach Extended Commands"
735 (customize-set-variable 'teach-extended-commands-p
736 (not teach-extended-commands-p))
737 :style toggle :selected teach-extended-commands-p]
740 ["Set Printer %_Name for Generic Print Support..."
741 (customize-set-variable
743 (read-string "Set printer name: " printer-name))]
745 ["Command-Line %_Switches for `lpr'/`lp'..."
746 ;; better to directly open a customization buffer, since the value
747 ;; must be a list of strings, which is somewhat complex to prompt for.
748 (customize-variable 'lpr-switches)
749 (boundp 'lpr-switches)]
750 ("%_Pretty-Print Paper Size"
752 (customize-set-variable 'ps-paper-type 'letter)
754 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'letter))
755 :active (boundp 'ps-paper-type)]
757 (customize-set-variable 'ps-paper-type 'letter-small)
759 :selected (and (boundp 'ps-paper-type)
760 (eq ps-paper-type 'letter-small))
761 :active (boundp 'ps-paper-type)]
763 (customize-set-variable 'ps-paper-type 'legal)
765 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'legal))
766 :active (boundp 'ps-paper-type)]
768 (customize-set-variable 'ps-paper-type 'statement)
770 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'statement))
771 :active (boundp 'ps-paper-type)]
773 (customize-set-variable 'ps-paper-type 'executive)
775 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'executive))
776 :active (boundp 'ps-paper-type)]
778 (customize-set-variable 'ps-paper-type 'tabloid)
780 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'tabloid))
781 :active (boundp 'ps-paper-type)]
783 (customize-set-variable 'ps-paper-type 'ledger)
785 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'ledger))
786 :active (boundp 'ps-paper-type)]
788 (customize-set-variable 'ps-paper-type 'a3)
790 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'a3))
791 :active (boundp 'ps-paper-type)]
793 (customize-set-variable 'ps-paper-type 'a4)
795 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'a4))
796 :active (boundp 'ps-paper-type)]
798 (customize-set-variable 'ps-paper-type 'a4small)
800 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'a4small))
801 :active (boundp 'ps-paper-type)]
803 (customize-set-variable 'ps-paper-type 'b4)
805 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'b4))
806 :active (boundp 'ps-paper-type)]
808 (customize-set-variable 'ps-paper-type 'b5)
810 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'b5))
811 :active (boundp 'ps-paper-type)]
814 (cond (ps-print-color-p
815 (customize-set-variable 'ps-print-color-p nil)
816 ;; I'm wondering whether all this muck is useful.
817 (and (boundp 'original-face-background)
818 original-face-background
819 (set-face-background 'default original-face-background)))
821 (customize-set-variable 'ps-print-color-p t)
822 (setq original-face-background
823 (face-background-instance 'default))
824 (set-face-background 'default "white")))
826 :selected (and (boundp 'ps-print-color-p) ps-print-color-p)
827 :active (boundp 'ps-print-color-p)])
829 ("%_Compose Mail With"
830 ["Default Emacs Mailer"
831 (customize-set-variable 'mail-user-agent 'sendmail-user-agent)
833 :selected (eq mail-user-agent 'sendmail-user-agent)]
835 (customize-set-variable 'mail-user-agent 'mh-e-user-agent)
837 :selected (eq mail-user-agent 'mh-e-user-agent)
838 :active (get 'mh-e-user-agent 'composefunc)]
840 (customize-set-variable 'mail-user-agent 'message-user-agent)
842 :selected (eq mail-user-agent 'message-user-agent)
843 :active (get 'message-user-agent 'composefunc)]
845 ["Set My %_Email Address..."
846 (customize-set-variable
848 (read-string "Set email address: " user-mail-address))]
849 ["Set %_Machine Email Name..."
850 (customize-set-variable
852 (read-string "Set machine email name: " mail-host-address))]
853 ["Set %_SMTP Server..."
856 (customize-set-variable
857 'smtpmail-smtp-server
858 (read-string "Set SMTP server: " smtpmail-smtp-server)))
859 :active (and (boundp 'send-mail-function)
860 (eq send-mail-function 'smtpmail-send-it))]
864 (customize-set-variable 'smtpmail-debug-info
865 (not smtpmail-debug-info)))
867 :selected (and (boundp 'smtpmail-debug-info) smtpmail-debug-info)
868 :active (and (boundp 'send-mail-function)
869 (eq send-mail-function 'smtpmail-send-it))]
873 (customize-set-variable 'browse-url-browser-function 'browse-url-w3)
875 :selected (and (boundp 'browse-url-browser-function)
876 (eq browse-url-browser-function 'browse-url-w3))
877 :active (and (boundp 'browse-url-browser-function)
878 (fboundp 'browse-url-w3)
879 (fboundp 'w3-fetch))]
881 (customize-set-variable 'browse-url-browser-function
882 'browse-url-netscape)
884 :selected (and (boundp 'browse-url-browser-function)
885 (eq browse-url-browser-function 'browse-url-netscape))
886 :active (and (boundp 'browse-url-browser-function)
887 (fboundp 'browse-url-netscape))]
889 (customize-set-variable 'browse-url-browser-function
892 :selected (and (boundp 'browse-url-browser-function)
893 (eq browse-url-browser-function 'browse-url-mosaic))
894 :active (and (boundp 'browse-url-browser-function)
895 (fboundp 'browse-url-mosaic))]
897 (customize-set-variable 'browse-url-browser-function 'browse-url-cci)
899 :selected (and (boundp 'browse-url-browser-function)
900 (eq browse-url-browser-function 'browse-url-cci))
901 :active (and (boundp 'browse-url-browser-function)
902 (fboundp 'browse-url-cci))]
904 (customize-set-variable 'browse-url-browser-function
905 'browse-url-iximosaic)
907 :selected (and (boundp 'browse-url-browser-function)
908 (eq browse-url-browser-function 'browse-url-iximosaic))
909 :active (and (boundp 'browse-url-browser-function)
910 (fboundp 'browse-url-iximosaic))]
912 (customize-set-variable 'browse-url-browser-function
913 'browse-url-lynx-xterm)
915 :selected (and (boundp 'browse-url-browser-function)
916 (eq browse-url-browser-function 'browse-url-lynx-xterm))
917 :active (and (boundp 'browse-url-browser-function)
918 (fboundp 'browse-url-lynx-xterm))]
920 (customize-set-variable 'browse-url-browser-function
921 'browse-url-lynx-emacs)
923 :selected (and (boundp 'browse-url-browser-function)
924 (eq browse-url-browser-function 'browse-url-lynx-emacs))
925 :active (and (boundp 'browse-url-browser-function)
926 (fboundp 'browse-url-lynx-emacs))]
928 (customize-set-variable 'browse-url-browser-function
931 :selected (and (boundp 'browse-url-browser-function)
932 (eq browse-url-browser-function 'browse-url-grail))
933 :active (and (boundp 'browse-url-browser-function)
934 (fboundp 'browse-url-grail))]
936 (customize-set-variable 'browse-url-browser-function
939 :selected (and (boundp 'browse-url-browser-function)
940 (eq browse-url-browser-function 'browse-url-kfm))
941 :active (and (boundp 'browse-url-browser-function)
942 (fboundp 'browse-url-kfm))]
946 (customize-set-variable 'debug-on-error (not debug-on-error))
947 :style toggle :selected debug-on-error]
949 (customize-set-variable 'debug-on-quit (not debug-on-quit))
950 :style toggle :selected debug-on-quit]
952 (customize-set-variable 'debug-on-signal (not debug-on-signal))
953 :style toggle :selected debug-on-signal]
954 ["%_Stack Trace on Error"
955 (customize-set-variable 'stack-trace-on-error
956 (not stack-trace-on-error))
957 :style toggle :selected stack-trace-on-error]
958 ["Stack Trace on Si%_gnal"
959 (customize-set-variable 'stack-trace-on-signal
960 (not stack-trace-on-signal))
961 :style toggle :selected stack-trace-on-signal]
965 ,@(if (featurep 'scrollbar)
967 (customize-set-variable 'scrollbars-visible-p
968 (not scrollbars-visible-p))
970 :selected scrollbars-visible-p]))
972 (customize-set-variable 'modeline-3d-p
975 :selected modeline-3d-p]
977 (progn;; becomes buffer-local
978 (setq truncate-lines (not truncate-lines))
979 (customize-set-variable 'truncate-lines truncate-lines))
981 :selected (not truncate-lines)]
982 ,@(if (featurep 'toolbar)
984 ["%_Toolbars Visible"
985 (customize-set-variable 'toolbar-visible-p
986 (not toolbar-visible-p))
988 :selected toolbar-visible-p]
989 ["Toolbars Ca%_ptioned"
990 (customize-set-variable 'toolbar-captioned-p
991 (not toolbar-captioned-p))
993 :active toolbar-visible-p
994 :selected toolbar-captioned-p]
995 ("Default Toolba%_r Location"
997 (customize-set-variable 'default-toolbar-position 'top)
999 :active toolbar-visible-p
1000 :selected (eq default-toolbar-position 'top)]
1002 (customize-set-variable 'default-toolbar-position 'bottom)
1004 :active toolbar-visible-p
1005 :selected (eq default-toolbar-position 'bottom)]
1007 (customize-set-variable 'default-toolbar-position 'left)
1009 :active toolbar-visible-p
1010 :selected (eq default-toolbar-position 'left)]
1012 (customize-set-variable 'default-toolbar-position 'right)
1014 :active toolbar-visible-p
1015 :selected (eq default-toolbar-position 'right)]
1018 ,@(if (featurep 'gutter)
1020 ["B%_uffers Tab Visible"
1021 (customize-set-variable 'gutter-buffers-tab-visible-p
1022 (not gutter-buffers-tab-visible-p))
1024 :selected gutter-buffers-tab-visible-p]
1025 ("Default %_Gutter Location"
1027 (customize-set-variable 'default-gutter-position 'top)
1029 :selected (eq default-gutter-position 'top)]
1031 (customize-set-variable 'default-gutter-position 'bottom)
1033 :selected (eq default-gutter-position 'bottom)]
1035 (customize-set-variable 'default-gutter-position 'left)
1037 :selected (eq default-gutter-position 'left)]
1039 (customize-set-variable 'default-gutter-position 'right)
1041 :selected (eq default-gutter-position 'right)]
1045 ["%_Blinking Cursor"
1046 (customize-set-variable 'blink-cursor-mode (not blink-cursor-mode))
1048 :selected (and (boundp 'blink-cursor-mode) blink-cursor-mode)
1049 :active (boundp 'blink-cursor-mode)]
1052 (customize-set-variable 'bar-cursor nil)
1053 (force-cursor-redisplay))
1055 :selected (null bar-cursor)]
1056 ["Bar Cursor (%_1 Pixel)"
1058 (customize-set-variable 'bar-cursor t)
1059 (force-cursor-redisplay))
1061 :selected (eq bar-cursor t)]
1062 ["Bar Cursor (%_2 Pixels)"
1064 (customize-set-variable 'bar-cursor 2)
1065 (force-cursor-redisplay))
1067 :selected (and bar-cursor (not (eq bar-cursor t)))]
1069 ("Pa%_ren Highlighting"
1071 (customize-set-variable 'paren-mode nil)
1073 :selected (and (boundp 'paren-mode) (not paren-mode))
1074 :active (boundp 'paren-mode)]
1076 (customize-set-variable 'paren-mode 'blink-paren)
1078 :selected (and (boundp 'paren-mode) (eq paren-mode 'blink-paren))
1079 :active (boundp 'paren-mode)]
1081 (customize-set-variable 'paren-mode 'paren)
1083 :selected (and (boundp 'paren-mode) (eq paren-mode 'paren))
1084 :active (boundp 'paren-mode)]
1086 (customize-set-variable 'paren-mode 'sexp)
1088 :selected (and (boundp 'paren-mode) (eq paren-mode 'sexp))
1089 :active (boundp 'paren-mode)]
1090 ;; ["Nes%_ted Shading"
1091 ;; (customize-set-variable 'paren-mode 'nested)
1093 ;; :selected (and (boundp 'paren-mode) (eq paren-mode 'nested))
1094 ;; :active (boundp 'paren-mode)]
1099 (customize-set-variable 'line-number-mode (not line-number-mode))
1101 :style toggle :selected line-number-mode]
1104 (customize-set-variable 'column-number-mode
1105 (not column-number-mode))
1107 :style toggle :selected column-number-mode]
1109 ("\"Other %_Window\" Location"
1110 ["%_Always in Same Frame"
1111 (customize-set-variable
1112 'get-frame-for-buffer-default-instance-limit nil)
1114 :selected (null get-frame-for-buffer-default-instance-limit)]
1115 ["Other Frame (%_2 Frames Max)"
1116 (customize-set-variable 'get-frame-for-buffer-default-instance-limit
1119 :selected (eq 2 get-frame-for-buffer-default-instance-limit)]
1120 ["Other Frame (%_3 Frames Max)"
1121 (customize-set-variable 'get-frame-for-buffer-default-instance-limit
1124 :selected (eq 3 get-frame-for-buffer-default-instance-limit)]
1125 ["Other Frame (%_4 Frames Max)"
1126 (customize-set-variable 'get-frame-for-buffer-default-instance-limit
1129 :selected (eq 4 get-frame-for-buffer-default-instance-limit)]
1130 ["Other Frame (%_5 Frames Max)"
1131 (customize-set-variable 'get-frame-for-buffer-default-instance-limit
1134 :selected (eq 5 get-frame-for-buffer-default-instance-limit)]
1135 ["Always Create %_New Frame"
1136 (customize-set-variable 'get-frame-for-buffer-default-instance-limit
1139 :selected (eq 0 get-frame-for-buffer-default-instance-limit)]
1141 ["%_Temp Buffers Always in Same Frame"
1142 (customize-set-variable 'temp-buffer-show-function
1143 'show-temp-buffer-in-current-frame)
1145 :selected (eq temp-buffer-show-function
1146 'show-temp-buffer-in-current-frame)]
1147 ["Temp Buffers %_Like Other Buffers"
1148 (customize-set-variable 'temp-buffer-show-function nil)
1150 :selected (null temp-buffer-show-function)]
1152 ["%_Make Current Frame Gnuserv Target"
1153 (customize-set-variable 'gnuserv-frame (if (eq gnuserv-frame t) nil
1156 :selected (and (boundp 'gnuserv-frame) (eq gnuserv-frame t))
1157 :active (boundp 'gnuserv-frame)]
1161 ["%_Frame-Local Font Menu"
1162 (customize-set-variable 'font-menu-this-frame-only-p
1163 (not font-menu-this-frame-only-p))
1165 :selected (and (boundp 'font-menu-this-frame-only-p)
1166 font-menu-this-frame-only-p)]
1167 ["%_Alt/Meta Selects Menu Items"
1168 (if (eq menu-accelerator-enabled 'menu-force)
1169 (customize-set-variable 'menu-accelerator-enabled nil)
1170 (customize-set-variable 'menu-accelerator-enabled 'menu-force))
1172 :selected (eq menu-accelerator-enabled 'menu-force)]
1174 ["Buffers Menu %_Length..."
1175 (customize-set-variable
1176 'buffers-menu-max-size
1177 ;; would it be better to open a customization buffer ?
1180 "Enter number of buffers to display (or 0 for unlimited): ")))
1181 (if (eq val 0) nil val)))]
1182 ["%_Multi-Operation Buffers Sub-Menus"
1183 (customize-set-variable 'complex-buffers-menu-p
1184 (not complex-buffers-menu-p))
1186 :selected complex-buffers-menu-p]
1187 ["S%_ubmenus for Buffer Groups"
1188 (customize-set-variable 'buffers-menu-submenus-for-groups-p
1189 (not buffers-menu-submenus-for-groups-p))
1191 :selected buffers-menu-submenus-for-groups-p]
1192 ["%_Verbose Buffer Menu Entries"
1193 (if (eq buffers-menu-format-buffer-line-function
1194 'slow-format-buffers-menu-line)
1195 (customize-set-variable 'buffers-menu-format-buffer-line-function
1196 'format-buffers-menu-line)
1197 (customize-set-variable 'buffers-menu-format-buffer-line-function
1198 'slow-format-buffers-menu-line))
1200 :selected (eq buffers-menu-format-buffer-line-function
1201 'slow-format-buffers-menu-line)]
1202 ("Buffers Menu %_Sorting"
1203 ["%_Most Recently Used"
1205 (customize-set-variable 'buffers-menu-sort-function nil)
1206 (customize-set-variable 'buffers-menu-grouping-function nil))
1208 :selected (null buffers-menu-sort-function)]
1211 (customize-set-variable 'buffers-menu-sort-function
1212 'sort-buffers-menu-alphabetically)
1213 (customize-set-variable 'buffers-menu-grouping-function nil))
1215 :selected (eq 'sort-buffers-menu-alphabetically
1216 buffers-menu-sort-function)]
1217 ["%_By Major Mode, Then Alphabetically"
1219 (customize-set-variable
1220 'buffers-menu-sort-function
1221 'sort-buffers-menu-by-mode-then-alphabetically)
1222 (customize-set-variable
1223 'buffers-menu-grouping-function
1224 'group-buffers-menu-by-mode-then-alphabetically))
1226 :selected (eq 'sort-buffers-menu-by-mode-then-alphabetically
1227 buffers-menu-sort-function)])
1229 ["%_Ignore Scaled Fonts"
1230 (customize-set-variable 'font-menu-ignore-scaled-fonts
1231 (not font-menu-ignore-scaled-fonts))
1233 :selected (and (boundp 'font-menu-ignore-scaled-fonts)
1234 font-menu-ignore-scaled-fonts)]
1236 ("S%_yntax Highlighting"
1238 (progn;; becomes buffer local
1240 (customize-set-variable 'font-lock-mode font-lock-mode))
1242 :selected (and (boundp 'font-lock-mode) font-lock-mode)
1243 :active (boundp 'font-lock-mode)]
1245 (customize-set-variable 'font-lock-auto-fontify
1246 (not font-lock-auto-fontify))
1248 :selected (and (boundp 'font-lock-auto-fontify) font-lock-auto-fontify)
1249 :active (fboundp 'font-lock-mode)]
1251 ["Force %_Rehighlight in this Buffer"
1252 (customize-set-variable 'font-lock-auto-fontify
1253 (not font-lock-auto-fontify))
1255 :selected (and (boundp 'font-lock-auto-fontify) font-lock-auto-fontify)
1256 :active (fboundp 'font-lock-mode)]
1260 (require 'font-lock)
1261 (font-lock-use-default-fonts)
1262 (customize-set-variable 'font-lock-use-fonts t)
1263 (customize-set-variable 'font-lock-use-colors nil)
1266 :selected (and (boundp 'font-lock-use-fonts) font-lock-use-fonts)
1267 :active (fboundp 'font-lock-mode)]
1270 (require 'font-lock)
1271 (font-lock-use-default-colors)
1272 (customize-set-variable 'font-lock-use-colors t)
1273 (customize-set-variable 'font-lock-use-fonts nil)
1276 :selected (and (boundp 'font-lock-use-colors) font-lock-use-colors)
1277 :active (boundp 'font-lock-mode)]
1281 (require 'font-lock)
1282 (if (or (and (not (integerp font-lock-maximum-decoration))
1283 (not (eq t font-lock-maximum-decoration)))
1284 (and (integerp font-lock-maximum-decoration)
1285 (<= font-lock-maximum-decoration 0)))
1287 (customize-set-variable 'font-lock-maximum-decoration nil)
1288 (font-lock-recompute-variables)))
1290 :active (fboundp 'font-lock-mode)
1291 :selected (and (boundp 'font-lock-maximum-decoration)
1292 (or (and (not (integerp font-lock-maximum-decoration))
1293 (not (eq t font-lock-maximum-decoration)))
1294 (and (integerp font-lock-maximum-decoration)
1295 (<= font-lock-maximum-decoration 0))))]
1298 (require 'font-lock)
1299 (if (and (integerp font-lock-maximum-decoration)
1300 (= 1 font-lock-maximum-decoration))
1302 (customize-set-variable 'font-lock-maximum-decoration 1)
1303 (font-lock-recompute-variables)))
1305 :active (fboundp 'font-lock-mode)
1306 :selected (and (boundp 'font-lock-maximum-decoration)
1307 (integerp font-lock-maximum-decoration)
1308 (= 1 font-lock-maximum-decoration))]
1311 (require 'font-lock)
1312 (if (and (integerp font-lock-maximum-decoration)
1313 (= 2 font-lock-maximum-decoration))
1315 (customize-set-variable 'font-lock-maximum-decoration 2)
1316 (font-lock-recompute-variables)))
1318 :active (fboundp 'font-lock-mode)
1319 :selected (and (boundp 'font-lock-maximum-decoration)
1320 (integerp font-lock-maximum-decoration)
1321 (= 2 font-lock-maximum-decoration))]
1324 (require 'font-lock)
1325 (if (or (eq font-lock-maximum-decoration t)
1326 (and (integerp font-lock-maximum-decoration)
1327 (>= font-lock-maximum-decoration 3)))
1329 (customize-set-variable 'font-lock-maximum-decoration t)
1330 (font-lock-recompute-variables)))
1332 :active (fboundp 'font-lock-mode)
1333 :selected (and (boundp 'font-lock-maximum-decoration)
1334 (or (eq font-lock-maximum-decoration t)
1335 (and (integerp font-lock-maximum-decoration)
1336 (>= font-lock-maximum-decoration 3))))]
1339 (progn;; becomes buffer local
1341 (customize-set-variable 'lazy-lock-mode lazy-lock-mode)
1342 ;; this shouldn't be necessary so there has to
1343 ;; be a redisplay bug lurking somewhere (or
1344 ;; possibly another event handler bug)
1346 :active (and (boundp 'font-lock-mode) (boundp 'lazy-lock-mode)
1349 :selected (and (boundp 'lazy-lock-mode) lazy-lock-mode)]
1351 (progn;; becomes buffer local
1353 (customize-set-variable 'lazy-shot-mode lazy-shot-mode)
1354 ;; this shouldn't be necessary so there has to
1355 ;; be a redisplay bug lurking somewhere (or
1356 ;; possibly another event handler bug)
1358 :active (and (boundp 'font-lock-mode) (boundp 'lazy-shot-mode)
1361 :selected (and (boundp 'lazy-shot-mode) lazy-shot-mode)]
1363 (progn;; becomes buffer local
1365 (customize-set-variable 'fast-lock-mode fast-lock-mode)
1366 ;; this shouldn't be necessary so there has to
1367 ;; be a redisplay bug lurking somewhere (or
1368 ;; possibly another event handler bug)
1370 :active (and (boundp 'font-lock-mode) (boundp 'fast-lock-mode)
1373 :selected (and (boundp 'fast-lock-mode) fast-lock-mode)]
1375 ("%_Font" :filter font-menu-family-constructor)
1376 ("Font Si%_ze" :filter font-menu-size-constructor)
1377 ;; ("Font Weig%_ht" :filter font-menu-weight-constructor)
1378 ["Edit Fa%_ces..." (customize-face nil)]
1381 ;; #### there should be something that holds the name that the init
1382 ;; file should be created as, when it's not present.
1383 (progn (find-file (or user-init-file "~/.xemacs/init.el"))
1384 (or (eq major-mode 'emacs-lisp-mode)
1385 (emacs-lisp-mode)))]
1386 ["%_Save Options to Init File" customize-save-customized]
1390 :filter buffers-menu-filter
1391 ["Go To %_Previous Buffer" switch-to-other-buffer]
1392 ["Go To %_Buffer..." switch-to-buffer]
1394 ["%_List All Buffers" list-buffers]
1395 ["%_Delete Buffer" kill-this-buffer
1396 :suffix (if put-buffer-names-in-file-menu (buffer-name) "")]
1400 nil ; the partition: menus after this are flushright
1403 ["%_About XEmacs..." about-xemacs]
1405 ["XEmacs %_News" view-emacs-news]
1406 ["%_Obtaining XEmacs" describe-distribution]
1408 ("%_Info (Online Docs)"
1409 ["%_Info Contents" info]
1410 ["Lookup %_Key Binding..." Info-goto-emacs-key-command-node]
1411 ["Lookup %_Command..." Info-goto-emacs-command-node]
1412 ["Lookup %_Function..." Info-elisp-ref]
1413 ["Lookup %_Topic..." Info-query])
1415 ["%_FAQ (local)" xemacs-local-faq]
1416 ["FAQ via %_WWW" xemacs-www-faq
1417 :active (fboundp 'browse-url)]
1418 ["%_Home Page" xemacs-www-page
1419 :active (fboundp 'browse-url)])
1421 :filter tutorials-menu-filter)
1424 (find-file (locate-data-file "sample.emacs"))
1425 :active (locate-data-file "sample.emacs")]
1426 ["Sample .%_Xdefaults"
1427 (find-file (locate-data-file "sample.Xdefaults"))
1428 :active (locate-data-file "sample.Xdefaults")]
1429 ["Sample e%_nriched"
1430 (find-file (locate-data-file "enriched.doc"))
1431 :active (locate-data-file "enriched.doc")])
1432 ("%_Commands & Keys"
1433 ["%_Mode" describe-mode]
1434 ["%_Apropos..." hyper-apropos]
1435 ["Apropos %_Docs..." apropos-documentation]
1437 ["%_Key..." describe-key]
1438 ["%_Bindings" describe-bindings]
1439 ["%_Mouse Bindings" describe-pointer]
1440 ["%_Recent Keys" view-lossage]
1442 ["%_Function..." describe-function]
1443 ["%_Variable..." describe-variable]
1444 ["%_Locate Command..." where-is])
1446 ["%_Recent Messages" view-lossage]
1448 ["%_Current Installation Info" describe-installation
1449 :active (boundp 'Installation-string)]
1450 ["%_No Warranty" describe-no-warranty]
1451 ["XEmacs %_License" describe-copying]
1452 ["Find %_Packages" finder-by-keyword]
1453 ["View %_Splash Screen" xemacs-splash-buffer]
1454 ["%_Unix Manual..." manual-entry])
1455 ["Send %_Bug Report..." report-emacs-bug
1456 :active (fboundp 'report-emacs-bug)])))
1459 (defun maybe-add-init-button ()
1461 Adds `Load .emacs' button to menubar when starting up with -q."
1462 (when (and (not load-user-init-file-p)
1463 (file-exists-p (expand-file-name ".emacs" "~")))
1468 (mapc #'(lambda (buf)
1469 (with-current-buffer buf
1470 (delete-menu-item '("Load .emacs"))))
1472 (load-user-init-file))
1476 (add-hook 'before-init-hook 'maybe-add-init-button)
1481 (defvar put-buffer-names-in-file-menu t)
1484 ;;; The Bookmarks menu
1486 (defun bookmark-menu-filter (&rest ignore)
1487 (declare (special bookmark-alist))
1488 (let ((definedp (and (boundp 'bookmark-alist)
1492 '("%_Jump to Bookmark"
1493 :filter (lambda (&rest junk)
1494 (submenu-generate-accelerator-spec
1495 (mapcar #'(lambda (bmk)
1496 `[,bmk (bookmark-jump ',bmk)])
1497 (bookmark-all-names)))))
1498 ["%_Jump to Bookmark" nil nil])
1499 ["Set %_Bookmark" bookmark-set
1500 :active (fboundp 'bookmark-set)]
1502 ["Insert %_Contents" bookmark-menu-insert
1503 :active (fboundp 'bookmark-menu-insert)]
1504 ["Insert L%_ocation" bookmark-menu-locate
1505 :active (fboundp 'bookmark-menu-locate)]
1507 ["%_Rename Bookmark" bookmark-menu-rename
1508 :active (fboundp 'bookmark-menu-rename)]
1510 '("%_Delete Bookmark"
1511 :filter (lambda (&rest junk)
1512 (submenu-generate-accelerator-spec
1513 (mapcar #'(lambda (bmk)
1514 `[,bmk (bookmark-delete ',bmk)])
1515 (bookmark-all-names)))))
1516 ["%_Delete Bookmark" nil nil])
1517 ["%_Edit Bookmark List" bookmark-bmenu-list ,definedp]
1519 ["%_Save Bookmarks" bookmark-save ,definedp]
1520 ["Save Bookmarks %_As..." bookmark-write ,definedp]
1521 ["%_Load a Bookmark File" bookmark-load
1522 :active (fboundp 'bookmark-load)])))
1524 ;;; The Buffers menu
1526 (defgroup buffers-menu nil
1527 "Customization of `Buffers' menu."
1530 (defvar buffers-menu-omit-chars-list '(?b ?p ?l ?d))
1532 (defcustom buffers-menu-max-size 25
1533 "*Maximum number of entries which may appear on the \"Buffers\" menu.
1534 If this is 10, then only the ten most-recently-selected buffers will be
1535 shown. If this is nil, then all buffers will be shown. Setting this to
1536 a large number or nil will slow down menu responsiveness."
1537 :type '(choice (const :tag "Show all" nil)
1539 :group 'buffers-menu)
1541 (defcustom complex-buffers-menu-p nil
1542 "*If non-nil, the buffers menu will contain several commands.
1543 Commands will be presented as submenus of each buffer line. If this
1544 is false, then there will be only one command: select that buffer."
1546 :group 'buffers-menu)
1548 (defcustom buffers-menu-submenus-for-groups-p nil
1549 "*If non-nil, the buffers menu will contain one submenu per group of buffers.
1550 The grouping function is specified in `buffers-menu-grouping-function'.
1551 If this is an integer, do not build submenus if the number of buffers
1552 is not larger than this value."
1553 :type '(choice (const :tag "No Subgroups" nil)
1554 (integer :tag "Max. submenus" 10)
1555 (sexp :format "%t\n" :tag "Allow Subgroups" :value t))
1556 :group 'buffers-menu)
1558 (defcustom buffers-menu-switch-to-buffer-function 'switch-to-buffer
1559 "*The function to call to select a buffer from the buffers menu.
1560 `switch-to-buffer' is a good choice, as is `pop-to-buffer'."
1561 :type '(radio (function-item switch-to-buffer)
1562 (function-item pop-to-buffer)
1563 (function :tag "Other"))
1564 :group 'buffers-menu)
1566 (defcustom buffers-menu-omit-function 'buffers-menu-omit-invisible-buffers
1567 "*If non-nil, a function specifying the buffers to omit from the buffers menu.
1568 This is passed a buffer and should return non-nil if the buffer should be
1569 omitted. The default value `buffers-menu-omit-invisible-buffers' omits
1570 buffers that are normally considered \"invisible\" (those whose name
1571 begins with a space)."
1572 :type '(choice (const :tag "None" nil)
1574 :group 'buffers-menu)
1576 (defcustom buffers-menu-format-buffer-line-function 'format-buffers-menu-line
1577 "*The function to call to return a string to represent a buffer in
1578 the buffers menu. The function is passed a buffer and a number
1579 (starting with 1) indicating which buffer line in the menu is being
1580 processed and should return a string containing an accelerator
1581 spec. (Check out `menu-item-generate-accelerator-spec' as a convenient
1582 way of generating the accelerator specs.) The default value
1583 `format-buffers-menu-line' just returns the name of the buffer and
1584 uses the number as the accelerator. Also check out
1585 `slow-format-buffers-menu-line' which returns a whole bunch of info
1588 Note: Gross Compatibility Hack: Older versions of this function prototype
1589 only expected one argument, not two. We deal gracefully with such
1590 functions by simply calling them with one argument and leaving out the
1591 line number. However, this may go away at any time, so make sure to
1592 update all of your functions of this type."
1594 :group 'buffers-menu)
1596 (defcustom buffers-menu-sort-function
1597 'sort-buffers-menu-by-mode-then-alphabetically
1598 "*If non-nil, a function to sort the list of buffers in the buffers menu.
1599 It will be passed two arguments (two buffers to compare) and should return
1600 t if the first is \"less\" than the second. One possible value is
1601 `sort-buffers-menu-alphabetically'; another is
1602 `sort-buffers-menu-by-mode-then-alphabetically'."
1603 :type '(choice (const :tag "None" nil)
1605 :group 'buffers-menu)
1607 (defcustom buffers-menu-grouping-function
1608 'group-buffers-menu-by-mode-then-alphabetically
1609 "*If non-nil, a function to group buffers in the buffers menu together.
1610 It will be passed two arguments, successive members of the sorted buffers
1611 list after being passed through `buffers-menu-sort-function'. It should
1612 return non-nil if the second buffer begins a new group. The return value
1613 should be the name of the old group, which may be used in hierarchical
1614 buffers menus. The last invocation of the function contains nil as the
1615 second argument, so that the name of the last group can be determined.
1617 The sensible values of this function are dependent on the value specified
1618 for `buffers-menu-sort-function'."
1619 :type '(choice (const :tag "None" nil)
1621 :group 'buffers-menu)
1623 (defun sort-buffers-menu-alphabetically (buf1 buf2)
1624 "For use as a value of `buffers-menu-sort-function'.
1625 Sorts the buffers in alphabetical order by name, but puts buffers beginning
1626 with a star at the end of the list."
1627 (let* ((nam1 (buffer-name buf1))
1628 (nam2 (buffer-name buf2))
1629 (inv1p (not (null (string-match "\\` " nam1))))
1630 (inv2p (not (null (string-match "\\` " nam2))))
1631 (star1p (not (null (string-match "\\`*" nam1))))
1632 (star2p (not (null (string-match "\\`*" nam2)))))
1633 (cond ((not (eq inv1p inv2p))
1635 ((not (eq star1p star2p))
1638 (string-lessp nam1 nam2)))))
1640 (defun sort-buffers-menu-by-mode-then-alphabetically (buf1 buf2)
1641 "For use as a value of `buffers-menu-sort-function'.
1642 Sorts first by major mode and then alphabetically by name, but puts buffers
1643 beginning with a star at the end of the list."
1644 (let* ((nam1 (buffer-name buf1))
1645 (nam2 (buffer-name buf2))
1646 (inv1p (not (null (string-match "\\` " nam1))))
1647 (inv2p (not (null (string-match "\\` " nam2))))
1648 (star1p (not (null (string-match "\\`*" nam1))))
1649 (star2p (not (null (string-match "\\`*" nam2))))
1650 (mode1 (symbol-value-in-buffer 'major-mode buf1))
1651 (mode2 (symbol-value-in-buffer 'major-mode buf2)))
1652 (cond ((not (eq inv1p inv2p))
1654 ((not (eq star1p star2p))
1656 ((and star1p star2p (string-lessp nam1 nam2)))
1657 ((string-lessp mode1 mode2)
1659 ((string-lessp mode2 mode1)
1662 (string-lessp nam1 nam2)))))
1664 ;; this version is too slow on some machines.
1665 ;; (vintage 1990, that is)
1666 (defun slow-format-buffers-menu-line (buffer n)
1667 "For use as a value of `buffers-menu-format-buffer-line-function'.
1668 This returns a string containing a bunch of info about the buffer."
1669 (concat (menu-item-generate-accelerator-spec n buffers-menu-omit-chars-list)
1670 (format "%s%s %-19s %6s %-15s %s"
1671 (if (buffer-modified-p buffer) "*" " ")
1672 (if (symbol-value-in-buffer 'buffer-read-only buffer)
1674 (buffer-name buffer)
1675 (buffer-size buffer)
1676 (symbol-value-in-buffer 'mode-name buffer)
1677 (or (buffer-file-name buffer) ""))))
1679 (defun format-buffers-menu-line (buffer n)
1680 "For use as a value of `buffers-menu-format-buffer-line-function'.
1681 This just returns the buffer's name."
1682 (concat (menu-item-generate-accelerator-spec n buffers-menu-omit-chars-list)
1683 (buffer-name buffer)))
1685 (defun group-buffers-menu-by-mode-then-alphabetically (buf1 buf2)
1686 "For use as a value of `buffers-menu-grouping-function'.
1687 This groups buffers by major mode. It only really makes sense if
1688 `buffers-menu-sorting-function' is
1689 `sort-buffers-menu-by-mode-then-alphabetically'."
1690 (cond ((string-match "\\`*" (buffer-name buf1))
1691 (and (null buf2) "*Misc*"))
1693 (string-match "\\`*" (buffer-name buf2))
1694 (not (eq (symbol-value-in-buffer 'major-mode buf1)
1695 (symbol-value-in-buffer 'major-mode buf2))))
1696 (symbol-value-in-buffer 'mode-name buf1))
1699 (defun buffer-menu-save-buffer (buffer)
1704 (defun buffer-menu-write-file (buffer)
1707 (write-file (read-file-name
1708 (format "Write %s to file: "
1709 (buffer-name (current-buffer)))))))
1711 (defsubst build-buffers-menu-internal (buffers)
1712 (let (name line (n 0))
1719 ; #### a truly Kyle-friendly hack.
1720 (let ((fn buffers-menu-format-buffer-line-function))
1721 (if (= (function-max-args fn) 1)
1723 (funcall fn buffer n))))
1724 (if complex-buffers-menu-p
1727 (vector "S%_witch to Buffer"
1728 (list buffers-menu-switch-to-buffer-function
1729 (setq name (buffer-name buffer)))
1731 (if (eq buffers-menu-switch-to-buffer-function
1733 (vector "Switch to Buffer, Other %_Frame"
1734 (list 'switch-to-buffer-other-frame
1735 (setq name (buffer-name buffer)))
1738 (if (and (buffer-modified-p buffer)
1739 (buffer-file-name buffer))
1740 (vector "%_Save Buffer"
1741 (list 'buffer-menu-save-buffer name) t)
1742 ["%_Save Buffer" nil nil]
1744 (vector "Save %_As..."
1745 (list 'buffer-menu-write-file name) t)
1746 (vector "%_Delete Buffer" (list 'kill-buffer name)
1748 ;; #### We don't want buffer names to be translated,
1749 ;; #### so we put the buffer name in the suffix.
1750 ;; #### Also, avoid losing with non-ASCII buffer names.
1751 ;; #### We still lose, however, if complex-buffers-menu-p. --mrb
1753 (list buffers-menu-switch-to-buffer-function
1754 (buffer-name buffer))
1758 (defun buffers-menu-filter (menu)
1759 "This is the menu filter for the top-level buffers \"Buffers\" menu.
1760 It dynamically creates a list of buffers to use as the contents of the menu.
1761 Only the most-recently-used few buffers will be listed on the menu, for
1762 efficiency reasons. You can control how many buffers will be shown by
1763 setting `buffers-menu-max-size'. You can control the text of the menu
1764 items by redefining the function `format-buffers-menu-line'."
1765 (let ((buffers (delete-if buffers-menu-omit-function (buffer-list))))
1766 (and (integerp buffers-menu-max-size)
1767 (> buffers-menu-max-size 1)
1768 (> (length buffers) buffers-menu-max-size)
1769 ;; shorten list of buffers (not with submenus!)
1770 (not (and buffers-menu-grouping-function
1771 buffers-menu-submenus-for-groups-p))
1772 (setcdr (nthcdr buffers-menu-max-size buffers) nil))
1773 (if buffers-menu-sort-function
1774 (setq buffers (sort buffers buffers-menu-sort-function)))
1775 (if (and buffers-menu-grouping-function
1776 buffers-menu-submenus-for-groups-p
1777 (or (not (integerp buffers-menu-submenus-for-groups-p))
1778 (> (length buffers) buffers-menu-submenus-for-groups-p)))
1779 (let (groups groupnames current-group)
1782 (let ((groupname (funcall buffers-menu-grouping-function
1783 (car sublist) (cadr sublist))))
1784 (setq current-group (cons (car sublist) current-group))
1787 (setq groups (cons (nreverse current-group)
1789 (setq groupnames (cons groupname groupnames))
1790 (setq current-group nil)))))
1794 #'(lambda (groupname group)
1795 (cons groupname (build-buffers-menu-internal group)))
1796 (nreverse groupnames)
1797 (nreverse groups))))
1798 (if buffers-menu-grouping-function
1803 (cond ((funcall buffers-menu-grouping-function
1804 (car sublist) (cadr sublist))
1805 (list (car sublist) t))
1806 (t (list (car sublist)))))
1808 ;; remove a trailing separator.
1809 (and (>= (length buffers) 2)
1810 (let ((lastcdr (nthcdr (- (length buffers) 2) buffers)))
1811 (if (eq t (cadr lastcdr))
1812 (setcdr lastcdr nil))))))
1813 (setq buffers (build-buffers-menu-internal buffers)))
1814 (append menu buffers)
1817 (defun language-environment-menu-filter (menu)
1818 "This is the menu filter for the \"Language Environment\" submenu."
1819 (declare (special language-environment-list))
1821 (mapcar (lambda (env-sym)
1823 `[ ,(concat (menu-item-generate-accelerator-spec n)
1824 (capitalize (symbol-name env-sym)))
1825 (set-language-environment ',env-sym)])
1826 language-environment-list)))
1829 ;;; The Options menu
1831 ;; We'll keep those variables here for a while, in order to provide a
1832 ;; function for porting the old options file that a user may own to Custom.
1834 (defvar options-save-faces nil
1835 "*Non-nil value means save-options will save information about faces.
1836 A nil value means save-options will not save face information.
1837 Set this non-nil only if you use M-x edit-faces to change face
1838 settings. If you use M-x customize-face or the \"Browse Faces...\"
1839 menu entry, you will see a button in the Customize Face buffer that you
1840 can use to permanently save your face changes.
1842 M-x edit-faces is deprecated. Support for it and this variable will
1843 be discontinued in a future release.")
1845 (defvar save-options-init-file nil
1846 "File into which to save forms to load the options file (nil for .emacs).
1847 Normally this is nil, which means save into your .emacs file (the value
1848 of `user-init-file'.")
1850 (defvar save-options-file ".xemacs-options"
1851 "File to save options into.
1852 This file is loaded from your .emacs file.
1853 If this is a relative filename, it is put into the same directory as your
1860 (defun tutorials-menu-filter (menu-items)
1861 (declare (special language-info-alist
1862 current-language-environment
1863 tutorial-supported-languages))
1865 (if (featurep 'mule)
1867 (assoc current-language-environment language-info-alist))
1868 `([,(concat "%_Default (" current-language-environment ")")
1869 help-with-tutorial]))
1870 '(["%_English" help-with-tutorial]))
1871 (submenu-generate-accelerator-spec
1872 (if (featurep 'mule)
1874 (mapcan #'(lambda (lang)
1875 (let ((tut (assq 'tutorial lang)))
1877 (not (string= (car lang) "ASCII"))
1878 ;; skip current language, since we already
1879 ;; included it first
1880 (not (string= (car lang)
1881 current-language-environment))
1883 (help-with-tutorial nil ,(cdr tut))]))))
1884 language-info-alist)
1885 ;; Non mule tutorials.
1886 (mapcar #'(lambda (lang)
1888 (help-with-tutorial ,(format "TUTORIAL.%s"
1890 tutorial-supported-languages)))))
1892 (set-menubar default-menubar)
1897 (defconst default-popup-menu
1899 ["%_Undo" advertised-undo
1900 :active (and (not (eq buffer-undo-list t))
1901 (or buffer-undo-list pending-undo-list))
1902 :suffix (if (or (eq last-command 'undo)
1903 (eq last-command 'advertised-undo))
1905 ["Cu%_t" kill-primary-selection
1906 :active (selection-owner-p)]
1907 ["%_Copy" copy-primary-selection
1908 :active (selection-owner-p)]
1909 ["%_Paste" yank-clipboard-selection
1910 :active (selection-exists-p 'CLIPBOARD)]
1911 ["%_Delete" delete-primary-selection
1912 :active (selection-owner-p)]
1914 ["Select %_Block" mark-paragraph]
1915 ["Sp%_lit Window" split-window-vertically]
1916 ["U%_nsplit Window" delete-other-windows]
1919 ;; In an effort to avoid massive menu clutter, this mostly worthless menu is
1920 ;; superseded by any local popup menu...
1921 (setq-default mode-popup-menu default-popup-menu)
1926 (defun xemacs-splash-buffer ()
1927 "Redisplay XEmacs splash screen in a buffer."
1929 (let ((buffer (get-buffer-create "*Splash*"))
1932 (setq buffer-read-only t)
1933 (erase-buffer buffer)
1934 (setq tmout (display-splash-frame))
1936 (make-local-hook 'kill-buffer-hook)
1937 (add-hook 'kill-buffer-hook
1939 (disable-timeout ,tmout))
1941 (pop-to-buffer buffer)
1942 (delete-other-windows)))
1945 ;;; backwards compatibility
1946 (provide 'x-menubar)
1947 (provide 'menubar-items)
1949 ;;; menubar-items.el ends here.