1 ;;; menubar-items.el --- Menubar and popup-menu content for SXEmacs.
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: SXEmacs Development Team
10 ;; Keywords: frames, extensions, internal, dumped
12 ;; This file is part of SXEmacs.
14 ;; SXEmacs is free software: you can redistribute it and/or modify
15 ;; it under the terms of the GNU General Public License as published by
16 ;; the Free Software Foundation, either version 3 of the License, or
17 ;; (at your option) any later version.
19 ;; SXEmacs is distributed in the hope that it will be useful,
20 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
21 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 ;; GNU General Public License for more details.
24 ;; You should have received a copy of the GNU General Public License
25 ;; along with this program. If not, see <http://www.gnu.org/licenses/>.
29 ;; Created c. 1991 for Lucid Emacs. Originally called x-menubar.el.
30 ;; Contained four menus -- File, Edit, Buffers, Help.
31 ;; Dynamic menu changes possible only through activate-menubar-hook.
32 ;; Also contained menu manipulation funs, e.g. find-menu-item, add-menu.
33 ;; Options menu added for 19.9 by Jamie Zawinski, late 1993.
34 ;; Major reorganization c. 1994 by Ben Wing; added many items and moved
35 ;; some items to two new menus, Apps and Tools. (for 19.10?)
36 ;; Generic menubar functions moved to new file, menubar.el, by Ben Wing,
37 ;; 1995, for 19.12; also, creation of current buffers menu options,
38 ;; and buffers menu changed from purely most-recent to sorted alphabetical,
39 ;; by mode. Also added mode-popup-menu support.
40 ;; New API (add-submenu, add-menu-button) and menu filter support added
41 ;; late summer 1995 by Stig, for 19.13. Also popup-menubar-menu.
42 ;; Renamed to menubar-items.el c. 1998, with MS Win support.
43 ;; Options menu rewritten to use custom c. 1999 by ? (Jan Vroonhof?).
44 ;; Major reorganization Mar. 2000 by Ben Wing; added many items and changed
45 ;; top-level menus to File, Edit, View, Cmds, Tools, Options, Buffers.
46 ;; Accelerator spec functionality added Mar. 2000 by Ben Wing.
50 ;; This file is dumped with SXEmacs (when window system and menubar support is
55 (defun Menubar-items-truncate-history (list count label-length)
56 "Truncate a history LIST to first COUNT items.
57 Return a list of (label value) lists with labels truncated to last
58 LABEL-LENGTH characters of value."
60 (if (<= (length x) label-length)
63 (concat "..." (substring x (- label-length))) x)))
64 (if (<= (length list) count)
66 (butlast list (- (length list) count)))))
68 (defun submenu-generate-accelerator-spec (list &optional omit-chars-list)
69 "Add auto-generated accelerator specifications to a submenu.
70 This can be used to add accelerators to the return value of a menu filter
71 function. It correctly ignores unselectable items. It will destructively
72 modify the list passed to it. If an item already has an auto-generated
73 accelerator spec, this will be removed before the new one is added, making
74 this function idempotent.
76 If OMIT-CHARS-LIST is given, it should be a list of lowercase characters,
77 which will not be used as accelerators."
79 (dolist (item list list)
85 (menu-item-generate-accelerator-spec n omit-chars-list)
86 (menu-item-strip-accelerator-spec (aref item 0)))))
91 (menu-item-generate-accelerator-spec n omit-chars-list)
92 (menu-item-strip-accelerator-spec (car item)))))))))
94 (defun menu-item-strip-accelerator-spec (item)
95 "Strip an auto-generated accelerator spec off of ITEM.
96 ITEM should be a string. This removes specs added by
97 `menu-item-generate-accelerator-spec' and `submenu-generate-accelerator-spec'."
98 (if (string-match "%_. " item)
102 (defun menu-item-generate-accelerator-spec (n &optional omit-chars-list)
103 "Return an accelerator specification for use with auto-generated menus.
104 This should be concat'd onto the beginning of each menu line. The spec
105 allows the Nth line to be selected by the number N. '0' is used for the
106 10th line, and 'a' through 'z' are used for the following 26 lines.
108 If OMIT-CHARS-LIST is given, it should be a list of lowercase characters,
109 which will not be used as accelerators."
110 (cond ((< n 10) (concat "%_" (int-to-string n) " "))
117 (while (memq (int-to-char (+ m (- (char-to-int ?a) 1)))
124 (char-to-string (int-to-char (+ m (- (char-to-int ?a) 1))))
129 (defcustom menu-max-items 25
130 "*Maximum number of items in generated menus.
131 If number of entries in such a menu is larger than this value, split menu
132 into submenus of nearly equal length (see `menu-submenu-max-items'). If
133 nil, never split menu into submenus."
135 :type '(choice (const :tag "no submenus" nil)
138 (defcustom menu-submenu-max-items 20
139 "*Maximum number of items in submenus when splitting menus.
140 We split large menus into submenus of this many items, and then balance
141 them out as much as possible (otherwise the last submenu may have very few
146 (defcustom menu-submenu-name-format "%-12.12s ... %.12s"
147 "*Format specification of the submenu name when splitting menus.
148 Used by `menu-split-long-menu' if the number of entries in a menu is
149 larger than `menu-menu-max-items'.
150 This string should contain one %s for the name of the first entry and
151 one %s for the name of the last entry in the submenu.
152 If the value is a function, it should return the submenu name. The
153 function is be called with two arguments, the names of the first and
154 the last entry in the menu."
156 :type '(choice (string :tag "Format string")
159 (defun menu-split-long-menu (menu)
160 "Split MENU according to `menu-max-items' and add accelerator specs.
162 You should normally use the idiom
164 \(menu-split-long-menu (menu-sort-menu menu))
166 See also `menu-sort-menu'."
167 (let ((len (length menu)))
168 (if (or (null menu-max-items)
169 (<= len menu-max-items))
170 (submenu-generate-accelerator-spec menu)
171 (let* ((outer (/ (+ len (1- menu-submenu-max-items))
172 menu-submenu-max-items))
173 (inner (/ (+ len (1- outer)) outer))
178 (dotimes (foo (min inner len))
179 (setq sub (cons (car menu) sub)
181 (setq len (- len inner))
182 (let ((to (car sub)))
183 (setq sub (nreverse sub))
185 (cons (cons (if (stringp menu-submenu-name-format)
186 (format menu-submenu-name-format
187 (menu-item-strip-accelerator-spec
189 (menu-item-strip-accelerator-spec
191 (funcall menu-submenu-name-format
192 (menu-item-strip-accelerator-spec
194 (menu-item-strip-accelerator-spec
196 (submenu-generate-accelerator-spec sub))
198 (submenu-generate-accelerator-spec (nreverse result))))))
200 (defun menu-sort-menu (menu)
201 "Sort MENU alphabetically.
203 You should normally use the idiom
205 \(menu-split-long-menu (menu-sort-menu menu))
207 See also `menu-split-long-menu'."
209 #'(lambda (a b) (string-lessp (aref a 0) (aref b 0)))))
211 (defun menu-item-search ()
212 "Bring up a search dialog if possible and desired, else do interactive search"
214 (if (should-use-dialog-box-p)
218 (defconst default-menubar
219 ; (purecopy-menubar ;purespace is dead
223 ["%_Open..." find-file]
224 ["Open in Other %_Window..." find-file-other-window]
225 ["Open in New %_Frame..." find-file-other-frame]
226 ["%_Hex Edit File..." hexl-find-file
227 :active (fboundp 'hexl-find-file)]
228 ["%_Insert File..." insert-file]
229 ["%_View File..." view-file]
231 ["%_Save" save-buffer
232 :active (buffer-modified-p)
233 :suffix (if put-buffer-names-in-file-menu (buffer-name) "")]
234 ["Save %_As..." write-file]
235 ["Save So%_me Buffers" save-some-buffers]
237 ,@(if (valid-specifier-tag-p 'msprinter)
238 '(["Page Set%_up..." generic-page-setup]))
239 ["%_Print" generic-print-buffer
240 :active (or (valid-specifier-tag-p 'msprinter)
241 (and (not (eq system-type 'windows-nt))
242 (fboundp 'lpr-region)))
243 :suffix (if (region-active-p) "Selection..."
244 (if put-buffer-names-in-file-menu (concat (buffer-name) "...")
246 ,@(unless (valid-specifier-tag-p 'msprinter)
247 '(["Prett%_y-Print" ps-print-buffer-with-faces
248 :active (fboundp 'ps-print-buffer-with-faces)
249 :suffix (if put-buffer-names-in-file-menu (buffer-name) "")]))
251 ["%_Revert Buffer" revert-buffer
252 :active (or buffer-file-name revert-buffer-function)
253 :suffix (if put-buffer-names-in-file-menu (buffer-name) "")]
254 ["Re%_cover File..." recover-file]
255 ["Recover S%_ession..." recover-session]
257 ["E%_xit SXEmacs" save-buffers-kill-emacs]
261 ["%_Undo" advertised-undo
262 :active (and (not (eq buffer-undo-list t))
263 (or buffer-undo-list pending-undo-list))
264 :suffix (if (or (eq last-command 'undo)
265 (eq last-command 'advertised-undo))
268 :included (fboundp 'redo)
269 :active (not (or (eq buffer-undo-list t)
270 (eq last-buffer-undo-list nil)
271 (not (or (eq last-buffer-undo-list buffer-undo-list)
272 (and (null (car-safe buffer-undo-list))
273 (eq last-buffer-undo-list
274 (cdr-safe buffer-undo-list)))))
275 (or (eq buffer-undo-list pending-undo-list)
276 (eq (cdr buffer-undo-list) pending-undo-list))))
277 :suffix (if (eq last-command 'redo) "More" "")]
279 ["Cu%_t" kill-primary-selection
280 :active (selection-owner-p)]
281 ["%_Copy" copy-primary-selection
282 :active (selection-owner-p)]
283 ["%_Paste" yank-clipboard-selection
284 :active (selection-exists-p 'CLIPBOARD)]
285 ["%_Delete" delete-primary-selection
286 :active (selection-owner-p)]
288 ["Select %_All" mark-whole-buffer]
289 ["Select Pa%_ge" mark-page]
291 ["%_Find..." menu-item-search]
292 ["R%_eplace..." query-replace]
293 ["Replace (Rege%_xp)..." query-replace-regexp]
294 ["%_List Matching Lines..." list-matching-lines]
295 ,@(when (featurep 'mule)
297 ("%_Multilingual (\"Mule\")"
298 ("%_Describe Language Support")
299 ("%_Set Language Environment")
301 ["T%_oggle Input Method" toggle-input-method]
302 ["Select %_Input Method" set-input-method]
303 ["D%_escribe Input Method" describe-input-method]
305 ["Describe Current %_Coding Systems"
306 describe-current-coding-system]
307 ["Set Coding System of %_Buffer File..."
308 set-buffer-file-coding-system]
309 ;; not implemented yet
310 ["Set Coding System of %_Terminal..."
311 set-terminal-coding-system :active nil]
312 ;; not implemented yet
313 ["Set Coding System of %_Keyboard..."
314 set-keyboard-coding-system :active nil]
315 ["Set Coding System of %_Process..."
316 set-buffer-process-coding-system
317 :active (get-buffer-process (current-buffer))]
319 ["Show Cha%_racter Table" view-charset-by-menu]
320 ;; not implemented yet
321 ["Show Dia%_gnosis for MULE" mule-diag :active nil]
322 ["Show \"%_hello\" in Many Languages" view-hello-file]))
327 ["%_New Frame" make-frame]
328 ["Frame on Other Displa%_y..." make-frame-on-display
329 :active (fboundp 'make-frame-on-display)]
330 ["%_Delete Frame" delete-frame
331 :active (not (eq (next-frame (selected-frame) 'nomini 'window-system)
334 ["%_Split Window" split-window-vertically]
335 ["S%_plit Window (Side by Side)" split-window-horizontally]
336 ["%_Un-Split (Keep This)" delete-other-windows
337 :active (not (one-window-p t))]
338 ["Un-Split (Keep %_Others)" delete-window
339 :active (not (one-window-p t))]
342 ["%_Narrow to Region" narrow-to-region :active (region-exists-p)]
343 ["Narrow to %_Page" narrow-to-page]
344 ["Narrow to %_Defun" narrow-to-defun]
346 ["%_Widen" widen :active (or (/= (point-min) 1)
347 (/= (point-max) (1+ (buffer-size))))]
350 ["Show Message %_Log" show-message-log]
352 ["%_Goto Line..." goto-line]
353 ["%_What Line" what-line]
355 :filter bookmark-menu-filter)
357 ["%_Jump to Previous Mark" (set-mark-command t)
362 ["Repeat %_Last Complex Command..." repeat-complex-command]
363 ["E%_valuate Lisp Expression..." eval-expression]
364 ["Execute %_Named Command..." execute-extended-command]
366 ["Start %_Macro Recording" start-kbd-macro
367 :included (not defining-kbd-macro)]
368 ["End %_Macro Recording" end-kbd-macro
369 :included defining-kbd-macro]
370 ["E%_xecute Last Macro" call-last-kbd-macro
371 :active last-kbd-macro]
373 ["%_Append to Last Macro" (start-kbd-macro t)
374 :active (and (not defining-kbd-macro) last-kbd-macro)]
375 ["%_Query User During Macro" kbd-macro-query
376 :active defining-kbd-macro]
377 ["Enter %_Recursive Edit During Macro" (kbd-macro-query t)
378 :active defining-kbd-macro]
380 ["E%_xecute Last Macro on Region Lines"
381 :active (and last-kbd-macro (region-exists-p))]
383 ["%_Name Last Macro..." name-last-kbd-macro
384 :active last-kbd-macro]
385 ["Assign Last Macro to %_Key..." assign-last-kbd-macro-to-key
386 :active (and last-kbd-macro
387 (fboundp 'assign-last-kbd-macro-to-key))]
389 ["%_Edit Macro..." edit-kbd-macro]
390 ["Edit %_Last Macro" edit-last-kbd-macro
391 :active last-kbd-macro]
393 ["%_Insert Named Macro into Buffer..." insert-kbd-macro]
394 ["Read Macro from Re%_gion" read-kbd-macro
395 :active (region-exists-p)]
399 ["D%_ynamic Abbrev Expand" dabbrev-expand]
400 ["Dynamic Abbrev %_Complete" dabbrev-completion]
401 ["Dynamic Abbrev Complete in %_All Buffers" (dabbrev-completion 16)]
404 ["%_Define Global Abbrev for " add-global-abbrev
405 :suffix (abbrev-string-to-be-defined nil)
407 ["Define %_Mode-Specific Abbrev for " add-mode-abbrev
408 :suffix (abbrev-string-to-be-defined nil)
410 ["Define Global Ex%_pansion for " inverse-add-global-abbrev
411 :suffix (inverse-abbrev-string-to-be-defined 1)
413 ["Define Mode-Specific Expa%_nsion for " inverse-add-mode-abbrev
414 :suffix (inverse-abbrev-string-to-be-defined 1)
417 ["E%_xpand Abbrev" expand-abbrev]
418 ["Expand Abbrevs in Re%_gion" expand-region-abbrevs
419 :active (region-exists-p)]
420 ["%_Unexpand Last Abbrev" unexpand-abbrev
421 :active (and (stringp last-abbrev-text)
422 (> last-abbrev-location 0))]
424 ["%_Kill All Abbrevs" kill-all-abbrevs]
425 ["%_Insert All Abbrevs into Buffer" insert-abbrevs]
426 ["%_List Abbrevs" list-abbrevs]
428 ["%_Edit Abbrevs" edit-abbrevs]
429 ["%_Redefine Abbrevs from Buffer" edit-abbrevs-redefine
430 :active (eq major-mode 'edit-abbrevs-mode)]
432 ["%_Save Abbrevs As..." write-abbrev-file]
433 ["L%_oad Abbrevs..." read-abbrev-file]
436 ["%_Copy to Register..." copy-to-register :active (region-exists-p)]
437 ["%_Paste Register..." insert-register]
439 ["%_Save Point to Register" point-to-register]
440 ["%_Jump to Register" register-to-point]
443 ["%_Kill Rectangle" kill-rectangle]
444 ["%_Yank Rectangle" yank-rectangle]
445 ["Rectangle %_to Register" copy-rectangle-to-register]
446 ["Rectangle %_from Register" insert-register]
447 ["%_Clear Rectangle" clear-rectangle]
448 ["%_Open Rectangle" open-rectangle]
449 ["%_Prefix Rectangle..." string-rectangle]
450 ["Rectangle %_Mousing"
451 (customize-set-variable 'mouse-track-rectangle-p
452 (not mouse-track-rectangle-p))
453 :style toggle :selected mouse-track-rectangle-p]
456 ["%_Lines in Region" sort-lines :active (region-exists-p)]
457 ["%_Paragraphs in Region" sort-paragraphs :active (region-exists-p)]
458 ["P%_ages in Region" sort-pages :active (region-exists-p)]
459 ["%_Columns in Region" sort-columns :active (region-exists-p)]
460 ["%_Regexp..." sort-regexp-fields :active (region-exists-p)]
463 ["%_Upcase Region" upcase-region :active (region-exists-p)]
464 ["%_Downcase Region" downcase-region :active (region-exists-p)]
465 ["%_Capitalize Region" capitalize-region :active (region-exists-p)]
466 ["%_Title-Case Region" capitalize-region-as-title
467 :active (region-exists-p)]
470 ["%_Line" center-line]
471 ["%_Paragraph" center-paragraph]
472 ["%_Region" center-region :active (region-exists-p)]
475 ["%_As Previous Line" indent-relative]
476 ["%_To Column..." indent-to-column]
478 ["%_Region" indent-region :active (region-exists-p)]
479 ["%_Balanced Expression" indent-sexp]
480 ["%_C Expression" indent-c-exp]
483 ["%_Buffer" ispell-buffer
484 :active (fboundp 'ispell-buffer)]
486 ["%_Word" ispell-word]
487 ["%_Complete Word" ispell-complete-word]
488 ["%_Region" ispell-region]
494 ("%_Set Download Site"
495 ("%_Official Releases"
496 :filter (lambda (&rest junk)
497 (menu-split-long-menu
498 (submenu-generate-accelerator-spec
499 (package-ui-download-menu)))))
501 :filter (lambda (&rest junk)
502 (menu-split-long-menu
503 (submenu-generate-accelerator-spec
504 (package-ui-pre-release-download-menu)))))
506 :filter (lambda (&rest junk)
507 (menu-split-long-menu
508 (submenu-generate-accelerator-spec
509 (package-ui-site-release-download-menu))))))
511 ["%_Update Package Index" package-get-update-base]
512 ["%_List and Install" pui-list-packages]
513 ["U%_pdate Installed Packages" package-get-update-all]
514 ["%_Help" (Info-goto-node "(xemacs)Packages")])
516 ["Read Mail %_1 (VM)..." vm
517 :active (fboundp 'vm)]
518 ["Read Mail %_2 (MH)..." (mh-rmail t)
519 :active (fboundp 'mh-rmail)]
520 ["Send %_Mail..." compose-mail
521 :active (fboundp 'compose-mail)]
522 ["Usenet %_News" gnus
523 :active (fboundp 'gnus)]
524 ["Browse the %_Web" w3
525 :active (fboundp 'w3)])
530 (if (or (not (boundp 'grep-history)) (null grep-history))
533 (submenu-generate-accelerator-spec
534 (mapcar #'(lambda (label-value)
535 (vector (first label-value)
536 (list 'grep (second label-value))))
537 (Menubar-items-truncate-history
538 grep-history 10 50)))))
539 (append menu '("---") items))))
540 ["%_Grep..." grep :active (fboundp 'grep)]
541 ["%_Kill Grep" kill-compilation
542 :active (and (fboundp 'kill-compilation)
543 (fboundp 'compilation-find-buffer)
544 (let ((buffer (condition-case nil
545 (compilation-find-buffer)
547 (and buffer (get-buffer-process buffer))))]
549 ["Grep %_All Files in Current Directory..."
553 (cons (concat grep-command " *")
554 (length grep-command))))
555 (call-interactively 'grep)))
556 :active (fboundp 'grep)]
557 ["Grep %_C and C Header Files in Current Directory..."
561 (cons (concat grep-command " *.[chCH]"
562 ; i wanted to also use *.cc and *.hh.
563 ; see long comment below under Perl.
565 (length grep-command))))
566 (call-interactively 'grep)))
567 :active (fboundp 'grep)]
568 ["Grep C Hea%_der Files in Current Directory..."
572 (cons (concat grep-command " *.[hH]"
573 ; i wanted to also use *.hh.
574 ; see long comment below under Perl.
576 (length grep-command))))
577 (call-interactively 'grep)))
578 :active (fboundp 'grep)]
579 ["Grep %_E-Lisp Files in Current Directory..."
583 (cons (concat grep-command " *.el")
584 (length grep-command))))
585 (call-interactively 'grep)))
586 :active (fboundp 'grep)]
587 ["Grep %_Perl Files in Current Directory..."
591 (cons (concat grep-command " *.pl"
592 ; i wanted to use this:
594 ; but grep complains if it can't
595 ; match anything in a glob, and
596 ; that screws other things up.
597 ; perhaps we need to first scan
598 ; each separate glob in the directory
599 ; to see if there are any files in
600 ; that glob, and if not, omit it.
602 (length grep-command))))
603 (call-interactively 'grep)))
604 :active (fboundp 'grep)]
605 ["Grep %_HTML Files in Current Directory..."
609 (cons (concat grep-command " *.*htm*")
610 (length grep-command))))
611 (call-interactively 'grep)))
612 :active (fboundp 'grep)]
614 ["%_Next Match" next-error
615 :active (and (fboundp 'compilation-errors-exist-p)
616 (compilation-errors-exist-p))]
617 ["Pre%_vious Match" previous-error
618 :active (and (fboundp 'compilation-errors-exist-p)
619 (compilation-errors-exist-p))]
620 ["%_First Match" first-error
621 :active (and (fboundp 'compilation-errors-exist-p)
622 (compilation-errors-exist-p))]
623 ["G%_oto Match" compile-goto-error
624 :active (and (fboundp 'compilation-errors-exist-p)
625 (compilation-errors-exist-p))]
627 ["%_Set Grep Command..."
630 (customize-set-variable
632 (read-shell-command "Default Grep Command: " grep-command)))
633 :active (fboundp 'grep)
639 (if (or (not (boundp 'compile-history)) (null compile-history))
642 (submenu-generate-accelerator-spec
643 (mapcar #'(lambda (label-value)
644 (vector (first label-value)
645 (list 'compile (second label-value))))
646 (Menubar-items-truncate-history
647 compile-history 10 50)))))
648 (append menu '("---") items))))
649 ["%_Compile..." compile :active (fboundp 'compile)]
650 ["%_Repeat Compilation" recompile :active (fboundp 'recompile)]
651 ["%_Kill Compilation" kill-compilation
652 :active (and (fboundp 'kill-compilation)
653 (fboundp 'compilation-find-buffer)
654 (let ((buffer (condition-case nil
655 (compilation-find-buffer)
657 (and buffer (get-buffer-process buffer))))]
659 ["%_Next Error" next-error
660 :active (and (fboundp 'compilation-errors-exist-p)
661 (compilation-errors-exist-p))]
662 ["Pre%_vious Error" previous-error
663 :active (and (fboundp 'compilation-errors-exist-p)
664 (compilation-errors-exist-p))]
665 ["%_First Error" first-error
666 :active (and (fboundp 'compilation-errors-exist-p)
667 (compilation-errors-exist-p))]
668 ["G%_oto Error" compile-goto-error
669 :active (and (fboundp 'compilation-errors-exist-p)
670 (compilation-errors-exist-p))]
674 :active (fboundp 'gdb)]
676 :active (fboundp 'dbx)])
679 :active (fboundp 'shell)]
680 ["S%_hell Command..." shell-command
681 :active (fboundp 'shell-command)]
682 ["Shell Command on %_Region..." shell-command-on-region
683 :active (and (fboundp 'shell-command-on-region) (region-exists-p))])
686 ["%_Find Tag..." find-tag]
687 ["Find %_Other Window..." find-tag-other-window]
688 ["%_Next Tag..." (find-tag nil)]
689 ["N%_ext Other Window..." (find-tag-other-window nil)]
690 ["Next %_File" next-file]
692 ["Tags %_Search..." tags-search]
693 ["Tags %_Replace..." tags-query-replace]
694 ["%_Continue Search/Replace" tags-loop-continue]
696 ["%_Pop stack" pop-tag-mark]
697 ["%_Apropos..." tags-apropos]
699 ["%_Set Tags Table File..." visit-tags-table]
705 ["%_3-Month Calendar" calendar
706 :active (fboundp 'calendar)]
708 :active (fboundp 'diary)]
709 ["%_Holidays" holidays
710 :active (fboundp 'holidays)]
711 ;; we're all pagans at heart ...
712 ["%_Phases of the Moon" phases-of-moon
713 :active (fboundp 'phases-of-moon)]
714 ["%_Sunrise/Sunset" sunrise-sunset
715 :active (fboundp 'sunrise-sunset)])
719 :active (fboundp 'xmine)]
721 :active (fboundp 'tetris)]
723 :active (fboundp 'sokoban)]
724 ["Quote from %_Zippy" yow
725 :active (fboundp 'yow)]
726 ["%_Psychoanalyst" doctor
727 :active (fboundp 'doctor)]
728 ["Ps%_ychoanalyze Zippy!" psychoanalyze-pinhead
729 :active (fboundp 'psychoanalyze-pinhead)]
730 ["%_Random Flames" flame
731 :active (fboundp 'flame)]
732 ["%_Dunnet (Adventure)" dunnet
733 :active (fboundp 'dunnet)]
734 ["Towers of %_Hanoi" hanoi
735 :active (fboundp 'hanoi)]
736 ["Game of %_Life" life
737 :active (fboundp 'life)]
738 ["M%_ultiplication Puzzle" mpuz
739 :active (fboundp 'mpuz)])
745 ("%_Advanced (Customize)"
746 ("%_Emacs" :filter (lambda (&rest junk)
747 (cdr (custom-menu-create 'emacs))))
748 ["%_Group..." customize-group]
749 ["%_Variable..." customize-variable]
750 ["%_Face..." customize-face]
751 ["%_Saved..." customize-saved]
752 ["Se%_t..." customize-customized]
753 ["%_Apropos..." customize-apropos]
754 ["%_Browse..." customize-browse])
757 ["This Buffer %_Read Only" (toggle-read-only)
758 :style toggle :selected buffer-read-only]
759 ["%_Yank/Kill Interact With Clipboard"
760 (if (eq interprogram-cut-function 'own-clipboard)
762 (customize-set-variable 'interprogram-cut-function nil)
763 (customize-set-variable 'interprogram-paste-function nil))
764 (customize-set-variable 'interprogram-cut-function 'own-clipboard)
765 (customize-set-variable 'interprogram-paste-function 'get-clipboard))
767 :selected (eq interprogram-cut-function 'own-clipboard)]
770 (setq overwrite-mode (if overwrite-mode nil 'overwrite-mode-textual))
771 (customize-set-variable 'overwrite-mode overwrite-mode))
772 :style toggle :selected overwrite-mode]
774 (customize-set-variable 'abbrev-mode
775 (not (default-value 'abbrev-mode)))
777 :selected (default-value 'abbrev-mode)]
779 (customize-set-variable 'zmacs-regions (not zmacs-regions))
780 :style toggle :selected zmacs-regions]
782 ["%_Case Sensitive Search"
783 (customize-set-variable 'case-fold-search
784 (setq case-fold-search (not case-fold-search)))
785 :style toggle :selected (not case-fold-search)]
786 ["Case %_Matching Replace"
787 (customize-set-variable 'case-replace (not case-replace))
788 :style toggle :selected case-replace]
790 ("%_Newline at End of File..."
792 (customize-set-variable 'require-final-newline nil)
793 :style radio :selected (not require-final-newline)]
795 (customize-set-variable 'require-final-newline t)
796 :style radio :selected (eq require-final-newline t)]
798 (customize-set-variable 'require-final-newline 'ask)
799 :style radio :selected (and require-final-newline
800 (not (eq require-final-newline t)))])
801 ["Add Newline When Moving Past %_End"
802 (customize-set-variable 'next-line-add-newlines
803 (not next-line-add-newlines))
804 :style toggle :selected next-line-add-newlines])
805 ("%_Keyboard and Mouse"
806 ["%_Delete Key Deletes Selection"
807 (customize-set-variable 'pending-delete-mode (not pending-delete-mode))
809 :selected (and (boundp 'pending-delete-mode) pending-delete-mode)
810 :active (boundp 'pending-delete-mode)]
811 ["`%_kill-line' Kills Whole Line at %_Beg"
812 (customize-set-variable 'kill-whole-line (not kill-whole-line))
814 :selected kill-whole-line]
815 ["Size for %_Block-Movement Commands..."
816 (customize-set-variable 'block-movement-size
817 (read-number "Block Movement Size: "
818 t block-movement-size))]
822 (customize-set-variable 'viper-mode viper-mode))
823 :style toggle :selected (and (boundp 'viper-mode) viper-mode)
824 :active (fboundp 'toggle-viper-mode)]
826 ["S%_hifted Motion Keys Select Region"
827 (customize-set-variable 'shifted-motion-keys-select-region
828 (not shifted-motion-keys-select-region))
830 :selected shifted-motion-keys-select-region]
831 ["%_After Shifted Motion, Unshifted Motion Keys Deselect"
832 (customize-set-variable 'unshifted-motion-keys-deselect-region
833 (not unshifted-motion-keys-deselect-region))
835 :selected unshifted-motion-keys-deselect-region]
837 ["%_Set Key..." global-set-key]
838 ["%_Unset Key..." global-unset-key]
840 ["%_Mouse Paste at Text Cursor (not Clicked Location)"
841 (customize-set-variable 'mouse-yank-at-point (not mouse-yank-at-point))
842 :style toggle :selected mouse-yank-at-point]
844 ["%_Teach Extended Commands"
845 (customize-set-variable 'teach-extended-commands-p
846 (not teach-extended-commands-p))
847 :style toggle :selected teach-extended-commands-p]
850 ["Set Printer %_Name for Generic Print Support..."
851 (customize-set-variable
853 (read-string "Set printer name: " printer-name))]
855 ["Command-Line %_Switches for `lpr'/`lp'..."
856 ;; better to directly open a customization buffer, since the value
857 ;; must be a list of strings, which is somewhat complex to prompt for.
858 (customize-variable 'lpr-switches)
859 (boundp 'lpr-switches)]
860 ("%_Pretty-Print Paper Size"
862 (customize-set-variable 'ps-paper-type 'letter)
864 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'letter))
865 :active (boundp 'ps-paper-type)]
867 (customize-set-variable 'ps-paper-type 'letter-small)
869 :selected (and (boundp 'ps-paper-type)
870 (eq ps-paper-type 'letter-small))
871 :active (boundp 'ps-paper-type)]
873 (customize-set-variable 'ps-paper-type 'legal)
875 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'legal))
876 :active (boundp 'ps-paper-type)]
878 (customize-set-variable 'ps-paper-type 'statement)
880 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'statement))
881 :active (boundp 'ps-paper-type)]
883 (customize-set-variable 'ps-paper-type 'executive)
885 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'executive))
886 :active (boundp 'ps-paper-type)]
888 (customize-set-variable 'ps-paper-type 'tabloid)
890 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'tabloid))
891 :active (boundp 'ps-paper-type)]
893 (customize-set-variable 'ps-paper-type 'ledger)
895 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'ledger))
896 :active (boundp 'ps-paper-type)]
898 (customize-set-variable 'ps-paper-type 'a3)
900 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'a3))
901 :active (boundp 'ps-paper-type)]
903 (customize-set-variable 'ps-paper-type 'a4)
905 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'a4))
906 :active (boundp 'ps-paper-type)]
908 (customize-set-variable 'ps-paper-type 'a4small)
910 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'a4small))
911 :active (boundp 'ps-paper-type)]
913 (customize-set-variable 'ps-paper-type 'b4)
915 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'b4))
916 :active (boundp 'ps-paper-type)]
918 (customize-set-variable 'ps-paper-type 'b5)
920 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'b5))
921 :active (boundp 'ps-paper-type)]
924 (cond (ps-print-color-p
925 (customize-set-variable 'ps-print-color-p nil)
926 ;; I'm wondering whether all this muck is useful.
927 (and (boundp 'original-face-background)
928 original-face-background
929 (set-face-background 'default original-face-background)))
931 (customize-set-variable 'ps-print-color-p t)
932 (setq original-face-background
933 (face-background-instance 'default))
934 (set-face-background 'default "white")))
936 :selected (and (boundp 'ps-print-color-p) ps-print-color-p)
937 :active (boundp 'ps-print-color-p)])
939 ("%_Compose Mail With"
940 ["Default Emacs Mailer"
941 (customize-set-variable 'mail-user-agent 'sendmail-user-agent)
943 :selected (eq mail-user-agent 'sendmail-user-agent)]
945 (customize-set-variable 'mail-user-agent 'mh-e-user-agent)
947 :selected (eq mail-user-agent 'mh-e-user-agent)
948 :active (get 'mh-e-user-agent 'composefunc)]
950 (customize-set-variable 'mail-user-agent 'message-user-agent)
952 :selected (eq mail-user-agent 'message-user-agent)
953 :active (get 'message-user-agent 'composefunc)]
955 ["Set My %_Email Address..."
956 (customize-set-variable
958 (read-string "Set email address: " user-mail-address))]
959 ["Set %_Machine Email Name..."
960 (customize-set-variable
962 (read-string "Set machine email name: " mail-host-address))]
963 ["Set %_SMTP Server..."
966 (customize-set-variable
967 'smtpmail-smtp-server
968 (read-string "Set SMTP server: " smtpmail-smtp-server)))
969 :active (and (boundp 'send-mail-function)
970 (eq send-mail-function 'smtpmail-send-it))]
974 (customize-set-variable 'smtpmail-debug-info
975 (not smtpmail-debug-info)))
977 :selected (and (boundp 'smtpmail-debug-info) smtpmail-debug-info)
978 :active (and (boundp 'send-mail-function)
979 (eq send-mail-function 'smtpmail-send-it))]
983 (customize-set-variable 'browse-url-browser-function 'browse-url-w3)
985 :selected (and (boundp 'browse-url-browser-function)
986 (eq browse-url-browser-function 'browse-url-w3))
987 :active (and (boundp 'browse-url-browser-function)
988 (fboundp 'browse-url-w3)
989 (fboundp 'w3-fetch))]
990 ["Emacs-%_W3 (gnudoit)"
991 (customize-set-variable 'browse-url-browser-function 'browse-url-w3-gnudoit)
993 :selected (and (boundp 'browse-url-browser-function)
994 (eq browse-url-browser-function
995 'browse-url-w3-gnudoit))
996 :active (and (boundp 'browse-url-browser-function)
997 (fboundp 'browse-url-w3-gnudoit))]
999 (customize-set-variable 'browse-url-browser-function
1000 'browse-url-netscape)
1002 :selected (and (boundp 'browse-url-browser-function)
1003 (eq browse-url-browser-function 'browse-url-netscape))
1004 :active (and (boundp 'browse-url-browser-function)
1005 (fboundp 'browse-url-netscape))]
1007 (customize-set-variable 'browse-url-browser-function
1010 :selected (and (boundp 'browse-url-browser-function)
1011 (eq browse-url-browser-function 'browse-url-mosaic))
1012 :active (and (boundp 'browse-url-browser-function)
1013 (fboundp 'browse-url-mosaic))]
1015 (customize-set-variable 'browse-url-browser-function 'browse-url-cci)
1017 :selected (and (boundp 'browse-url-browser-function)
1018 (eq browse-url-browser-function 'browse-url-cci))
1019 :active (and (boundp 'browse-url-browser-function)
1020 (fboundp 'browse-url-cci))]
1022 (customize-set-variable 'browse-url-browser-function
1023 'browse-url-iximosaic)
1025 :selected (and (boundp 'browse-url-browser-function)
1026 (eq browse-url-browser-function 'browse-url-iximosaic))
1027 :active (and (boundp 'browse-url-browser-function)
1028 (fboundp 'browse-url-iximosaic))]
1030 (customize-set-variable 'browse-url-browser-function
1031 'browse-url-lynx-xterm)
1033 :selected (and (boundp 'browse-url-browser-function)
1034 (eq browse-url-browser-function 'browse-url-lynx-xterm))
1035 :active (and (boundp 'browse-url-browser-function)
1036 (fboundp 'browse-url-lynx-xterm))]
1038 (customize-set-variable 'browse-url-browser-function
1039 'browse-url-lynx-emacs)
1041 :selected (and (boundp 'browse-url-browser-function)
1042 (eq browse-url-browser-function 'browse-url-lynx-emacs))
1043 :active (and (boundp 'browse-url-browser-function)
1044 (fboundp 'browse-url-lynx-emacs))]
1046 (customize-set-variable 'browse-url-browser-function
1049 :selected (and (boundp 'browse-url-browser-function)
1050 (eq browse-url-browser-function 'browse-url-grail))
1051 :active (and (boundp 'browse-url-browser-function)
1052 (fboundp 'browse-url-grail))]
1054 (customize-set-variable 'browse-url-browser-function
1057 :selected (and (boundp 'browse-url-browser-function)
1058 (eq browse-url-browser-function 'browse-url-kde))
1059 :active (and (boundp 'browse-url-browser-function)
1060 (fboundp 'browse-url-kde))]
1062 (customize-set-variable 'browse-url-browser-function
1063 'browse-url-mozilla)
1065 :selected (and (boundp 'browse-url-browser-function)
1066 (eq browse-url-browser-function 'browse-url-mozilla))
1067 :active (and (boundp 'browse-url-browser-function)
1068 (fboundp 'browse-url-mozilla))]
1070 (customize-set-variable 'browse-url-browser-function
1073 :selected (and (boundp 'browse-url-browser-function)
1074 (eq browse-url-browser-function 'browse-url-galeon))
1075 :active (and (boundp 'browse-url-browser-function)
1076 (fboundp 'browse-url-galeon))]
1078 (customize-set-variable 'browse-url-browser-function
1081 :selected (and (boundp 'browse-url-browser-function)
1082 (eq browse-url-browser-function 'browse-url-opera))
1083 :active (and (boundp 'browse-url-browser-function)
1084 (fboundp 'browse-url-opera))]
1086 (customize-set-variable 'browse-url-browser-function
1089 :selected (and (boundp 'browse-url-browser-function)
1090 (eq browse-url-browser-function 'browse-url-mmm))
1091 :active (and (boundp 'browse-url-browser-function)
1092 (fboundp 'browse-url-mmm))]
1093 ["G%_eneric Browser"
1094 (customize-set-variable 'browse-url-browser-function
1095 'browse-url-generic)
1097 :selected (and (boundp 'browse-url-browser-function)
1098 (eq browse-url-browser-function 'browse-url-generic))
1099 :active (and (boundp 'browse-url-browser-function)
1100 (boundp 'browse-url-generic-program)
1101 browse-url-generic-program
1102 (fboundp 'browse-url-generic))]
1104 ("%_Troubleshooting"
1106 (customize-set-variable 'debug-on-error (not debug-on-error))
1107 :style toggle :selected debug-on-error]
1109 (customize-set-variable 'debug-on-quit (not debug-on-quit))
1110 :style toggle :selected debug-on-quit]
1111 ["Debug on S%_ignal"
1112 (customize-set-variable 'debug-on-signal (not debug-on-signal))
1113 :style toggle :selected debug-on-signal]
1114 ["%_Stack Trace on Error"
1115 (customize-set-variable 'stack-trace-on-error
1116 (not stack-trace-on-error))
1117 :style toggle :selected stack-trace-on-error]
1118 ["Stack Trace on Si%_gnal"
1119 (customize-set-variable 'stack-trace-on-signal
1120 (not stack-trace-on-signal))
1121 :style toggle :selected stack-trace-on-signal]
1125 ,@(if (featurep 'scrollbar)
1127 (customize-set-variable 'scrollbars-visible-p
1128 (not scrollbars-visible-p))
1130 :selected scrollbars-visible-p]))
1131 ["%_Wrap Long Lines"
1132 (progn;; becomes buffer-local
1133 (setq truncate-lines (not truncate-lines))
1134 (customize-set-variable 'truncate-lines truncate-lines))
1136 :selected (not truncate-lines)]
1139 (customize-set-variable 'modeline-3d-p
1140 (not modeline-3d-p))
1142 :selected modeline-3d-p]
1143 ("Modeline %_Horizontal Scrolling"
1145 (customize-set-variable 'modeline-scrolling-method nil)
1147 :selected (not modeline-scrolling-method)]
1149 (customize-set-variable 'modeline-scrolling-method t)
1151 :selected (eq modeline-scrolling-method t)]
1153 (customize-set-variable 'modeline-scrolling-method 'scrollbar)
1155 :selected (eq modeline-scrolling-method 'scrollbar)]
1157 ,@(if (featurep 'toolbar)
1159 ["%_Toolbars Visible"
1160 (customize-set-variable 'toolbar-visible-p
1161 (not toolbar-visible-p))
1163 :selected toolbar-visible-p]
1164 ["Toolbars Ca%_ptioned"
1165 (customize-set-variable 'toolbar-captioned-p
1166 (not toolbar-captioned-p))
1168 :active toolbar-visible-p
1169 :selected toolbar-captioned-p]
1170 ("Default Toolba%_r Location"
1172 (customize-set-variable 'default-toolbar-position 'top)
1174 :active toolbar-visible-p
1175 :selected (eq default-toolbar-position 'top)]
1177 (customize-set-variable 'default-toolbar-position 'bottom)
1179 :active toolbar-visible-p
1180 :selected (eq default-toolbar-position 'bottom)]
1182 (customize-set-variable 'default-toolbar-position 'left)
1184 :active toolbar-visible-p
1185 :selected (eq default-toolbar-position 'left)]
1187 (customize-set-variable 'default-toolbar-position 'right)
1189 :active toolbar-visible-p
1190 :selected (eq default-toolbar-position 'right)]
1193 ,@(if (featurep 'gutter)
1195 ["B%_uffers Tab Visible"
1196 (customize-set-variable 'gutter-buffers-tab-visible-p
1197 (not gutter-buffers-tab-visible-p))
1199 :selected gutter-buffers-tab-visible-p]
1200 ("Default %_Gutter Location"
1202 (customize-set-variable 'default-gutter-position 'top)
1204 :selected (eq default-gutter-position 'top)]
1206 (customize-set-variable 'default-gutter-position 'bottom)
1208 :selected (eq default-gutter-position 'bottom)]
1210 (customize-set-variable 'default-gutter-position 'left)
1212 :selected (eq default-gutter-position 'left)]
1214 (customize-set-variable 'default-gutter-position 'right)
1216 :selected (eq default-gutter-position 'right)]
1220 ["%_Blinking Cursor"
1221 (customize-set-variable 'blink-cursor-mode (not blink-cursor-mode))
1223 :selected (and (boundp 'blink-cursor-mode) blink-cursor-mode)
1224 :active (boundp 'blink-cursor-mode)]
1227 (customize-set-variable 'bar-cursor nil)
1228 (force-cursor-redisplay))
1230 :selected (null bar-cursor)]
1231 ["Bar Cursor (%_1 Pixel)"
1233 (customize-set-variable 'bar-cursor t)
1234 (force-cursor-redisplay))
1236 :selected (eq bar-cursor t)]
1237 ["Bar Cursor (%_2 Pixels)"
1239 (customize-set-variable 'bar-cursor 2)
1240 (force-cursor-redisplay))
1242 :selected (and bar-cursor (not (eq bar-cursor t)))]
1244 ("Pa%_ren Highlighting"
1246 (customize-set-variable 'paren-mode nil)
1248 :selected (and (boundp 'paren-mode) (not paren-mode))
1249 :active (boundp 'paren-mode)]
1251 (customize-set-variable 'paren-mode 'blink-paren)
1253 :selected (and (boundp 'paren-mode) (eq paren-mode 'blink-paren))
1254 :active (boundp 'paren-mode)]
1256 (customize-set-variable 'paren-mode 'paren)
1258 :selected (and (boundp 'paren-mode) (eq paren-mode 'paren))
1259 :active (boundp 'paren-mode)]
1261 (customize-set-variable 'paren-mode 'sexp)
1263 :selected (and (boundp 'paren-mode) (eq paren-mode 'sexp))
1264 :active (boundp 'paren-mode)]
1265 ;; ["Nes%_ted Shading"
1266 ;; (customize-set-variable 'paren-mode 'nested)
1268 ;; :selected (and (boundp 'paren-mode) (eq paren-mode 'nested))
1269 ;; :active (boundp 'paren-mode)]
1274 (customize-set-variable 'line-number-mode (not line-number-mode))
1276 :style toggle :selected line-number-mode]
1279 (customize-set-variable 'column-number-mode
1280 (not column-number-mode))
1282 :style toggle :selected column-number-mode]
1284 ("\"Other %_Window\" Location"
1285 ["%_Always in Same Frame"
1286 (customize-set-variable
1287 'get-frame-for-buffer-default-instance-limit nil)
1289 :selected (null get-frame-for-buffer-default-instance-limit)]
1290 ["Other Frame (%_2 Frames Max)"
1291 (customize-set-variable 'get-frame-for-buffer-default-instance-limit
1294 :selected (eq 2 get-frame-for-buffer-default-instance-limit)]
1295 ["Other Frame (%_3 Frames Max)"
1296 (customize-set-variable 'get-frame-for-buffer-default-instance-limit
1299 :selected (eq 3 get-frame-for-buffer-default-instance-limit)]
1300 ["Other Frame (%_4 Frames Max)"
1301 (customize-set-variable 'get-frame-for-buffer-default-instance-limit
1304 :selected (eq 4 get-frame-for-buffer-default-instance-limit)]
1305 ["Other Frame (%_5 Frames Max)"
1306 (customize-set-variable 'get-frame-for-buffer-default-instance-limit
1309 :selected (eq 5 get-frame-for-buffer-default-instance-limit)]
1310 ["Always Create %_New Frame"
1311 (customize-set-variable 'get-frame-for-buffer-default-instance-limit
1314 :selected (eq 0 get-frame-for-buffer-default-instance-limit)]
1316 ["%_Temp Buffers Always in Same Frame"
1317 (customize-set-variable 'temp-buffer-show-function
1318 'show-temp-buffer-in-current-frame)
1320 :selected (eq temp-buffer-show-function
1321 'show-temp-buffer-in-current-frame)]
1322 ["Temp Buffers %_Like Other Buffers"
1323 (customize-set-variable 'temp-buffer-show-function nil)
1325 :selected (null temp-buffer-show-function)]
1327 ["%_Make Current Frame Gnuserv Target"
1328 (customize-set-variable 'gnuserv-frame (if (eq gnuserv-frame t) nil
1331 :selected (and (boundp 'gnuserv-frame) (eq gnuserv-frame t))
1332 :active (boundp 'gnuserv-frame)]
1336 ["%_Frame-Local Font Menu"
1337 (customize-set-variable 'font-menu-this-frame-only-p
1338 (not font-menu-this-frame-only-p))
1340 :selected (and (boundp 'font-menu-this-frame-only-p)
1341 font-menu-this-frame-only-p)]
1342 ["%_Alt/Meta Selects Menu Items"
1343 (if (eq menu-accelerator-enabled 'menu-force)
1344 (customize-set-variable 'menu-accelerator-enabled nil)
1345 (customize-set-variable 'menu-accelerator-enabled 'menu-force))
1347 :selected (eq menu-accelerator-enabled 'menu-force)]
1349 ["Buffers Menu %_Length..."
1350 (customize-set-variable
1351 'buffers-menu-max-size
1352 ;; would it be better to open a customization buffer ?
1355 "Enter number of buffers to display (or 0 for unlimited): ")))
1356 (if (eq val 0) nil val)))]
1357 ["%_Multi-Operation Buffers Sub-Menus"
1358 (customize-set-variable 'complex-buffers-menu-p
1359 (not complex-buffers-menu-p))
1361 :selected complex-buffers-menu-p]
1362 ["S%_ubmenus for Buffer Groups"
1363 (customize-set-variable 'buffers-menu-submenus-for-groups-p
1364 (not buffers-menu-submenus-for-groups-p))
1366 :selected buffers-menu-submenus-for-groups-p]
1367 ["%_Verbose Buffer Menu Entries"
1368 (if (eq buffers-menu-format-buffer-line-function
1369 'slow-format-buffers-menu-line)
1370 (customize-set-variable 'buffers-menu-format-buffer-line-function
1371 'format-buffers-menu-line)
1372 (customize-set-variable 'buffers-menu-format-buffer-line-function
1373 'slow-format-buffers-menu-line))
1375 :selected (eq buffers-menu-format-buffer-line-function
1376 'slow-format-buffers-menu-line)]
1377 ("Buffers Menu %_Sorting"
1378 ["%_Most Recently Used"
1380 (customize-set-variable 'buffers-menu-sort-function nil)
1381 (customize-set-variable 'buffers-menu-grouping-function nil))
1383 :selected (null buffers-menu-sort-function)]
1386 (customize-set-variable 'buffers-menu-sort-function
1387 'sort-buffers-menu-alphabetically)
1388 (customize-set-variable 'buffers-menu-grouping-function nil))
1390 :selected (eq 'sort-buffers-menu-alphabetically
1391 buffers-menu-sort-function)]
1392 ["%_By Major Mode, Then Alphabetically"
1394 (customize-set-variable
1395 'buffers-menu-sort-function
1396 'sort-buffers-menu-by-mode-then-alphabetically)
1397 (customize-set-variable
1398 'buffers-menu-grouping-function
1399 'group-buffers-menu-by-mode-then-alphabetically))
1401 :selected (eq 'sort-buffers-menu-by-mode-then-alphabetically
1402 buffers-menu-sort-function)])
1404 ["%_Ignore Scaled Fonts"
1405 (customize-set-variable 'font-menu-ignore-scaled-fonts
1406 (not font-menu-ignore-scaled-fonts))
1408 :selected (and (boundp 'font-menu-ignore-scaled-fonts)
1409 font-menu-ignore-scaled-fonts)]
1411 ("S%_yntax Highlighting"
1413 (progn;; becomes buffer local
1415 (customize-set-variable 'font-lock-mode font-lock-mode))
1417 :selected (and (boundp 'font-lock-mode) font-lock-mode)
1418 :active (boundp 'font-lock-mode)]
1420 (customize-set-variable 'font-lock-auto-fontify
1421 (not font-lock-auto-fontify))
1423 :selected (and (boundp 'font-lock-auto-fontify) font-lock-auto-fontify)
1424 :active (fboundp 'font-lock-mode)]
1426 ["Force %_Rehighlight in this Buffer"
1427 (customize-set-variable 'font-lock-auto-fontify
1428 (not font-lock-auto-fontify))
1430 :selected (and (boundp 'font-lock-auto-fontify) font-lock-auto-fontify)
1431 :active (fboundp 'font-lock-mode)]
1435 (require 'font-lock)
1436 (font-lock-use-default-fonts)
1437 (customize-set-variable 'font-lock-use-fonts t)
1438 (customize-set-variable 'font-lock-use-colors nil)
1441 :selected (and (boundp 'font-lock-use-fonts) font-lock-use-fonts)
1442 :active (fboundp 'font-lock-mode)]
1445 (require 'font-lock)
1446 (font-lock-use-default-colors)
1447 (customize-set-variable 'font-lock-use-colors t)
1448 (customize-set-variable 'font-lock-use-fonts nil)
1451 :selected (and (boundp 'font-lock-use-colors) font-lock-use-colors)
1452 :active (boundp 'font-lock-mode)]
1456 (require 'font-lock)
1457 (if (or (and (not (integerp font-lock-maximum-decoration))
1458 (not (eq t font-lock-maximum-decoration)))
1459 (and (integerp font-lock-maximum-decoration)
1460 (<= font-lock-maximum-decoration 0)))
1462 (customize-set-variable 'font-lock-maximum-decoration nil)
1463 (font-lock-recompute-variables)))
1465 :active (fboundp 'font-lock-mode)
1466 :selected (and (boundp 'font-lock-maximum-decoration)
1467 (or (and (not (integerp font-lock-maximum-decoration))
1468 (not (eq t font-lock-maximum-decoration)))
1469 (and (integerp font-lock-maximum-decoration)
1470 (<= font-lock-maximum-decoration 0))))]
1473 (require 'font-lock)
1474 (if (and (integerp font-lock-maximum-decoration)
1475 (= 1 font-lock-maximum-decoration))
1477 (customize-set-variable 'font-lock-maximum-decoration 1)
1478 (font-lock-recompute-variables)))
1480 :active (fboundp 'font-lock-mode)
1481 :selected (and (boundp 'font-lock-maximum-decoration)
1482 (integerp font-lock-maximum-decoration)
1483 (= 1 font-lock-maximum-decoration))]
1486 (require 'font-lock)
1487 (if (and (integerp font-lock-maximum-decoration)
1488 (= 2 font-lock-maximum-decoration))
1490 (customize-set-variable 'font-lock-maximum-decoration 2)
1491 (font-lock-recompute-variables)))
1493 :active (fboundp 'font-lock-mode)
1494 :selected (and (boundp 'font-lock-maximum-decoration)
1495 (integerp font-lock-maximum-decoration)
1496 (= 2 font-lock-maximum-decoration))]
1499 (require 'font-lock)
1500 (if (or (eq font-lock-maximum-decoration t)
1501 (and (integerp font-lock-maximum-decoration)
1502 (>= font-lock-maximum-decoration 3)))
1504 (customize-set-variable 'font-lock-maximum-decoration t)
1505 (font-lock-recompute-variables)))
1507 :active (fboundp 'font-lock-mode)
1508 :selected (and (boundp 'font-lock-maximum-decoration)
1509 (or (eq font-lock-maximum-decoration t)
1510 (and (integerp font-lock-maximum-decoration)
1511 (>= font-lock-maximum-decoration 3))))]
1514 (progn;; becomes buffer local
1516 (customize-set-variable 'lazy-lock-mode lazy-lock-mode)
1517 ;; this shouldn't be necessary so there has to
1518 ;; be a redisplay bug lurking somewhere (or
1519 ;; possibly another event handler bug)
1521 :active (and (boundp 'font-lock-mode) (boundp 'lazy-lock-mode)
1524 :selected (and (boundp 'lazy-lock-mode) lazy-lock-mode)]
1526 (progn;; becomes buffer local
1528 (customize-set-variable 'lazy-shot-mode lazy-shot-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-shot-mode)
1536 :selected (and (boundp 'lazy-shot-mode) lazy-shot-mode)]
1538 (progn;; becomes buffer local
1540 (customize-set-variable 'fast-lock-mode fast-lock-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 'fast-lock-mode)
1548 :selected (and (boundp 'fast-lock-mode) fast-lock-mode)]
1550 ("%_Font" :filter font-menu-family-constructor)
1551 ("Font Si%_ze" :filter font-menu-size-constructor)
1552 ;; ("Font Weig%_ht" :filter font-menu-weight-constructor)
1553 ["Edit Fa%_ces..." (customize-face nil)]
1556 ;; #### there should be something that holds the name that the init
1557 ;; file should be created as, when it's not present.
1558 (progn (find-file (or user-init-file "~/.sxemacs/init.el"))
1559 (or (eq major-mode 'emacs-lisp-mode)
1560 (emacs-lisp-mode)))]
1561 ["%_Save Options to Custom File" customize-save-customized]
1565 :filter buffers-menu-filter
1566 ["Go To %_Previous Buffer" switch-to-other-buffer]
1567 ["Go To %_Buffer..." switch-to-buffer]
1569 ["%_List All Buffers" list-buffers]
1570 ["%_Delete Buffer" kill-this-buffer
1571 :suffix (if put-buffer-names-in-file-menu (buffer-name) "")]
1575 nil ; the partition: menus after this are flushright
1578 ["%_About SXEmacs..." about-sxemacs]
1580 ["What's %_New in SXEmacs" view-emacs-news]
1581 ["%_Obtaining SXEmacs" describe-distribution]
1583 ("%_Info (Online Docs)"
1584 ["%_Info Contents" info]
1585 ["Lookup %_Key Binding..." Info-goto-emacs-key-command-node]
1586 ["Lookup %_Command..." Info-goto-emacs-command-node]
1587 ["Lookup %_Function..." Info-elisp-ref]
1588 ["Lookup %_Topic..." Info-query])
1590 ["%_FAQ (local)" xemacs-local-faq]
1591 ["FAQ via %_WWW" xemacs-www-faq
1592 :active (fboundp 'browse-url)]
1593 ["%_Home Page" xemacs-www-page
1594 :active (fboundp 'browse-url)])
1596 :filter tutorials-menu-filter)
1599 (find-file (locate-data-file "sample.init.el"))
1600 :active (locate-data-file "sample.init.el")]
1601 ["Sample .%_Xdefaults"
1602 (find-file (locate-data-file "sample.Xdefaults"))
1603 :included (featurep 'x)
1604 :active (locate-data-file "sample.Xdefaults")]
1605 ["Sample %_enriched"
1606 (find-file (locate-data-file "enriched.doc"))
1607 :active (locate-data-file "enriched.doc")])
1608 ("%_Commands & Keys"
1609 ["%_Mode" describe-mode]
1610 ["%_Apropos..." hyper-apropos]
1611 ["Apropos %_Docs..." apropos-documentation]
1613 ["%_Key..." describe-key]
1614 ["%_Bindings" describe-bindings]
1615 ["%_Mouse Bindings" describe-pointer]
1616 ["%_Recent Keys" view-lossage]
1618 ["%_Function..." describe-function]
1619 ["%_Variable..." describe-variable]
1620 ["%_Locate Command..." where-is])
1622 ["%_Recent Messages" view-lossage]
1624 ["%_Current Installation Info" describe-installation
1625 :active (boundp 'Installation-string)]
1626 ["%_No Warranty" describe-no-warranty]
1627 ["SXEmacs %_License" describe-copying]
1628 ["Find %_Packages" finder-by-keyword]
1629 ["View %_Splash Screen" sxemacs-splash-buffer]
1630 ["%_Unix Manual..." manual-entry])
1631 ["Send %_Bug Report..." report-sxemacs-bug
1632 :active (fboundp 'report-sxemacs-bug)])))
1635 (defun maybe-add-init-button ()
1637 Adds `Load .emacs' button to menubar when starting up with -q."
1638 (when (not load-user-init-file-p)
1643 (mapc #'(lambda (buf)
1644 (with-current-buffer buf
1645 (delete-menu-item '("Load init.el"))))
1647 (load-user-init-file))
1651 (add-hook 'before-init-hook 'maybe-add-init-button)
1656 (defvar put-buffer-names-in-file-menu t)
1659 ;;; The Bookmarks menu
1661 (defun bookmark-menu-filter (&rest ignore)
1662 (declare (special bookmark-alist))
1663 (let ((definedp (and (boundp 'bookmark-alist)
1667 '("%_Jump to Bookmark"
1668 :filter (lambda (&rest junk)
1669 (submenu-generate-accelerator-spec
1670 (mapcar #'(lambda (bmk)
1671 `[,bmk (bookmark-jump ',bmk)])
1672 (bookmark-all-names)))))
1673 ["%_Jump to Bookmark" nil nil])
1674 ["Set %_Bookmark" bookmark-set
1675 :active (fboundp 'bookmark-set)]
1677 ["Insert %_Contents" bookmark-menu-insert
1678 :active (fboundp 'bookmark-menu-insert)]
1679 ["Insert L%_ocation" bookmark-menu-locate
1680 :active (fboundp 'bookmark-menu-locate)]
1682 ["%_Rename Bookmark" bookmark-menu-rename
1683 :active (fboundp 'bookmark-menu-rename)]
1685 '("%_Delete Bookmark"
1686 :filter (lambda (&rest junk)
1687 (submenu-generate-accelerator-spec
1688 (mapcar #'(lambda (bmk)
1689 `[,bmk (bookmark-delete ',bmk)])
1690 (bookmark-all-names)))))
1691 ["%_Delete Bookmark" nil nil])
1692 ["%_Edit Bookmark List" bookmark-bmenu-list ,definedp]
1694 ["%_Save Bookmarks" bookmark-save ,definedp]
1695 ["Save Bookmarks %_As..." bookmark-write ,definedp]
1696 ["%_Load a Bookmark File" bookmark-load
1697 :active (fboundp 'bookmark-load)])))
1699 ;;; The Buffers menu
1701 (defgroup buffers-menu nil
1702 "Customization of `Buffers' menu."
1705 (defvar buffers-menu-omit-chars-list '(?b ?p ?l ?d))
1707 (defcustom buffers-menu-max-size 25
1708 "*Maximum number of entries which may appear on the \"Buffers\" menu.
1709 If this is 10, then only the ten most-recently-selected buffers will be
1710 shown. If this is nil, then all buffers will be shown. Setting this to
1711 a large number or nil will slow down menu responsiveness."
1712 :type '(choice (const :tag "Show all" nil)
1714 :group 'buffers-menu)
1716 (defcustom complex-buffers-menu-p nil
1717 "*If non-nil, the buffers menu will contain several commands.
1718 Commands will be presented as submenus of each buffer line. If this
1719 is false, then there will be only one command: select that buffer."
1721 :group 'buffers-menu)
1723 (defcustom buffers-menu-submenus-for-groups-p nil
1724 "*If non-nil, the buffers menu will contain one submenu per group of buffers.
1725 The grouping function is specified in `buffers-menu-grouping-function'.
1726 If this is an integer, do not build submenus if the number of buffers
1727 is not larger than this value."
1728 :type '(choice (const :tag "No Subgroups" nil)
1729 (integer :tag "Max. submenus" 10)
1730 (sexp :format "%t\n" :tag "Allow Subgroups" :value t))
1731 :group 'buffers-menu)
1733 (defcustom buffers-menu-switch-to-buffer-function 'switch-to-buffer
1734 "*The function to call to select a buffer from the buffers menu.
1735 `switch-to-buffer' is a good choice, as is `pop-to-buffer'."
1736 :type '(radio (function-item switch-to-buffer)
1737 (function-item pop-to-buffer)
1738 (function :tag "Other"))
1739 :group 'buffers-menu)
1741 (defcustom buffers-menu-omit-function 'buffers-menu-omit-invisible-buffers
1742 "*If non-nil, a function specifying the buffers to omit from the buffers menu.
1743 This is passed a buffer and should return non-nil if the buffer should be
1744 omitted. The default value `buffers-menu-omit-invisible-buffers' omits
1745 buffers that are normally considered \"invisible\" (those whose name
1746 begins with a space)."
1747 :type '(choice (const :tag "None" nil)
1749 :group 'buffers-menu)
1751 (defcustom buffers-menu-format-buffer-line-function 'format-buffers-menu-line
1752 "*The function to call to return a string to represent a buffer in
1753 the buffers menu. The function is passed a buffer and a number
1754 (starting with 1) indicating which buffer line in the menu is being
1755 processed and should return a string containing an accelerator
1756 spec. (Check out `menu-item-generate-accelerator-spec' as a convenient
1757 way of generating the accelerator specs.) The default value
1758 `format-buffers-menu-line' just returns the name of the buffer and
1759 uses the number as the accelerator. Also check out
1760 `slow-format-buffers-menu-line' which returns a whole bunch of info
1763 Note: Gross Compatibility Hack: Older versions of this function prototype
1764 only expected one argument, not two. We deal gracefully with such
1765 functions by simply calling them with one argument and leaving out the
1766 line number. However, this may go away at any time, so make sure to
1767 update all of your functions of this type."
1769 :group 'buffers-menu)
1771 (defcustom buffers-menu-sort-function
1772 'sort-buffers-menu-by-mode-then-alphabetically
1773 "*If non-nil, a function to sort the list of buffers in the buffers menu.
1774 It will be passed two arguments (two buffers to compare) and should return
1775 t if the first is \"less\" than the second. One possible value is
1776 `sort-buffers-menu-alphabetically'; another is
1777 `sort-buffers-menu-by-mode-then-alphabetically'."
1778 :type '(choice (const :tag "None" nil)
1780 :group 'buffers-menu)
1782 (defcustom buffers-menu-grouping-function
1783 'group-buffers-menu-by-mode-then-alphabetically
1784 "*If non-nil, a function to group buffers in the buffers menu together.
1785 It will be passed two arguments, successive members of the sorted buffers
1786 list after being passed through `buffers-menu-sort-function'. It should
1787 return non-nil if the second buffer begins a new group. The return value
1788 should be the name of the old group, which may be used in hierarchical
1789 buffers menus. The last invocation of the function contains nil as the
1790 second argument, so that the name of the last group can be determined.
1792 The sensible values of this function are dependent on the value specified
1793 for `buffers-menu-sort-function'."
1794 :type '(choice (const :tag "None" nil)
1796 :group 'buffers-menu)
1798 (defun sort-buffers-menu-alphabetically (buf1 buf2)
1799 "For use as a value of `buffers-menu-sort-function'.
1800 Sorts the buffers in alphabetical order by name, but puts buffers beginning
1801 with a star at the end of the list."
1802 (let* ((nam1 (buffer-name buf1))
1803 (nam2 (buffer-name buf2))
1804 (inv1p (not (null (string-match "\\` " nam1))))
1805 (inv2p (not (null (string-match "\\` " nam2))))
1806 (star1p (not (null (string-match "\\`*" nam1))))
1807 (star2p (not (null (string-match "\\`*" nam2)))))
1808 (cond ((not (eq inv1p inv2p))
1810 ((not (eq star1p star2p))
1813 (string-lessp nam1 nam2)))))
1815 (defun sort-buffers-menu-by-mode-then-alphabetically (buf1 buf2)
1816 "For use as a value of `buffers-menu-sort-function'.
1817 Sorts first by major mode and then alphabetically by name, but puts buffers
1818 beginning 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 (mode1 (symbol-value-in-buffer 'major-mode buf1))
1826 (mode2 (symbol-value-in-buffer 'major-mode buf2)))
1827 (cond ((not (eq inv1p inv2p))
1829 ((not (eq star1p star2p))
1831 ((and star1p star2p (string-lessp nam1 nam2)))
1832 ((string-lessp mode1 mode2)
1834 ((string-lessp mode2 mode1)
1837 (string-lessp nam1 nam2)))))
1839 ;; this version is too slow on some machines.
1840 ;; (vintage 1990, that is)
1841 (defun slow-format-buffers-menu-line (buffer n)
1842 "For use as a value of `buffers-menu-format-buffer-line-function'.
1843 This returns a string containing a bunch of info about the buffer."
1844 (concat (menu-item-generate-accelerator-spec n buffers-menu-omit-chars-list)
1845 (format "%s%s %-19s %6s %-15s %s"
1846 (if (buffer-modified-p buffer) "*" " ")
1847 (if (symbol-value-in-buffer 'buffer-read-only buffer)
1849 (buffer-name buffer)
1850 (buffer-size buffer)
1851 (symbol-value-in-buffer 'mode-name buffer)
1852 (or (buffer-file-name buffer) ""))))
1854 (defun format-buffers-menu-line (buffer n)
1855 "For use as a value of `buffers-menu-format-buffer-line-function'.
1856 This just returns the buffer's name."
1857 (concat (menu-item-generate-accelerator-spec n buffers-menu-omit-chars-list)
1858 (buffer-name buffer)))
1860 (defun group-buffers-menu-by-mode-then-alphabetically (buf1 buf2)
1861 "For use as a value of `buffers-menu-grouping-function'.
1862 This groups buffers by major mode. It only really makes sense if
1863 `buffers-menu-sorting-function' is
1864 `sort-buffers-menu-by-mode-then-alphabetically'."
1865 (cond ((string-match "\\`*" (buffer-name buf1))
1866 (and (null buf2) "*Misc*"))
1868 (string-match "\\`*" (buffer-name buf2))
1869 (not (eq (symbol-value-in-buffer 'major-mode buf1)
1870 (symbol-value-in-buffer 'major-mode buf2))))
1871 (symbol-value-in-buffer 'mode-name buf1))
1874 (defun buffer-menu-save-buffer (buffer)
1879 (defun buffer-menu-write-file (buffer)
1882 (write-file (read-file-name
1883 (format "Write %s to file: "
1884 (buffer-name (current-buffer)))))))
1886 (defsubst build-buffers-menu-internal (buffers)
1887 (let (name line (n 0))
1894 ; #### a truly Kyle-friendly hack.
1895 (let ((fn buffers-menu-format-buffer-line-function))
1896 (if (= (function-max-args fn) 1)
1898 (funcall fn buffer n))))
1899 (if complex-buffers-menu-p
1902 (vector "S%_witch to Buffer"
1903 (list buffers-menu-switch-to-buffer-function
1904 (setq name (buffer-name buffer)))
1906 (if (eq buffers-menu-switch-to-buffer-function
1908 (vector "Switch to Buffer, Other %_Frame"
1909 (list 'switch-to-buffer-other-frame
1910 (setq name (buffer-name buffer)))
1913 (if (and (buffer-modified-p buffer)
1914 (buffer-file-name buffer))
1915 (vector "%_Save Buffer"
1916 (list 'buffer-menu-save-buffer name) t)
1917 ["%_Save Buffer" nil nil]
1919 (vector "Save %_As..."
1920 (list 'buffer-menu-write-file name) t)
1921 (vector "%_Delete Buffer" (list 'kill-buffer name)
1923 ;; #### We don't want buffer names to be translated,
1924 ;; #### so we put the buffer name in the suffix.
1925 ;; #### Also, avoid losing with non-ASCII buffer names.
1926 ;; #### We still lose, however, if complex-buffers-menu-p. --mrb
1928 (list buffers-menu-switch-to-buffer-function
1929 (buffer-name buffer))
1933 (defun buffers-menu-filter (menu)
1934 "This is the menu filter for the top-level buffers \"Buffers\" menu.
1935 It dynamically creates a list of buffers to use as the contents of the menu.
1936 Only the most-recently-used few buffers will be listed on the menu, for
1937 efficiency reasons. You can control how many buffers will be shown by
1938 setting `buffers-menu-max-size'. You can control the text of the menu
1939 items by redefining the function `format-buffers-menu-line'."
1940 (let ((buffers (delete-if buffers-menu-omit-function (buffer-list))))
1941 (and (integerp buffers-menu-max-size)
1942 (> buffers-menu-max-size 1)
1943 (> (length buffers) buffers-menu-max-size)
1944 ;; shorten list of buffers (not with submenus!)
1945 (not (and buffers-menu-grouping-function
1946 buffers-menu-submenus-for-groups-p))
1947 (setcdr (nthcdr buffers-menu-max-size buffers) nil))
1948 (if buffers-menu-sort-function
1949 (setq buffers (sort buffers buffers-menu-sort-function)))
1950 (if (and buffers-menu-grouping-function
1951 buffers-menu-submenus-for-groups-p
1952 (or (not (integerp buffers-menu-submenus-for-groups-p))
1953 (> (length buffers) buffers-menu-submenus-for-groups-p)))
1954 (let (groups groupnames current-group)
1957 (let ((groupname (funcall buffers-menu-grouping-function
1958 (car sublist) (cadr sublist))))
1959 (setq current-group (cons (car sublist) current-group))
1962 (setq groups (cons (nreverse current-group)
1964 (setq groupnames (cons groupname groupnames))
1965 (setq current-group nil)))))
1969 #'(lambda (groupname group)
1970 (cons groupname (build-buffers-menu-internal group)))
1971 (nreverse groupnames)
1972 (nreverse groups))))
1973 (if buffers-menu-grouping-function
1978 (cond ((funcall buffers-menu-grouping-function
1979 (car sublist) (cadr sublist))
1980 (list (car sublist) t))
1981 (t (list (car sublist)))))
1983 ;; remove a trailing separator.
1984 (and (>= (length buffers) 2)
1985 (let ((lastcdr (nthcdr (- (length buffers) 2) buffers)))
1986 (if (eq t (cadr lastcdr))
1987 (setcdr lastcdr nil))))))
1988 (setq buffers (build-buffers-menu-internal buffers)))
1989 (append menu buffers)
1992 (defun language-environment-menu-filter (menu)
1993 "This is the menu filter for the \"Language Environment\" submenu."
1994 (declare (special language-environment-list))
1996 (mapcar (lambda (env-sym)
1998 `[ ,(concat (menu-item-generate-accelerator-spec n)
1999 (capitalize (symbol-name env-sym)))
2000 (set-language-environment ',env-sym)])
2001 language-environment-list)))
2004 ;;; The Options menu
2006 ;; We'll keep those variables here for a while, in order to provide a
2007 ;; function for porting the old options file that a user may own to Custom.
2009 (defvar options-save-faces nil
2010 "*Non-nil value means save-options will save information about faces.
2011 A nil value means save-options will not save face information.
2012 Set this non-nil only if you use M-x edit-faces to change face
2013 settings. If you use M-x customize-face or the \"Browse Faces...\"
2014 menu entry, you will see a button in the Customize Face buffer that you
2015 can use to permanently save your face changes.
2017 M-x edit-faces is deprecated. Support for it and this variable will
2018 be discontinued in a future release.")
2020 (defvar save-options-init-file nil
2021 "File into which to save forms to load the options file (nil for .emacs).
2022 Normally this is nil, which means save into your .emacs file (the value
2023 of `user-init-file'.")
2025 (defvar save-options-file ".xemacs-options"
2026 "File to save options into.
2027 This file is loaded from your .emacs file.
2028 If this is a relative filename, it is put into the same directory as your
2035 (defun tutorials-menu-filter (menu-items)
2036 (declare (special language-info-alist
2037 current-language-environment
2038 tutorial-supported-languages))
2040 (if (featurep 'mule)
2042 (assoc current-language-environment language-info-alist))
2043 `([,(concat "%_Default (" current-language-environment ")")
2044 help-with-tutorial]))
2045 '(["%_English" help-with-tutorial]))
2046 (submenu-generate-accelerator-spec
2047 (if (featurep 'mule)
2049 (mapcan #'(lambda (lang)
2050 (let ((tut (assq 'tutorial lang)))
2052 (not (string= (car lang) "ASCII"))
2053 ;; skip current language, since we already
2054 ;; included it first
2055 (not (string= (car lang)
2056 current-language-environment))
2058 (help-with-tutorial nil ,(cdr tut))]))))
2059 language-info-alist)
2060 ;; Non mule tutorials.
2061 (mapcar #'(lambda (lang)
2063 (help-with-tutorial ,(format "TUTORIAL.%s"
2065 tutorial-supported-languages)))))
2067 (set-menubar default-menubar)
2072 (defconst default-popup-menu
2073 '("SXEmacs Commands"
2074 ["%_Undo" advertised-undo
2075 :active (and (not (eq buffer-undo-list t))
2076 (or buffer-undo-list pending-undo-list))
2077 :suffix (if (or (eq last-command 'undo)
2078 (eq last-command 'advertised-undo))
2080 ["Cu%_t" kill-primary-selection
2081 :active (selection-owner-p)]
2082 ["%_Copy" copy-primary-selection
2083 :active (selection-owner-p)]
2084 ["%_Paste" yank-clipboard-selection
2085 :active (selection-exists-p 'CLIPBOARD)]
2086 ["%_Delete" delete-primary-selection
2087 :active (selection-owner-p)]
2089 ["Select %_Block" mark-paragraph]
2090 ["Sp%_lit Window" split-window-vertically]
2091 ["U%_nsplit Window" delete-other-windows]
2094 ;; In an effort to avoid massive menu clutter, this mostly worthless menu is
2095 ;; superseded by any local popup menu...
2096 (setq-default mode-popup-menu default-popup-menu)
2101 (defun sxemacs-splash-buffer ()
2102 "Redisplay SXEmacs splash screen in a buffer."
2104 (let ((buffer (get-buffer-create "*Splash*"))
2107 (setq buffer-read-only t)
2108 (erase-buffer buffer)
2109 (setq tmout (display-splash-frame))
2111 (make-local-hook 'kill-buffer-hook)
2112 (add-hook 'kill-buffer-hook
2114 (disable-timeout ,tmout))
2116 (pop-to-buffer buffer)
2117 (delete-other-windows)))
2120 ;;; backwards compatibility
2121 (provide 'x-menubar)
2122 (provide 'menubar-items)
2124 ;;; menubar-items.el ends here.