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 Menubar-items-truncate-history (list count label-length)
58 "Truncate a history LIST to first COUNT items.
59 Return a list of (label value) lists with labels truncated to last
60 LABEL-LENGTH characters of value."
62 (if (<= (length x) label-length)
65 (concat "..." (substring x (- label-length))) x)))
66 (if (<= (length list) count)
68 (butlast list (- (length list) count)))))
70 (defun submenu-generate-accelerator-spec (list &optional omit-chars-list)
71 "Add auto-generated accelerator specifications to a submenu.
72 This can be used to add accelerators to the return value of a menu filter
73 function. It correctly ignores unselectable items. It will destructively
74 modify the list passed to it. If an item already has an auto-generated
75 accelerator spec, this will be removed before the new one is added, making
76 this function idempotent.
78 If OMIT-CHARS-LIST is given, it should be a list of lowercase characters,
79 which will not be used as accelerators."
81 (dolist (item list list)
87 (menu-item-generate-accelerator-spec n omit-chars-list)
88 (menu-item-strip-accelerator-spec (aref item 0)))))
93 (menu-item-generate-accelerator-spec n omit-chars-list)
94 (menu-item-strip-accelerator-spec (car item)))))))))
96 (defun menu-item-strip-accelerator-spec (item)
97 "Strip an auto-generated accelerator spec off of ITEM.
98 ITEM should be a string. This removes specs added by
99 `menu-item-generate-accelerator-spec' and `submenu-generate-accelerator-spec'."
100 (if (string-match "%_. " item)
104 (defun menu-item-generate-accelerator-spec (n &optional omit-chars-list)
105 "Return an accelerator specification for use with auto-generated menus.
106 This should be concat'd onto the beginning of each menu line. The spec
107 allows the Nth line to be selected by the number N. '0' is used for the
108 10th line, and 'a' through 'z' are used for the following 26 lines.
110 If OMIT-CHARS-LIST is given, it should be a list of lowercase characters,
111 which will not be used as accelerators."
112 (cond ((< n 10) (concat "%_" (int-to-string n) " "))
119 (while (memq (int-to-char (+ m (- (char-to-int ?a) 1)))
126 (char-to-string (int-to-char (+ m (- (char-to-int ?a) 1))))
131 (defcustom menu-max-items 25
132 "*Maximum number of items in generated menus.
133 If number of entries in such a menu is larger than this value, split menu
134 into submenus of nearly equal length (see `menu-submenu-max-items'). If
135 nil, never split menu into submenus."
137 :type '(choice (const :tag "no submenus" nil)
140 (defcustom menu-submenu-max-items 20
141 "*Maximum number of items in submenus when splitting menus.
142 We split large menus into submenus of this many items, and then balance
143 them out as much as possible (otherwise the last submenu may have very few
148 (defcustom menu-submenu-name-format "%-12.12s ... %.12s"
149 "*Format specification of the submenu name when splitting menus.
150 Used by `menu-split-long-menu' if the number of entries in a menu is
151 larger than `menu-menu-max-items'.
152 This string should contain one %s for the name of the first entry and
153 one %s for the name of the last entry in the submenu.
154 If the value is a function, it should return the submenu name. The
155 function is be called with two arguments, the names of the first and
156 the last entry in the menu."
158 :type '(choice (string :tag "Format string")
161 (defun menu-split-long-menu (menu)
162 "Split MENU according to `menu-max-items' and add accelerator specs.
164 You should normally use the idiom
166 \(menu-split-long-menu (menu-sort-menu menu))
168 See also `menu-sort-menu'."
169 (let ((len (length menu)))
170 (if (or (null menu-max-items)
171 (<= len menu-max-items))
172 (submenu-generate-accelerator-spec menu)
173 (let* ((outer (/ (+ len (1- menu-submenu-max-items))
174 menu-submenu-max-items))
175 (inner (/ (+ len (1- outer)) outer))
180 (dotimes (foo (min inner len))
181 (setq sub (cons (car menu) sub)
183 (setq len (- len inner))
184 (let ((to (car sub)))
185 (setq sub (nreverse sub))
187 (cons (cons (if (stringp menu-submenu-name-format)
188 (format menu-submenu-name-format
189 (menu-item-strip-accelerator-spec
191 (menu-item-strip-accelerator-spec
193 (funcall menu-submenu-name-format
194 (menu-item-strip-accelerator-spec
196 (menu-item-strip-accelerator-spec
198 (submenu-generate-accelerator-spec sub))
200 (submenu-generate-accelerator-spec (nreverse result))))))
202 (defun menu-sort-menu (menu)
203 "Sort MENU alphabetically.
205 You should normally use the idiom
207 \(menu-split-long-menu (menu-sort-menu menu))
209 See also `menu-split-long-menu'."
211 #'(lambda (a b) (string-lessp (aref a 0) (aref b 0)))))
213 (defun menu-item-search ()
214 "Bring up a search dialog if possible and desired, else do interactive search"
216 (if (should-use-dialog-box-p)
220 (defconst default-menubar
221 ; (purecopy-menubar ;purespace is dead
225 ["%_Open..." find-file]
226 ["Open in Other %_Window..." find-file-other-window]
227 ["Open in New %_Frame..." find-file-other-frame]
228 ["%_Hex Edit File..." hexl-find-file
229 :active (fboundp 'hexl-find-file)]
230 ["%_Insert File..." insert-file]
231 ["%_View File..." view-file]
233 ["%_Save" save-buffer
234 :active (buffer-modified-p)
235 :suffix (if put-buffer-names-in-file-menu (buffer-name) "")]
236 ["Save %_As..." write-file]
237 ["Save So%_me Buffers" save-some-buffers]
239 ,@(if (valid-specifier-tag-p 'msprinter)
240 '(["Page Set%_up..." generic-page-setup]))
241 ["%_Print" generic-print-buffer
242 :active (or (valid-specifier-tag-p 'msprinter)
243 (and (not (eq system-type 'windows-nt))
244 (fboundp 'lpr-region)))
245 :suffix (if (region-active-p) "Selection..."
246 (if put-buffer-names-in-file-menu (concat (buffer-name) "...")
248 ,@(unless (valid-specifier-tag-p 'msprinter)
249 '(["Prett%_y-Print" ps-print-buffer-with-faces
250 :active (fboundp 'ps-print-buffer-with-faces)
251 :suffix (if put-buffer-names-in-file-menu (buffer-name) "")]))
253 ["%_Revert Buffer" revert-buffer
254 :active (or buffer-file-name revert-buffer-function)
255 :suffix (if put-buffer-names-in-file-menu (buffer-name) "")]
256 ["Re%_cover File..." recover-file]
257 ["Recover S%_ession..." recover-session]
259 ["E%_xit XEmacs" save-buffers-kill-emacs]
263 ["%_Undo" advertised-undo
264 :active (and (not (eq buffer-undo-list t))
265 (or buffer-undo-list pending-undo-list))
266 :suffix (if (or (eq last-command 'undo)
267 (eq last-command 'advertised-undo))
270 :included (fboundp 'redo)
271 :active (not (or (eq buffer-undo-list t)
272 (eq last-buffer-undo-list nil)
273 (not (or (eq last-buffer-undo-list buffer-undo-list)
274 (and (null (car-safe buffer-undo-list))
275 (eq last-buffer-undo-list
276 (cdr-safe buffer-undo-list)))))
277 (or (eq buffer-undo-list pending-undo-list)
278 (eq (cdr buffer-undo-list) pending-undo-list))))
279 :suffix (if (eq last-command 'redo) "More" "")]
281 ["Cu%_t" kill-primary-selection
282 :active (selection-owner-p)]
283 ["%_Copy" copy-primary-selection
284 :active (selection-owner-p)]
285 ["%_Paste" yank-clipboard-selection
286 :active (selection-exists-p 'CLIPBOARD)]
287 ["%_Delete" delete-primary-selection
288 :active (selection-owner-p)]
290 ["Select %_All" mark-whole-buffer]
291 ["Select Pa%_ge" mark-page]
293 ["%_Find..." menu-item-search]
294 ["R%_eplace..." query-replace]
295 ["Replace (Rege%_xp)..." query-replace-regexp]
296 ["%_List Matching Lines..." list-matching-lines]
297 ,@(when (featurep 'mule)
299 ("%_Multilingual (\"Mule\")"
300 ("%_Describe Language Support")
301 ("%_Set Language Environment")
303 ["T%_oggle Input Method" toggle-input-method]
304 ["Select %_Input Method" set-input-method]
305 ["D%_escribe Input Method" describe-input-method]
307 ["Describe Current %_Coding Systems"
308 describe-current-coding-system]
309 ["Set Coding System of %_Buffer File..."
310 set-buffer-file-coding-system]
311 ;; not implemented yet
312 ["Set Coding System of %_Terminal..."
313 set-terminal-coding-system :active nil]
314 ;; not implemented yet
315 ["Set Coding System of %_Keyboard..."
316 set-keyboard-coding-system :active nil]
317 ["Set Coding System of %_Process..."
318 set-buffer-process-coding-system
319 :active (get-buffer-process (current-buffer))]
321 ["Show Cha%_racter Table" view-charset-by-menu]
322 ;; not implemented yet
323 ["Show Dia%_gnosis for MULE" mule-diag :active nil]
324 ["Show \"%_hello\" in Many Languages" view-hello-file]))
329 ["%_New Frame" make-frame]
330 ["Frame on Other Displa%_y..." make-frame-on-display
331 :active (fboundp 'make-frame-on-display)]
332 ["%_Delete Frame" delete-frame
333 :active (not (eq (next-frame (selected-frame) 'nomini 'window-system)
336 ["%_Split Window" split-window-vertically]
337 ["S%_plit Window (Side by Side)" split-window-horizontally]
338 ["%_Un-Split (Keep This)" delete-other-windows
339 :active (not (one-window-p t))]
340 ["Un-Split (Keep %_Others)" delete-window
341 :active (not (one-window-p t))]
344 ["%_Narrow to Region" narrow-to-region :active (region-exists-p)]
345 ["Narrow to %_Page" narrow-to-page]
346 ["Narrow to %_Defun" narrow-to-defun]
348 ["%_Widen" widen :active (or (/= (point-min) 1)
349 (/= (point-max) (1+ (buffer-size))))]
352 ["Show Message %_Log" show-message-log]
354 ["%_Goto Line..." goto-line]
355 ["%_What Line" what-line]
357 :filter bookmark-menu-filter)
359 ["%_Jump to Previous Mark" (set-mark-command t)
364 ["Repeat %_Last Complex Command..." repeat-complex-command]
365 ["E%_valuate Lisp Expression..." eval-expression]
366 ["Execute %_Named Command..." execute-extended-command]
368 ["Start %_Macro Recording" start-kbd-macro
369 :included (not defining-kbd-macro)]
370 ["End %_Macro Recording" end-kbd-macro
371 :included defining-kbd-macro]
372 ["E%_xecute Last Macro" call-last-kbd-macro
373 :active last-kbd-macro]
375 ["%_Append to Last Macro" (start-kbd-macro t)
376 :active (and (not defining-kbd-macro) last-kbd-macro)]
377 ["%_Query User During Macro" kbd-macro-query
378 :active defining-kbd-macro]
379 ["Enter %_Recursive Edit During Macro" (kbd-macro-query t)
380 :active defining-kbd-macro]
382 ["E%_xecute Last Macro on Region Lines"
383 :active (and last-kbd-macro (region-exists-p))]
385 ["%_Name Last Macro..." name-last-kbd-macro
386 :active last-kbd-macro]
387 ["Assign Last Macro to %_Key..." assign-last-kbd-macro-to-key
388 :active (and last-kbd-macro
389 (fboundp 'assign-last-kbd-macro-to-key))]
391 ["%_Edit Macro..." edit-kbd-macro]
392 ["Edit %_Last Macro" edit-last-kbd-macro
393 :active last-kbd-macro]
395 ["%_Insert Named Macro into Buffer..." insert-kbd-macro]
396 ["Read Macro from Re%_gion" read-kbd-macro
397 :active (region-exists-p)]
401 ["D%_ynamic Abbrev Expand" dabbrev-expand]
402 ["Dynamic Abbrev %_Complete" dabbrev-completion]
403 ["Dynamic Abbrev Complete in %_All Buffers" (dabbrev-completion 16)]
406 ["%_Define Global Abbrev for " add-global-abbrev
407 :suffix (abbrev-string-to-be-defined nil)
409 ["Define %_Mode-Specific Abbrev for " add-mode-abbrev
410 :suffix (abbrev-string-to-be-defined nil)
412 ["Define Global Ex%_pansion for " inverse-add-global-abbrev
413 :suffix (inverse-abbrev-string-to-be-defined 1)
415 ["Define Mode-Specific Expa%_nsion for " inverse-add-mode-abbrev
416 :suffix (inverse-abbrev-string-to-be-defined 1)
419 ["E%_xpand Abbrev" expand-abbrev]
420 ["Expand Abbrevs in Re%_gion" expand-region-abbrevs
421 :active (region-exists-p)]
422 ["%_Unexpand Last Abbrev" unexpand-abbrev
423 :active (and (stringp last-abbrev-text)
424 (> last-abbrev-location 0))]
426 ["%_Kill All Abbrevs" kill-all-abbrevs]
427 ["%_Insert All Abbrevs into Buffer" insert-abbrevs]
428 ["%_List Abbrevs" list-abbrevs]
430 ["%_Edit Abbrevs" edit-abbrevs]
431 ["%_Redefine Abbrevs from Buffer" edit-abbrevs-redefine
432 :active (eq major-mode 'edit-abbrevs-mode)]
434 ["%_Save Abbrevs As..." write-abbrev-file]
435 ["L%_oad Abbrevs..." read-abbrev-file]
438 ["%_Copy to Register..." copy-to-register :active (region-exists-p)]
439 ["%_Paste Register..." insert-register]
441 ["%_Save Point to Register" point-to-register]
442 ["%_Jump to Register" register-to-point]
445 ["%_Kill Rectangle" kill-rectangle]
446 ["%_Yank Rectangle" yank-rectangle]
447 ["Rectangle %_to Register" copy-rectangle-to-register]
448 ["Rectangle %_from Register" insert-register]
449 ["%_Clear Rectangle" clear-rectangle]
450 ["%_Open Rectangle" open-rectangle]
451 ["%_Prefix Rectangle..." string-rectangle]
452 ["Rectangle %_Mousing"
453 (customize-set-variable 'mouse-track-rectangle-p
454 (not mouse-track-rectangle-p))
455 :style toggle :selected mouse-track-rectangle-p]
458 ["%_Lines in Region" sort-lines :active (region-exists-p)]
459 ["%_Paragraphs in Region" sort-paragraphs :active (region-exists-p)]
460 ["P%_ages in Region" sort-pages :active (region-exists-p)]
461 ["%_Columns in Region" sort-columns :active (region-exists-p)]
462 ["%_Regexp..." sort-regexp-fields :active (region-exists-p)]
465 ["%_Upcase Region" upcase-region :active (region-exists-p)]
466 ["%_Downcase Region" downcase-region :active (region-exists-p)]
467 ["%_Capitalize Region" capitalize-region :active (region-exists-p)]
468 ["%_Title-Case Region" capitalize-region-as-title
469 :active (region-exists-p)]
472 ["%_Line" center-line]
473 ["%_Paragraph" center-paragraph]
474 ["%_Region" center-region :active (region-exists-p)]
477 ["%_As Previous Line" indent-relative]
478 ["%_To Column..." indent-to-column]
480 ["%_Region" indent-region :active (region-exists-p)]
481 ["%_Balanced Expression" indent-sexp]
482 ["%_C Expression" indent-c-exp]
485 ["%_Buffer" ispell-buffer
486 :active (fboundp 'ispell-buffer)]
488 ["%_Word" ispell-word]
489 ["%_Complete Word" ispell-complete-word]
490 ["%_Region" ispell-region]
496 ("%_Set Download Site"
497 ("%_Official Releases"
498 :filter (lambda (&rest junk)
499 (menu-split-long-menu
500 (submenu-generate-accelerator-spec
501 (package-ui-download-menu)))))
503 :filter (lambda (&rest junk)
504 (menu-split-long-menu
505 (submenu-generate-accelerator-spec
506 (package-ui-pre-release-download-menu)))))
508 :filter (lambda (&rest junk)
509 (menu-split-long-menu
510 (submenu-generate-accelerator-spec
511 (package-ui-site-release-download-menu))))))
513 ["%_Update Package Index" package-get-update-base]
514 ["%_List and Install" pui-list-packages]
515 ["U%_pdate Installed Packages" package-get-update-all]
516 ["%_Help" (Info-goto-node "(xemacs)Packages")])
518 ["Read Mail %_1 (VM)..." vm
519 :active (fboundp 'vm)]
520 ["Read Mail %_2 (MH)..." (mh-rmail t)
521 :active (fboundp 'mh-rmail)]
522 ["Send %_Mail..." compose-mail
523 :active (fboundp 'compose-mail)]
524 ["Usenet %_News" gnus
525 :active (fboundp 'gnus)]
526 ["Browse the %_Web" w3
527 :active (fboundp 'w3)])
532 (if (or (not (boundp 'grep-history)) (null grep-history))
535 (submenu-generate-accelerator-spec
536 (mapcar #'(lambda (label-value)
537 (vector (first label-value)
538 (list 'grep (second label-value))))
539 (Menubar-items-truncate-history
540 grep-history 10 50)))))
541 (append menu '("---") items))))
542 ["%_Grep..." grep :active (fboundp 'grep)]
543 ["%_Kill Grep" kill-compilation
544 :active (and (fboundp 'kill-compilation)
545 (fboundp 'compilation-find-buffer)
546 (let ((buffer (condition-case nil
547 (compilation-find-buffer)
549 (and buffer (get-buffer-process buffer))))]
551 ["Grep %_All Files in Current Directory..."
555 (cons (concat grep-command " *")
556 (length grep-command))))
557 (call-interactively 'grep)))
558 :active (fboundp 'grep)]
559 ["Grep %_C and C Header Files in Current Directory..."
563 (cons (concat grep-command " *.[chCH]"
564 ; i wanted to also use *.cc and *.hh.
565 ; see long comment below under Perl.
567 (length grep-command))))
568 (call-interactively 'grep)))
569 :active (fboundp 'grep)]
570 ["Grep C Hea%_der Files in Current Directory..."
574 (cons (concat grep-command " *.[hH]"
575 ; i wanted to also use *.hh.
576 ; see long comment below under Perl.
578 (length grep-command))))
579 (call-interactively 'grep)))
580 :active (fboundp 'grep)]
581 ["Grep %_E-Lisp Files in Current Directory..."
585 (cons (concat grep-command " *.el")
586 (length grep-command))))
587 (call-interactively 'grep)))
588 :active (fboundp 'grep)]
589 ["Grep %_Perl Files in Current Directory..."
593 (cons (concat grep-command " *.pl"
594 ; i wanted to use this:
596 ; but grep complains if it can't
597 ; match anything in a glob, and
598 ; that screws other things up.
599 ; perhaps we need to first scan
600 ; each separate glob in the directory
601 ; to see if there are any files in
602 ; that glob, and if not, omit it.
604 (length grep-command))))
605 (call-interactively 'grep)))
606 :active (fboundp 'grep)]
607 ["Grep %_HTML Files in Current Directory..."
611 (cons (concat grep-command " *.*htm*")
612 (length grep-command))))
613 (call-interactively 'grep)))
614 :active (fboundp 'grep)]
616 ["%_Next Match" next-error
617 :active (and (fboundp 'compilation-errors-exist-p)
618 (compilation-errors-exist-p))]
619 ["Pre%_vious Match" previous-error
620 :active (and (fboundp 'compilation-errors-exist-p)
621 (compilation-errors-exist-p))]
622 ["%_First Match" first-error
623 :active (and (fboundp 'compilation-errors-exist-p)
624 (compilation-errors-exist-p))]
625 ["G%_oto Match" compile-goto-error
626 :active (and (fboundp 'compilation-errors-exist-p)
627 (compilation-errors-exist-p))]
629 ["%_Set Grep Command..."
632 (customize-set-variable
634 (read-shell-command "Default Grep Command: " grep-command)))
635 :active (fboundp 'grep)
641 (if (or (not (boundp 'compile-history)) (null compile-history))
644 (submenu-generate-accelerator-spec
645 (mapcar #'(lambda (label-value)
646 (vector (first label-value)
647 (list 'compile (second label-value))))
648 (Menubar-items-truncate-history
649 compile-history 10 50)))))
650 (append menu '("---") items))))
651 ["%_Compile..." compile :active (fboundp 'compile)]
652 ["%_Repeat Compilation" recompile :active (fboundp 'recompile)]
653 ["%_Kill Compilation" kill-compilation
654 :active (and (fboundp 'kill-compilation)
655 (fboundp 'compilation-find-buffer)
656 (let ((buffer (condition-case nil
657 (compilation-find-buffer)
659 (and buffer (get-buffer-process buffer))))]
661 ["%_Next Error" next-error
662 :active (and (fboundp 'compilation-errors-exist-p)
663 (compilation-errors-exist-p))]
664 ["Pre%_vious Error" previous-error
665 :active (and (fboundp 'compilation-errors-exist-p)
666 (compilation-errors-exist-p))]
667 ["%_First Error" first-error
668 :active (and (fboundp 'compilation-errors-exist-p)
669 (compilation-errors-exist-p))]
670 ["G%_oto Error" compile-goto-error
671 :active (and (fboundp 'compilation-errors-exist-p)
672 (compilation-errors-exist-p))]
676 :active (fboundp 'gdb)]
678 :active (fboundp 'dbx)])
681 :active (fboundp 'shell)]
682 ["S%_hell Command..." shell-command
683 :active (fboundp 'shell-command)]
684 ["Shell Command on %_Region..." shell-command-on-region
685 :active (and (fboundp 'shell-command-on-region) (region-exists-p))])
688 ["%_Find Tag..." find-tag]
689 ["Find %_Other Window..." find-tag-other-window]
690 ["%_Next Tag..." (find-tag nil)]
691 ["N%_ext Other Window..." (find-tag-other-window nil)]
692 ["Next %_File" next-file]
694 ["Tags %_Search..." tags-search]
695 ["Tags %_Replace..." tags-query-replace]
696 ["%_Continue Search/Replace" tags-loop-continue]
698 ["%_Pop stack" pop-tag-mark]
699 ["%_Apropos..." tags-apropos]
701 ["%_Set Tags Table File..." visit-tags-table]
707 ["%_3-Month Calendar" calendar
708 :active (fboundp 'calendar)]
710 :active (fboundp 'diary)]
711 ["%_Holidays" holidays
712 :active (fboundp 'holidays)]
713 ;; we're all pagans at heart ...
714 ["%_Phases of the Moon" phases-of-moon
715 :active (fboundp 'phases-of-moon)]
716 ["%_Sunrise/Sunset" sunrise-sunset
717 :active (fboundp 'sunrise-sunset)])
721 :active (fboundp 'xmine)]
723 :active (fboundp 'tetris)]
725 :active (fboundp 'sokoban)]
726 ["Quote from %_Zippy" yow
727 :active (fboundp 'yow)]
728 ["%_Psychoanalyst" doctor
729 :active (fboundp 'doctor)]
730 ["Ps%_ychoanalyze Zippy!" psychoanalyze-pinhead
731 :active (fboundp 'psychoanalyze-pinhead)]
732 ["%_Random Flames" flame
733 :active (fboundp 'flame)]
734 ["%_Dunnet (Adventure)" dunnet
735 :active (fboundp 'dunnet)]
736 ["Towers of %_Hanoi" hanoi
737 :active (fboundp 'hanoi)]
738 ["Game of %_Life" life
739 :active (fboundp 'life)]
740 ["M%_ultiplication Puzzle" mpuz
741 :active (fboundp 'mpuz)])
747 ("%_Advanced (Customize)"
748 ("%_Emacs" :filter (lambda (&rest junk)
749 (cdr (custom-menu-create 'emacs))))
750 ["%_Group..." customize-group]
751 ["%_Variable..." customize-variable]
752 ["%_Face..." customize-face]
753 ["%_Saved..." customize-saved]
754 ["Se%_t..." customize-customized]
755 ["%_Apropos..." customize-apropos]
756 ["%_Browse..." customize-browse])
759 ["This Buffer %_Read Only" (toggle-read-only)
760 :style toggle :selected buffer-read-only]
761 ["%_Yank/Kill Interact With Clipboard"
762 (if (eq interprogram-cut-function 'own-clipboard)
764 (customize-set-variable 'interprogram-cut-function nil)
765 (customize-set-variable 'interprogram-paste-function nil))
766 (customize-set-variable 'interprogram-cut-function 'own-clipboard)
767 (customize-set-variable 'interprogram-paste-function 'get-clipboard))
769 :selected (eq interprogram-cut-function 'own-clipboard)]
772 (setq overwrite-mode (if overwrite-mode nil 'overwrite-mode-textual))
773 (customize-set-variable 'overwrite-mode overwrite-mode))
774 :style toggle :selected overwrite-mode]
776 (customize-set-variable 'abbrev-mode
777 (not (default-value 'abbrev-mode)))
779 :selected (default-value 'abbrev-mode)]
781 (customize-set-variable 'zmacs-regions (not zmacs-regions))
782 :style toggle :selected zmacs-regions]
784 ["%_Case Sensitive Search"
785 (customize-set-variable 'case-fold-search
786 (setq case-fold-search (not case-fold-search)))
787 :style toggle :selected (not case-fold-search)]
788 ["Case %_Matching Replace"
789 (customize-set-variable 'case-replace (not case-replace))
790 :style toggle :selected case-replace]
792 ("%_Newline at End of File..."
794 (customize-set-variable 'require-final-newline nil)
795 :style radio :selected (not require-final-newline)]
797 (customize-set-variable 'require-final-newline t)
798 :style radio :selected (eq require-final-newline t)]
800 (customize-set-variable 'require-final-newline 'ask)
801 :style radio :selected (and require-final-newline
802 (not (eq require-final-newline t)))])
803 ["Add Newline When Moving Past %_End"
804 (customize-set-variable 'next-line-add-newlines
805 (not next-line-add-newlines))
806 :style toggle :selected next-line-add-newlines])
807 ("%_Keyboard and Mouse"
808 ["%_Delete Key Deletes Selection"
809 (customize-set-variable 'pending-delete-mode (not pending-delete-mode))
811 :selected (and (boundp 'pending-delete-mode) pending-delete-mode)
812 :active (boundp 'pending-delete-mode)]
813 ["`%_kill-line' Kills Whole Line at %_Beg"
814 (customize-set-variable 'kill-whole-line (not kill-whole-line))
816 :selected kill-whole-line]
817 ["Size for %_Block-Movement Commands..."
818 (customize-set-variable 'block-movement-size
819 (read-number "Block Movement Size: "
820 t block-movement-size))]
824 (customize-set-variable 'viper-mode viper-mode))
825 :style toggle :selected (and (boundp 'viper-mode) viper-mode)
826 :active (fboundp 'toggle-viper-mode)]
828 ["S%_hifted Motion Keys Select Region"
829 (customize-set-variable 'shifted-motion-keys-select-region
830 (not shifted-motion-keys-select-region))
832 :selected shifted-motion-keys-select-region]
833 ["%_After Shifted Motion, Unshifted Motion Keys Deselect"
834 (customize-set-variable 'unshifted-motion-keys-deselect-region
835 (not unshifted-motion-keys-deselect-region))
837 :selected unshifted-motion-keys-deselect-region]
839 ["%_Set Key..." global-set-key]
840 ["%_Unset Key..." global-unset-key]
842 ["%_Mouse Paste at Text Cursor (not Clicked Location)"
843 (customize-set-variable 'mouse-yank-at-point (not mouse-yank-at-point))
844 :style toggle :selected mouse-yank-at-point]
846 ["%_Teach Extended Commands"
847 (customize-set-variable 'teach-extended-commands-p
848 (not teach-extended-commands-p))
849 :style toggle :selected teach-extended-commands-p]
852 ["Set Printer %_Name for Generic Print Support..."
853 (customize-set-variable
855 (read-string "Set printer name: " printer-name))]
857 ["Command-Line %_Switches for `lpr'/`lp'..."
858 ;; better to directly open a customization buffer, since the value
859 ;; must be a list of strings, which is somewhat complex to prompt for.
860 (customize-variable 'lpr-switches)
861 (boundp 'lpr-switches)]
862 ("%_Pretty-Print Paper Size"
864 (customize-set-variable 'ps-paper-type 'letter)
866 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'letter))
867 :active (boundp 'ps-paper-type)]
869 (customize-set-variable 'ps-paper-type 'letter-small)
871 :selected (and (boundp 'ps-paper-type)
872 (eq ps-paper-type 'letter-small))
873 :active (boundp 'ps-paper-type)]
875 (customize-set-variable 'ps-paper-type 'legal)
877 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'legal))
878 :active (boundp 'ps-paper-type)]
880 (customize-set-variable 'ps-paper-type 'statement)
882 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'statement))
883 :active (boundp 'ps-paper-type)]
885 (customize-set-variable 'ps-paper-type 'executive)
887 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'executive))
888 :active (boundp 'ps-paper-type)]
890 (customize-set-variable 'ps-paper-type 'tabloid)
892 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'tabloid))
893 :active (boundp 'ps-paper-type)]
895 (customize-set-variable 'ps-paper-type 'ledger)
897 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'ledger))
898 :active (boundp 'ps-paper-type)]
900 (customize-set-variable 'ps-paper-type 'a3)
902 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'a3))
903 :active (boundp 'ps-paper-type)]
905 (customize-set-variable 'ps-paper-type 'a4)
907 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'a4))
908 :active (boundp 'ps-paper-type)]
910 (customize-set-variable 'ps-paper-type 'a4small)
912 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'a4small))
913 :active (boundp 'ps-paper-type)]
915 (customize-set-variable 'ps-paper-type 'b4)
917 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'b4))
918 :active (boundp 'ps-paper-type)]
920 (customize-set-variable 'ps-paper-type 'b5)
922 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'b5))
923 :active (boundp 'ps-paper-type)]
926 (cond (ps-print-color-p
927 (customize-set-variable 'ps-print-color-p nil)
928 ;; I'm wondering whether all this muck is useful.
929 (and (boundp 'original-face-background)
930 original-face-background
931 (set-face-background 'default original-face-background)))
933 (customize-set-variable 'ps-print-color-p t)
934 (setq original-face-background
935 (face-background-instance 'default))
936 (set-face-background 'default "white")))
938 :selected (and (boundp 'ps-print-color-p) ps-print-color-p)
939 :active (boundp 'ps-print-color-p)])
941 ("%_Compose Mail With"
942 ["Default Emacs Mailer"
943 (customize-set-variable 'mail-user-agent 'sendmail-user-agent)
945 :selected (eq mail-user-agent 'sendmail-user-agent)]
947 (customize-set-variable 'mail-user-agent 'mh-e-user-agent)
949 :selected (eq mail-user-agent 'mh-e-user-agent)
950 :active (get 'mh-e-user-agent 'composefunc)]
952 (customize-set-variable 'mail-user-agent 'message-user-agent)
954 :selected (eq mail-user-agent 'message-user-agent)
955 :active (get 'message-user-agent 'composefunc)]
957 ["Set My %_Email Address..."
958 (customize-set-variable
960 (read-string "Set email address: " user-mail-address))]
961 ["Set %_Machine Email Name..."
962 (customize-set-variable
964 (read-string "Set machine email name: " mail-host-address))]
965 ["Set %_SMTP Server..."
968 (customize-set-variable
969 'smtpmail-smtp-server
970 (read-string "Set SMTP server: " smtpmail-smtp-server)))
971 :active (and (boundp 'send-mail-function)
972 (eq send-mail-function 'smtpmail-send-it))]
976 (customize-set-variable 'smtpmail-debug-info
977 (not smtpmail-debug-info)))
979 :selected (and (boundp 'smtpmail-debug-info) smtpmail-debug-info)
980 :active (and (boundp 'send-mail-function)
981 (eq send-mail-function 'smtpmail-send-it))]
985 (customize-set-variable 'browse-url-browser-function 'browse-url-w3)
987 :selected (and (boundp 'browse-url-browser-function)
988 (eq browse-url-browser-function 'browse-url-w3))
989 :active (and (boundp 'browse-url-browser-function)
990 (fboundp 'browse-url-w3)
991 (fboundp 'w3-fetch))]
992 ["Emacs-%_W3 (gnudoit)"
993 (customize-set-variable 'browse-url-browser-function 'browse-url-w3-gnudoit)
995 :selected (and (boundp 'browse-url-browser-function)
996 (eq browse-url-browser-function
997 'browse-url-w3-gnudoit))
998 :active (and (boundp 'browse-url-browser-function)
999 (fboundp 'browse-url-w3-gnudoit))]
1001 (customize-set-variable 'browse-url-browser-function
1002 'browse-url-netscape)
1004 :selected (and (boundp 'browse-url-browser-function)
1005 (eq browse-url-browser-function 'browse-url-netscape))
1006 :active (and (boundp 'browse-url-browser-function)
1007 (fboundp 'browse-url-netscape))]
1009 (customize-set-variable 'browse-url-browser-function
1012 :selected (and (boundp 'browse-url-browser-function)
1013 (eq browse-url-browser-function 'browse-url-mosaic))
1014 :active (and (boundp 'browse-url-browser-function)
1015 (fboundp 'browse-url-mosaic))]
1017 (customize-set-variable 'browse-url-browser-function 'browse-url-cci)
1019 :selected (and (boundp 'browse-url-browser-function)
1020 (eq browse-url-browser-function 'browse-url-cci))
1021 :active (and (boundp 'browse-url-browser-function)
1022 (fboundp 'browse-url-cci))]
1024 (customize-set-variable 'browse-url-browser-function
1025 'browse-url-iximosaic)
1027 :selected (and (boundp 'browse-url-browser-function)
1028 (eq browse-url-browser-function 'browse-url-iximosaic))
1029 :active (and (boundp 'browse-url-browser-function)
1030 (fboundp 'browse-url-iximosaic))]
1032 (customize-set-variable 'browse-url-browser-function
1033 'browse-url-lynx-xterm)
1035 :selected (and (boundp 'browse-url-browser-function)
1036 (eq browse-url-browser-function 'browse-url-lynx-xterm))
1037 :active (and (boundp 'browse-url-browser-function)
1038 (fboundp 'browse-url-lynx-xterm))]
1040 (customize-set-variable 'browse-url-browser-function
1041 'browse-url-lynx-emacs)
1043 :selected (and (boundp 'browse-url-browser-function)
1044 (eq browse-url-browser-function 'browse-url-lynx-emacs))
1045 :active (and (boundp 'browse-url-browser-function)
1046 (fboundp 'browse-url-lynx-emacs))]
1048 (customize-set-variable 'browse-url-browser-function
1051 :selected (and (boundp 'browse-url-browser-function)
1052 (eq browse-url-browser-function 'browse-url-grail))
1053 :active (and (boundp 'browse-url-browser-function)
1054 (fboundp 'browse-url-grail))]
1056 (customize-set-variable 'browse-url-browser-function
1059 :selected (and (boundp 'browse-url-browser-function)
1060 (eq browse-url-browser-function 'browse-url-kde))
1061 :active (and (boundp 'browse-url-browser-function)
1062 (fboundp 'browse-url-kde))]
1064 (customize-set-variable 'browse-url-browser-function
1065 'browse-url-mozilla)
1067 :selected (and (boundp 'browse-url-browser-function)
1068 (eq browse-url-browser-function 'browse-url-mozilla))
1069 :active (and (boundp 'browse-url-browser-function)
1070 (fboundp 'browse-url-mozilla))]
1072 (customize-set-variable 'browse-url-browser-function
1075 :selected (and (boundp 'browse-url-browser-function)
1076 (eq browse-url-browser-function 'browse-url-galeon))
1077 :active (and (boundp 'browse-url-browser-function)
1078 (fboundp 'browse-url-galeon))]
1080 (customize-set-variable 'browse-url-browser-function
1083 :selected (and (boundp 'browse-url-browser-function)
1084 (eq browse-url-browser-function 'browse-url-opera))
1085 :active (and (boundp 'browse-url-browser-function)
1086 (fboundp 'browse-url-opera))]
1088 (customize-set-variable 'browse-url-browser-function
1091 :selected (and (boundp 'browse-url-browser-function)
1092 (eq browse-url-browser-function 'browse-url-mmm))
1093 :active (and (boundp 'browse-url-browser-function)
1094 (fboundp 'browse-url-mmm))]
1095 ["MS-Windows Default %_Browser"
1096 (customize-set-variable 'browse-url-browser-function
1097 'browse-url-default-windows-browser)
1099 :selected (and (boundp 'browse-url-browser-function)
1100 (eq browse-url-browser-function
1101 'browse-url-default-windows-browser))
1102 :active (and (boundp 'browse-url-browser-function)
1103 (fboundp 'mswindows-shell-execute)
1104 (fboundp 'browse-url-default-windows-browser))]
1105 ["G%_eneric Browser"
1106 (customize-set-variable 'browse-url-browser-function
1107 'browse-url-generic)
1109 :selected (and (boundp 'browse-url-browser-function)
1110 (eq browse-url-browser-function 'browse-url-generic))
1111 :active (and (boundp 'browse-url-browser-function)
1112 (boundp 'browse-url-generic-program)
1113 browse-url-generic-program
1114 (fboundp 'browse-url-generic))]
1116 ("%_Troubleshooting"
1118 (customize-set-variable 'debug-on-error (not debug-on-error))
1119 :style toggle :selected debug-on-error]
1121 (customize-set-variable 'debug-on-quit (not debug-on-quit))
1122 :style toggle :selected debug-on-quit]
1123 ["Debug on S%_ignal"
1124 (customize-set-variable 'debug-on-signal (not debug-on-signal))
1125 :style toggle :selected debug-on-signal]
1126 ["%_Stack Trace on Error"
1127 (customize-set-variable 'stack-trace-on-error
1128 (not stack-trace-on-error))
1129 :style toggle :selected stack-trace-on-error]
1130 ["Stack Trace on Si%_gnal"
1131 (customize-set-variable 'stack-trace-on-signal
1132 (not stack-trace-on-signal))
1133 :style toggle :selected stack-trace-on-signal]
1137 ,@(if (featurep 'scrollbar)
1139 (customize-set-variable 'scrollbars-visible-p
1140 (not scrollbars-visible-p))
1142 :selected scrollbars-visible-p]))
1143 ["%_Wrap Long Lines"
1144 (progn;; becomes buffer-local
1145 (setq truncate-lines (not truncate-lines))
1146 (customize-set-variable 'truncate-lines truncate-lines))
1148 :selected (not truncate-lines)]
1151 (customize-set-variable 'modeline-3d-p
1152 (not modeline-3d-p))
1154 :selected modeline-3d-p]
1155 ("Modeline %_Horizontal Scrolling"
1157 (customize-set-variable 'modeline-scrolling-method nil)
1159 :selected (not modeline-scrolling-method)]
1161 (customize-set-variable 'modeline-scrolling-method t)
1163 :selected (eq modeline-scrolling-method t)]
1165 (customize-set-variable 'modeline-scrolling-method 'scrollbar)
1167 :selected (eq modeline-scrolling-method 'scrollbar)]
1169 ,@(if (featurep 'toolbar)
1171 ["%_Toolbars Visible"
1172 (customize-set-variable 'toolbar-visible-p
1173 (not toolbar-visible-p))
1175 :selected toolbar-visible-p]
1176 ["Toolbars Ca%_ptioned"
1177 (customize-set-variable 'toolbar-captioned-p
1178 (not toolbar-captioned-p))
1180 :active toolbar-visible-p
1181 :selected toolbar-captioned-p]
1182 ("Default Toolba%_r Location"
1184 (customize-set-variable 'default-toolbar-position 'top)
1186 :active toolbar-visible-p
1187 :selected (eq default-toolbar-position 'top)]
1189 (customize-set-variable 'default-toolbar-position 'bottom)
1191 :active toolbar-visible-p
1192 :selected (eq default-toolbar-position 'bottom)]
1194 (customize-set-variable 'default-toolbar-position 'left)
1196 :active toolbar-visible-p
1197 :selected (eq default-toolbar-position 'left)]
1199 (customize-set-variable 'default-toolbar-position 'right)
1201 :active toolbar-visible-p
1202 :selected (eq default-toolbar-position 'right)]
1205 ,@(if (featurep 'gutter)
1207 ["B%_uffers Tab Visible"
1208 (customize-set-variable 'gutter-buffers-tab-visible-p
1209 (not gutter-buffers-tab-visible-p))
1211 :selected gutter-buffers-tab-visible-p]
1212 ("Default %_Gutter Location"
1214 (customize-set-variable 'default-gutter-position 'top)
1216 :selected (eq default-gutter-position 'top)]
1218 (customize-set-variable 'default-gutter-position 'bottom)
1220 :selected (eq default-gutter-position 'bottom)]
1222 (customize-set-variable 'default-gutter-position 'left)
1224 :selected (eq default-gutter-position 'left)]
1226 (customize-set-variable 'default-gutter-position 'right)
1228 :selected (eq default-gutter-position 'right)]
1232 ["%_Blinking Cursor"
1233 (customize-set-variable 'blink-cursor-mode (not blink-cursor-mode))
1235 :selected (and (boundp 'blink-cursor-mode) blink-cursor-mode)
1236 :active (boundp 'blink-cursor-mode)]
1239 (customize-set-variable 'bar-cursor nil)
1240 (force-cursor-redisplay))
1242 :selected (null bar-cursor)]
1243 ["Bar Cursor (%_1 Pixel)"
1245 (customize-set-variable 'bar-cursor t)
1246 (force-cursor-redisplay))
1248 :selected (eq bar-cursor t)]
1249 ["Bar Cursor (%_2 Pixels)"
1251 (customize-set-variable 'bar-cursor 2)
1252 (force-cursor-redisplay))
1254 :selected (and bar-cursor (not (eq bar-cursor t)))]
1256 ("Pa%_ren Highlighting"
1258 (customize-set-variable 'paren-mode nil)
1260 :selected (and (boundp 'paren-mode) (not paren-mode))
1261 :active (boundp 'paren-mode)]
1263 (customize-set-variable 'paren-mode 'blink-paren)
1265 :selected (and (boundp 'paren-mode) (eq paren-mode 'blink-paren))
1266 :active (boundp 'paren-mode)]
1268 (customize-set-variable 'paren-mode 'paren)
1270 :selected (and (boundp 'paren-mode) (eq paren-mode 'paren))
1271 :active (boundp 'paren-mode)]
1273 (customize-set-variable 'paren-mode 'sexp)
1275 :selected (and (boundp 'paren-mode) (eq paren-mode 'sexp))
1276 :active (boundp 'paren-mode)]
1277 ;; ["Nes%_ted Shading"
1278 ;; (customize-set-variable 'paren-mode 'nested)
1280 ;; :selected (and (boundp 'paren-mode) (eq paren-mode 'nested))
1281 ;; :active (boundp 'paren-mode)]
1286 (customize-set-variable 'line-number-mode (not line-number-mode))
1288 :style toggle :selected line-number-mode]
1291 (customize-set-variable 'column-number-mode
1292 (not column-number-mode))
1294 :style toggle :selected column-number-mode]
1296 ("\"Other %_Window\" Location"
1297 ["%_Always in Same Frame"
1298 (customize-set-variable
1299 'get-frame-for-buffer-default-instance-limit nil)
1301 :selected (null get-frame-for-buffer-default-instance-limit)]
1302 ["Other Frame (%_2 Frames Max)"
1303 (customize-set-variable 'get-frame-for-buffer-default-instance-limit
1306 :selected (eq 2 get-frame-for-buffer-default-instance-limit)]
1307 ["Other Frame (%_3 Frames Max)"
1308 (customize-set-variable 'get-frame-for-buffer-default-instance-limit
1311 :selected (eq 3 get-frame-for-buffer-default-instance-limit)]
1312 ["Other Frame (%_4 Frames Max)"
1313 (customize-set-variable 'get-frame-for-buffer-default-instance-limit
1316 :selected (eq 4 get-frame-for-buffer-default-instance-limit)]
1317 ["Other Frame (%_5 Frames Max)"
1318 (customize-set-variable 'get-frame-for-buffer-default-instance-limit
1321 :selected (eq 5 get-frame-for-buffer-default-instance-limit)]
1322 ["Always Create %_New Frame"
1323 (customize-set-variable 'get-frame-for-buffer-default-instance-limit
1326 :selected (eq 0 get-frame-for-buffer-default-instance-limit)]
1328 ["%_Temp Buffers Always in Same Frame"
1329 (customize-set-variable 'temp-buffer-show-function
1330 'show-temp-buffer-in-current-frame)
1332 :selected (eq temp-buffer-show-function
1333 'show-temp-buffer-in-current-frame)]
1334 ["Temp Buffers %_Like Other Buffers"
1335 (customize-set-variable 'temp-buffer-show-function nil)
1337 :selected (null temp-buffer-show-function)]
1339 ["%_Make Current Frame Gnuserv Target"
1340 (customize-set-variable 'gnuserv-frame (if (eq gnuserv-frame t) nil
1343 :selected (and (boundp 'gnuserv-frame) (eq gnuserv-frame t))
1344 :active (boundp 'gnuserv-frame)]
1348 ["%_Frame-Local Font Menu"
1349 (customize-set-variable 'font-menu-this-frame-only-p
1350 (not font-menu-this-frame-only-p))
1352 :selected (and (boundp 'font-menu-this-frame-only-p)
1353 font-menu-this-frame-only-p)]
1354 ["%_Alt/Meta Selects Menu Items"
1355 (if (eq menu-accelerator-enabled 'menu-force)
1356 (customize-set-variable 'menu-accelerator-enabled nil)
1357 (customize-set-variable 'menu-accelerator-enabled 'menu-force))
1359 :selected (eq menu-accelerator-enabled 'menu-force)]
1361 ["Buffers Menu %_Length..."
1362 (customize-set-variable
1363 'buffers-menu-max-size
1364 ;; would it be better to open a customization buffer ?
1367 "Enter number of buffers to display (or 0 for unlimited): ")))
1368 (if (eq val 0) nil val)))]
1369 ["%_Multi-Operation Buffers Sub-Menus"
1370 (customize-set-variable 'complex-buffers-menu-p
1371 (not complex-buffers-menu-p))
1373 :selected complex-buffers-menu-p]
1374 ["S%_ubmenus for Buffer Groups"
1375 (customize-set-variable 'buffers-menu-submenus-for-groups-p
1376 (not buffers-menu-submenus-for-groups-p))
1378 :selected buffers-menu-submenus-for-groups-p]
1379 ["%_Verbose Buffer Menu Entries"
1380 (if (eq buffers-menu-format-buffer-line-function
1381 'slow-format-buffers-menu-line)
1382 (customize-set-variable 'buffers-menu-format-buffer-line-function
1383 'format-buffers-menu-line)
1384 (customize-set-variable 'buffers-menu-format-buffer-line-function
1385 'slow-format-buffers-menu-line))
1387 :selected (eq buffers-menu-format-buffer-line-function
1388 'slow-format-buffers-menu-line)]
1389 ("Buffers Menu %_Sorting"
1390 ["%_Most Recently Used"
1392 (customize-set-variable 'buffers-menu-sort-function nil)
1393 (customize-set-variable 'buffers-menu-grouping-function nil))
1395 :selected (null buffers-menu-sort-function)]
1398 (customize-set-variable 'buffers-menu-sort-function
1399 'sort-buffers-menu-alphabetically)
1400 (customize-set-variable 'buffers-menu-grouping-function nil))
1402 :selected (eq 'sort-buffers-menu-alphabetically
1403 buffers-menu-sort-function)]
1404 ["%_By Major Mode, Then Alphabetically"
1406 (customize-set-variable
1407 'buffers-menu-sort-function
1408 'sort-buffers-menu-by-mode-then-alphabetically)
1409 (customize-set-variable
1410 'buffers-menu-grouping-function
1411 'group-buffers-menu-by-mode-then-alphabetically))
1413 :selected (eq 'sort-buffers-menu-by-mode-then-alphabetically
1414 buffers-menu-sort-function)])
1416 ["%_Ignore Scaled Fonts"
1417 (customize-set-variable 'font-menu-ignore-scaled-fonts
1418 (not font-menu-ignore-scaled-fonts))
1420 :selected (and (boundp 'font-menu-ignore-scaled-fonts)
1421 font-menu-ignore-scaled-fonts)]
1423 ("S%_yntax Highlighting"
1425 (progn;; becomes buffer local
1427 (customize-set-variable 'font-lock-mode font-lock-mode))
1429 :selected (and (boundp 'font-lock-mode) font-lock-mode)
1430 :active (boundp 'font-lock-mode)]
1432 (customize-set-variable 'font-lock-auto-fontify
1433 (not font-lock-auto-fontify))
1435 :selected (and (boundp 'font-lock-auto-fontify) font-lock-auto-fontify)
1436 :active (fboundp 'font-lock-mode)]
1438 ["Force %_Rehighlight in this Buffer"
1439 (customize-set-variable 'font-lock-auto-fontify
1440 (not font-lock-auto-fontify))
1442 :selected (and (boundp 'font-lock-auto-fontify) font-lock-auto-fontify)
1443 :active (fboundp 'font-lock-mode)]
1447 (require 'font-lock)
1448 (font-lock-use-default-fonts)
1449 (customize-set-variable 'font-lock-use-fonts t)
1450 (customize-set-variable 'font-lock-use-colors nil)
1453 :selected (and (boundp 'font-lock-use-fonts) font-lock-use-fonts)
1454 :active (fboundp 'font-lock-mode)]
1457 (require 'font-lock)
1458 (font-lock-use-default-colors)
1459 (customize-set-variable 'font-lock-use-colors t)
1460 (customize-set-variable 'font-lock-use-fonts nil)
1463 :selected (and (boundp 'font-lock-use-colors) font-lock-use-colors)
1464 :active (boundp 'font-lock-mode)]
1468 (require 'font-lock)
1469 (if (or (and (not (integerp font-lock-maximum-decoration))
1470 (not (eq t font-lock-maximum-decoration)))
1471 (and (integerp font-lock-maximum-decoration)
1472 (<= font-lock-maximum-decoration 0)))
1474 (customize-set-variable 'font-lock-maximum-decoration nil)
1475 (font-lock-recompute-variables)))
1477 :active (fboundp 'font-lock-mode)
1478 :selected (and (boundp 'font-lock-maximum-decoration)
1479 (or (and (not (integerp font-lock-maximum-decoration))
1480 (not (eq t font-lock-maximum-decoration)))
1481 (and (integerp font-lock-maximum-decoration)
1482 (<= font-lock-maximum-decoration 0))))]
1485 (require 'font-lock)
1486 (if (and (integerp font-lock-maximum-decoration)
1487 (= 1 font-lock-maximum-decoration))
1489 (customize-set-variable 'font-lock-maximum-decoration 1)
1490 (font-lock-recompute-variables)))
1492 :active (fboundp 'font-lock-mode)
1493 :selected (and (boundp 'font-lock-maximum-decoration)
1494 (integerp font-lock-maximum-decoration)
1495 (= 1 font-lock-maximum-decoration))]
1498 (require 'font-lock)
1499 (if (and (integerp font-lock-maximum-decoration)
1500 (= 2 font-lock-maximum-decoration))
1502 (customize-set-variable 'font-lock-maximum-decoration 2)
1503 (font-lock-recompute-variables)))
1505 :active (fboundp 'font-lock-mode)
1506 :selected (and (boundp 'font-lock-maximum-decoration)
1507 (integerp font-lock-maximum-decoration)
1508 (= 2 font-lock-maximum-decoration))]
1511 (require 'font-lock)
1512 (if (or (eq font-lock-maximum-decoration t)
1513 (and (integerp font-lock-maximum-decoration)
1514 (>= font-lock-maximum-decoration 3)))
1516 (customize-set-variable 'font-lock-maximum-decoration t)
1517 (font-lock-recompute-variables)))
1519 :active (fboundp 'font-lock-mode)
1520 :selected (and (boundp 'font-lock-maximum-decoration)
1521 (or (eq font-lock-maximum-decoration t)
1522 (and (integerp font-lock-maximum-decoration)
1523 (>= font-lock-maximum-decoration 3))))]
1526 (progn;; becomes buffer local
1528 (customize-set-variable 'lazy-lock-mode lazy-lock-mode)
1529 ;; this shouldn't be necessary so there has to
1530 ;; be a redisplay bug lurking somewhere (or
1531 ;; possibly another event handler bug)
1533 :active (and (boundp 'font-lock-mode) (boundp 'lazy-lock-mode)
1536 :selected (and (boundp 'lazy-lock-mode) lazy-lock-mode)]
1538 (progn;; becomes buffer local
1540 (customize-set-variable 'lazy-shot-mode lazy-shot-mode)
1541 ;; this shouldn't be necessary so there has to
1542 ;; be a redisplay bug lurking somewhere (or
1543 ;; possibly another event handler bug)
1545 :active (and (boundp 'font-lock-mode) (boundp 'lazy-shot-mode)
1548 :selected (and (boundp 'lazy-shot-mode) lazy-shot-mode)]
1550 (progn;; becomes buffer local
1552 (customize-set-variable 'fast-lock-mode fast-lock-mode)
1553 ;; this shouldn't be necessary so there has to
1554 ;; be a redisplay bug lurking somewhere (or
1555 ;; possibly another event handler bug)
1557 :active (and (boundp 'font-lock-mode) (boundp 'fast-lock-mode)
1560 :selected (and (boundp 'fast-lock-mode) fast-lock-mode)]
1562 ("%_Font" :filter font-menu-family-constructor)
1563 ("Font Si%_ze" :filter font-menu-size-constructor)
1564 ;; ("Font Weig%_ht" :filter font-menu-weight-constructor)
1565 ["Edit Fa%_ces..." (customize-face nil)]
1568 ;; #### there should be something that holds the name that the init
1569 ;; file should be created as, when it's not present.
1570 (progn (find-file (or user-init-file "~/.xemacs/init.el"))
1571 (or (eq major-mode 'emacs-lisp-mode)
1572 (emacs-lisp-mode)))]
1573 ["%_Save Options to Custom File" customize-save-customized]
1577 :filter buffers-menu-filter
1578 ["Go To %_Previous Buffer" switch-to-other-buffer]
1579 ["Go To %_Buffer..." switch-to-buffer]
1581 ["%_List All Buffers" list-buffers]
1582 ["%_Delete Buffer" kill-this-buffer
1583 :suffix (if put-buffer-names-in-file-menu (buffer-name) "")]
1587 nil ; the partition: menus after this are flushright
1590 ["%_About XEmacs..." about-xemacs]
1592 ["What's %_New in XEmacs" view-emacs-news]
1593 ["%_Obtaining XEmacs" describe-distribution]
1595 ("%_Info (Online Docs)"
1596 ["%_Info Contents" info]
1597 ["Lookup %_Key Binding..." Info-goto-emacs-key-command-node]
1598 ["Lookup %_Command..." Info-goto-emacs-command-node]
1599 ["Lookup %_Function..." Info-elisp-ref]
1600 ["Lookup %_Topic..." Info-query])
1602 ["%_FAQ (local)" xemacs-local-faq]
1603 ["FAQ via %_WWW" xemacs-www-faq
1604 :active (fboundp 'browse-url)]
1605 ["%_Home Page" xemacs-www-page
1606 :active (fboundp 'browse-url)])
1608 :filter tutorials-menu-filter)
1611 (find-file (locate-data-file "sample.init.el"))
1612 :active (locate-data-file "sample.init.el")]
1614 (find-file (locate-data-file "sample.gtkrc"))
1615 :included (featurep 'gtk)
1616 :active (locate-data-file "sample.gtkrc")]
1617 ["Sample .%_Xdefaults"
1618 (find-file (locate-data-file "sample.Xdefaults"))
1619 :included (featurep 'x)
1620 :active (locate-data-file "sample.Xdefaults")]
1621 ["Sample %_enriched"
1622 (find-file (locate-data-file "enriched.doc"))
1623 :active (locate-data-file "enriched.doc")])
1624 ("%_Commands & Keys"
1625 ["%_Mode" describe-mode]
1626 ["%_Apropos..." hyper-apropos]
1627 ["Apropos %_Docs..." apropos-documentation]
1629 ["%_Key..." describe-key]
1630 ["%_Bindings" describe-bindings]
1631 ["%_Mouse Bindings" describe-pointer]
1632 ["%_Recent Keys" view-lossage]
1634 ["%_Function..." describe-function]
1635 ["%_Variable..." describe-variable]
1636 ["%_Locate Command..." where-is])
1638 ["%_Recent Messages" view-lossage]
1640 ["%_Current Installation Info" describe-installation
1641 :active (boundp 'Installation-string)]
1642 ["%_No Warranty" describe-no-warranty]
1643 ["XEmacs %_License" describe-copying]
1644 ["Find %_Packages" finder-by-keyword]
1645 ["View %_Splash Screen" xemacs-splash-buffer]
1646 ["%_Unix Manual..." manual-entry])
1647 ["Send %_Bug Report..." report-xemacs-bug
1648 :active (fboundp 'report-xemacs-bug)])))
1651 (defun maybe-add-init-button ()
1653 Adds `Load .emacs' button to menubar when starting up with -q."
1654 (when (and (not load-user-init-file-p)
1655 (file-exists-p (expand-file-name ".emacs" "~")))
1660 (mapc #'(lambda (buf)
1661 (with-current-buffer buf
1662 (delete-menu-item '("Load .emacs"))))
1664 (load-user-init-file))
1668 (add-hook 'before-init-hook 'maybe-add-init-button)
1673 (defvar put-buffer-names-in-file-menu t)
1676 ;;; The Bookmarks menu
1678 (defun bookmark-menu-filter (&rest ignore)
1679 (declare (special bookmark-alist))
1680 (let ((definedp (and (boundp 'bookmark-alist)
1684 '("%_Jump to Bookmark"
1685 :filter (lambda (&rest junk)
1686 (submenu-generate-accelerator-spec
1687 (mapcar #'(lambda (bmk)
1688 `[,bmk (bookmark-jump ',bmk)])
1689 (bookmark-all-names)))))
1690 ["%_Jump to Bookmark" nil nil])
1691 ["Set %_Bookmark" bookmark-set
1692 :active (fboundp 'bookmark-set)]
1694 ["Insert %_Contents" bookmark-menu-insert
1695 :active (fboundp 'bookmark-menu-insert)]
1696 ["Insert L%_ocation" bookmark-menu-locate
1697 :active (fboundp 'bookmark-menu-locate)]
1699 ["%_Rename Bookmark" bookmark-menu-rename
1700 :active (fboundp 'bookmark-menu-rename)]
1702 '("%_Delete Bookmark"
1703 :filter (lambda (&rest junk)
1704 (submenu-generate-accelerator-spec
1705 (mapcar #'(lambda (bmk)
1706 `[,bmk (bookmark-delete ',bmk)])
1707 (bookmark-all-names)))))
1708 ["%_Delete Bookmark" nil nil])
1709 ["%_Edit Bookmark List" bookmark-bmenu-list ,definedp]
1711 ["%_Save Bookmarks" bookmark-save ,definedp]
1712 ["Save Bookmarks %_As..." bookmark-write ,definedp]
1713 ["%_Load a Bookmark File" bookmark-load
1714 :active (fboundp 'bookmark-load)])))
1716 ;;; The Buffers menu
1718 (defgroup buffers-menu nil
1719 "Customization of `Buffers' menu."
1722 (defvar buffers-menu-omit-chars-list '(?b ?p ?l ?d))
1724 (defcustom buffers-menu-max-size 25
1725 "*Maximum number of entries which may appear on the \"Buffers\" menu.
1726 If this is 10, then only the ten most-recently-selected buffers will be
1727 shown. If this is nil, then all buffers will be shown. Setting this to
1728 a large number or nil will slow down menu responsiveness."
1729 :type '(choice (const :tag "Show all" nil)
1731 :group 'buffers-menu)
1733 (defcustom complex-buffers-menu-p nil
1734 "*If non-nil, the buffers menu will contain several commands.
1735 Commands will be presented as submenus of each buffer line. If this
1736 is false, then there will be only one command: select that buffer."
1738 :group 'buffers-menu)
1740 (defcustom buffers-menu-submenus-for-groups-p nil
1741 "*If non-nil, the buffers menu will contain one submenu per group of buffers.
1742 The grouping function is specified in `buffers-menu-grouping-function'.
1743 If this is an integer, do not build submenus if the number of buffers
1744 is not larger than this value."
1745 :type '(choice (const :tag "No Subgroups" nil)
1746 (integer :tag "Max. submenus" 10)
1747 (sexp :format "%t\n" :tag "Allow Subgroups" :value t))
1748 :group 'buffers-menu)
1750 (defcustom buffers-menu-switch-to-buffer-function 'switch-to-buffer
1751 "*The function to call to select a buffer from the buffers menu.
1752 `switch-to-buffer' is a good choice, as is `pop-to-buffer'."
1753 :type '(radio (function-item switch-to-buffer)
1754 (function-item pop-to-buffer)
1755 (function :tag "Other"))
1756 :group 'buffers-menu)
1758 (defcustom buffers-menu-omit-function 'buffers-menu-omit-invisible-buffers
1759 "*If non-nil, a function specifying the buffers to omit from the buffers menu.
1760 This is passed a buffer and should return non-nil if the buffer should be
1761 omitted. The default value `buffers-menu-omit-invisible-buffers' omits
1762 buffers that are normally considered \"invisible\" (those whose name
1763 begins with a space)."
1764 :type '(choice (const :tag "None" nil)
1766 :group 'buffers-menu)
1768 (defcustom buffers-menu-format-buffer-line-function 'format-buffers-menu-line
1769 "*The function to call to return a string to represent a buffer in
1770 the buffers menu. The function is passed a buffer and a number
1771 (starting with 1) indicating which buffer line in the menu is being
1772 processed and should return a string containing an accelerator
1773 spec. (Check out `menu-item-generate-accelerator-spec' as a convenient
1774 way of generating the accelerator specs.) The default value
1775 `format-buffers-menu-line' just returns the name of the buffer and
1776 uses the number as the accelerator. Also check out
1777 `slow-format-buffers-menu-line' which returns a whole bunch of info
1780 Note: Gross Compatibility Hack: Older versions of this function prototype
1781 only expected one argument, not two. We deal gracefully with such
1782 functions by simply calling them with one argument and leaving out the
1783 line number. However, this may go away at any time, so make sure to
1784 update all of your functions of this type."
1786 :group 'buffers-menu)
1788 (defcustom buffers-menu-sort-function
1789 'sort-buffers-menu-by-mode-then-alphabetically
1790 "*If non-nil, a function to sort the list of buffers in the buffers menu.
1791 It will be passed two arguments (two buffers to compare) and should return
1792 t if the first is \"less\" than the second. One possible value is
1793 `sort-buffers-menu-alphabetically'; another is
1794 `sort-buffers-menu-by-mode-then-alphabetically'."
1795 :type '(choice (const :tag "None" nil)
1797 :group 'buffers-menu)
1799 (defcustom buffers-menu-grouping-function
1800 'group-buffers-menu-by-mode-then-alphabetically
1801 "*If non-nil, a function to group buffers in the buffers menu together.
1802 It will be passed two arguments, successive members of the sorted buffers
1803 list after being passed through `buffers-menu-sort-function'. It should
1804 return non-nil if the second buffer begins a new group. The return value
1805 should be the name of the old group, which may be used in hierarchical
1806 buffers menus. The last invocation of the function contains nil as the
1807 second argument, so that the name of the last group can be determined.
1809 The sensible values of this function are dependent on the value specified
1810 for `buffers-menu-sort-function'."
1811 :type '(choice (const :tag "None" nil)
1813 :group 'buffers-menu)
1815 (defun sort-buffers-menu-alphabetically (buf1 buf2)
1816 "For use as a value of `buffers-menu-sort-function'.
1817 Sorts the buffers in alphabetical order by name, but puts buffers beginning
1818 with a star at the end of the list."
1819 (let* ((nam1 (buffer-name buf1))
1820 (nam2 (buffer-name buf2))
1821 (inv1p (not (null (string-match "\\` " nam1))))
1822 (inv2p (not (null (string-match "\\` " nam2))))
1823 (star1p (not (null (string-match "\\`*" nam1))))
1824 (star2p (not (null (string-match "\\`*" nam2)))))
1825 (cond ((not (eq inv1p inv2p))
1827 ((not (eq star1p star2p))
1830 (string-lessp nam1 nam2)))))
1832 (defun sort-buffers-menu-by-mode-then-alphabetically (buf1 buf2)
1833 "For use as a value of `buffers-menu-sort-function'.
1834 Sorts first by major mode and then alphabetically by name, but puts buffers
1835 beginning with a star at the end of the list."
1836 (let* ((nam1 (buffer-name buf1))
1837 (nam2 (buffer-name buf2))
1838 (inv1p (not (null (string-match "\\` " nam1))))
1839 (inv2p (not (null (string-match "\\` " nam2))))
1840 (star1p (not (null (string-match "\\`*" nam1))))
1841 (star2p (not (null (string-match "\\`*" nam2))))
1842 (mode1 (symbol-value-in-buffer 'major-mode buf1))
1843 (mode2 (symbol-value-in-buffer 'major-mode buf2)))
1844 (cond ((not (eq inv1p inv2p))
1846 ((not (eq star1p star2p))
1848 ((and star1p star2p (string-lessp nam1 nam2)))
1849 ((string-lessp mode1 mode2)
1851 ((string-lessp mode2 mode1)
1854 (string-lessp nam1 nam2)))))
1856 ;; this version is too slow on some machines.
1857 ;; (vintage 1990, that is)
1858 (defun slow-format-buffers-menu-line (buffer n)
1859 "For use as a value of `buffers-menu-format-buffer-line-function'.
1860 This returns a string containing a bunch of info about the buffer."
1861 (concat (menu-item-generate-accelerator-spec n buffers-menu-omit-chars-list)
1862 (format "%s%s %-19s %6s %-15s %s"
1863 (if (buffer-modified-p buffer) "*" " ")
1864 (if (symbol-value-in-buffer 'buffer-read-only buffer)
1866 (buffer-name buffer)
1867 (buffer-size buffer)
1868 (symbol-value-in-buffer 'mode-name buffer)
1869 (or (buffer-file-name buffer) ""))))
1871 (defun format-buffers-menu-line (buffer n)
1872 "For use as a value of `buffers-menu-format-buffer-line-function'.
1873 This just returns the buffer's name."
1874 (concat (menu-item-generate-accelerator-spec n buffers-menu-omit-chars-list)
1875 (buffer-name buffer)))
1877 (defun group-buffers-menu-by-mode-then-alphabetically (buf1 buf2)
1878 "For use as a value of `buffers-menu-grouping-function'.
1879 This groups buffers by major mode. It only really makes sense if
1880 `buffers-menu-sorting-function' is
1881 `sort-buffers-menu-by-mode-then-alphabetically'."
1882 (cond ((string-match "\\`*" (buffer-name buf1))
1883 (and (null buf2) "*Misc*"))
1885 (string-match "\\`*" (buffer-name buf2))
1886 (not (eq (symbol-value-in-buffer 'major-mode buf1)
1887 (symbol-value-in-buffer 'major-mode buf2))))
1888 (symbol-value-in-buffer 'mode-name buf1))
1891 (defun buffer-menu-save-buffer (buffer)
1896 (defun buffer-menu-write-file (buffer)
1899 (write-file (read-file-name
1900 (format "Write %s to file: "
1901 (buffer-name (current-buffer)))))))
1903 (defsubst build-buffers-menu-internal (buffers)
1904 (let (name line (n 0))
1911 ; #### a truly Kyle-friendly hack.
1912 (let ((fn buffers-menu-format-buffer-line-function))
1913 (if (= (function-max-args fn) 1)
1915 (funcall fn buffer n))))
1916 (if complex-buffers-menu-p
1919 (vector "S%_witch to Buffer"
1920 (list buffers-menu-switch-to-buffer-function
1921 (setq name (buffer-name buffer)))
1923 (if (eq buffers-menu-switch-to-buffer-function
1925 (vector "Switch to Buffer, Other %_Frame"
1926 (list 'switch-to-buffer-other-frame
1927 (setq name (buffer-name buffer)))
1930 (if (and (buffer-modified-p buffer)
1931 (buffer-file-name buffer))
1932 (vector "%_Save Buffer"
1933 (list 'buffer-menu-save-buffer name) t)
1934 ["%_Save Buffer" nil nil]
1936 (vector "Save %_As..."
1937 (list 'buffer-menu-write-file name) t)
1938 (vector "%_Delete Buffer" (list 'kill-buffer name)
1940 ;; #### We don't want buffer names to be translated,
1941 ;; #### so we put the buffer name in the suffix.
1942 ;; #### Also, avoid losing with non-ASCII buffer names.
1943 ;; #### We still lose, however, if complex-buffers-menu-p. --mrb
1945 (list buffers-menu-switch-to-buffer-function
1946 (buffer-name buffer))
1950 (defun buffers-menu-filter (menu)
1951 "This is the menu filter for the top-level buffers \"Buffers\" menu.
1952 It dynamically creates a list of buffers to use as the contents of the menu.
1953 Only the most-recently-used few buffers will be listed on the menu, for
1954 efficiency reasons. You can control how many buffers will be shown by
1955 setting `buffers-menu-max-size'. You can control the text of the menu
1956 items by redefining the function `format-buffers-menu-line'."
1957 (let ((buffers (delete-if buffers-menu-omit-function (buffer-list))))
1958 (and (integerp buffers-menu-max-size)
1959 (> buffers-menu-max-size 1)
1960 (> (length buffers) buffers-menu-max-size)
1961 ;; shorten list of buffers (not with submenus!)
1962 (not (and buffers-menu-grouping-function
1963 buffers-menu-submenus-for-groups-p))
1964 (setcdr (nthcdr buffers-menu-max-size buffers) nil))
1965 (if buffers-menu-sort-function
1966 (setq buffers (sort buffers buffers-menu-sort-function)))
1967 (if (and buffers-menu-grouping-function
1968 buffers-menu-submenus-for-groups-p
1969 (or (not (integerp buffers-menu-submenus-for-groups-p))
1970 (> (length buffers) buffers-menu-submenus-for-groups-p)))
1971 (let (groups groupnames current-group)
1974 (let ((groupname (funcall buffers-menu-grouping-function
1975 (car sublist) (cadr sublist))))
1976 (setq current-group (cons (car sublist) current-group))
1979 (setq groups (cons (nreverse current-group)
1981 (setq groupnames (cons groupname groupnames))
1982 (setq current-group nil)))))
1986 #'(lambda (groupname group)
1987 (cons groupname (build-buffers-menu-internal group)))
1988 (nreverse groupnames)
1989 (nreverse groups))))
1990 (if buffers-menu-grouping-function
1995 (cond ((funcall buffers-menu-grouping-function
1996 (car sublist) (cadr sublist))
1997 (list (car sublist) t))
1998 (t (list (car sublist)))))
2000 ;; remove a trailing separator.
2001 (and (>= (length buffers) 2)
2002 (let ((lastcdr (nthcdr (- (length buffers) 2) buffers)))
2003 (if (eq t (cadr lastcdr))
2004 (setcdr lastcdr nil))))))
2005 (setq buffers (build-buffers-menu-internal buffers)))
2006 (append menu buffers)
2009 (defun language-environment-menu-filter (menu)
2010 "This is the menu filter for the \"Language Environment\" submenu."
2011 (declare (special language-environment-list))
2013 (mapcar (lambda (env-sym)
2015 `[ ,(concat (menu-item-generate-accelerator-spec n)
2016 (capitalize (symbol-name env-sym)))
2017 (set-language-environment ',env-sym)])
2018 language-environment-list)))
2021 ;;; The Options menu
2023 ;; We'll keep those variables here for a while, in order to provide a
2024 ;; function for porting the old options file that a user may own to Custom.
2026 (defvar options-save-faces nil
2027 "*Non-nil value means save-options will save information about faces.
2028 A nil value means save-options will not save face information.
2029 Set this non-nil only if you use M-x edit-faces to change face
2030 settings. If you use M-x customize-face or the \"Browse Faces...\"
2031 menu entry, you will see a button in the Customize Face buffer that you
2032 can use to permanently save your face changes.
2034 M-x edit-faces is deprecated. Support for it and this variable will
2035 be discontinued in a future release.")
2037 (defvar save-options-init-file nil
2038 "File into which to save forms to load the options file (nil for .emacs).
2039 Normally this is nil, which means save into your .emacs file (the value
2040 of `user-init-file'.")
2042 (defvar save-options-file ".xemacs-options"
2043 "File to save options into.
2044 This file is loaded from your .emacs file.
2045 If this is a relative filename, it is put into the same directory as your
2052 (defun tutorials-menu-filter (menu-items)
2053 (declare (special language-info-alist
2054 current-language-environment
2055 tutorial-supported-languages))
2057 (if (featurep 'mule)
2059 (assoc current-language-environment language-info-alist))
2060 `([,(concat "%_Default (" current-language-environment ")")
2061 help-with-tutorial]))
2062 '(["%_English" help-with-tutorial]))
2063 (submenu-generate-accelerator-spec
2064 (if (featurep 'mule)
2066 (mapcan #'(lambda (lang)
2067 (let ((tut (assq 'tutorial lang)))
2069 (not (string= (car lang) "ASCII"))
2070 ;; skip current language, since we already
2071 ;; included it first
2072 (not (string= (car lang)
2073 current-language-environment))
2075 (help-with-tutorial nil ,(cdr tut))]))))
2076 language-info-alist)
2077 ;; Non mule tutorials.
2078 (mapcar #'(lambda (lang)
2080 (help-with-tutorial ,(format "TUTORIAL.%s"
2082 tutorial-supported-languages)))))
2084 (set-menubar default-menubar)
2089 (defconst default-popup-menu
2091 ["%_Undo" advertised-undo
2092 :active (and (not (eq buffer-undo-list t))
2093 (or buffer-undo-list pending-undo-list))
2094 :suffix (if (or (eq last-command 'undo)
2095 (eq last-command 'advertised-undo))
2097 ["Cu%_t" kill-primary-selection
2098 :active (selection-owner-p)]
2099 ["%_Copy" copy-primary-selection
2100 :active (selection-owner-p)]
2101 ["%_Paste" yank-clipboard-selection
2102 :active (selection-exists-p 'CLIPBOARD)]
2103 ["%_Delete" delete-primary-selection
2104 :active (selection-owner-p)]
2106 ["Select %_Block" mark-paragraph]
2107 ["Sp%_lit Window" split-window-vertically]
2108 ["U%_nsplit Window" delete-other-windows]
2111 ;; In an effort to avoid massive menu clutter, this mostly worthless menu is
2112 ;; superseded by any local popup menu...
2113 (setq-default mode-popup-menu default-popup-menu)
2118 (defun xemacs-splash-buffer ()
2119 "Redisplay XEmacs splash screen in a buffer."
2121 (let ((buffer (get-buffer-create "*Splash*"))
2124 (setq buffer-read-only t)
2125 (erase-buffer buffer)
2126 (setq tmout (display-splash-frame))
2128 (make-local-hook 'kill-buffer-hook)
2129 (add-hook 'kill-buffer-hook
2131 (disable-timeout ,tmout))
2133 (pop-to-buffer buffer)
2134 (delete-other-windows)))
2137 ;;; backwards compatibility
2138 (provide 'x-menubar)
2139 (provide 'menubar-items)
2141 ;;; menubar-items.el ends here.