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 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 ;; This file is dumped with XEmacs (when window system and menubar support is
36 ;;; Warning-free compile
38 (defvar language-environment-list)
39 (defvar bookmark-alist)
40 (defvar language-info-alist)
41 (defvar current-language-environment)
42 (defvar tutorial-supported-languages))
44 (defconst default-menubar
50 ["Open in Other Window..." find-file-other-window]
51 ["Open in New Frame..." find-file-other-frame]
52 ["Insert File..." insert-file]
53 ["View File..." view-file]
56 :active (buffer-modified-p)
57 :suffix (if put-buffer-names-in-file-menu (buffer-name) "")]
58 ["Save As..." write-file]
59 ["Save Some Buffers" save-some-buffers]
61 ["Print Buffer" lpr-buffer
62 :active (fboundp 'lpr-buffer)
63 :suffix (if put-buffer-names-in-file-menu (buffer-name) "")]
64 ["Pretty-Print Buffer" ps-print-buffer-with-faces
65 :active (fboundp 'ps-print-buffer-with-faces)
66 :suffix (if put-buffer-names-in-file-menu (buffer-name) "")]
68 ["New Frame" make-frame]
69 ["Frame on Other Display..." make-frame-on-display]
70 ["Delete Frame" delete-frame
71 :active (not (eq (next-frame (selected-frame) 'nomini 'window-system)
74 ["Split Window" split-window-vertically]
75 ["Un-Split (Keep This)" delete-other-windows
76 :active (not (one-window-p t))]
77 ["Un-Split (Keep Others)" delete-window
78 :active (not (one-window-p t))]
80 ["Revert Buffer" revert-buffer
81 :active (or buffer-file-name revert-buffer-function)
82 :suffix (if put-buffer-names-in-file-menu (buffer-name) "")]
83 ["Delete Buffer" kill-this-buffer
85 :suffix (if put-buffer-names-in-file-menu (buffer-name) "")]
87 ["Exit XEmacs" save-buffers-kill-emacs]
91 ["Undo" advertised-undo
92 :active (and (not (eq buffer-undo-list t))
93 (or buffer-undo-list pending-undo-list))
94 :suffix (if (or (eq last-command 'undo)
95 (eq last-command 'advertised-undo))
98 :included (fboundp 'redo)
99 :active (not (or (eq buffer-undo-list t)
100 (eq last-buffer-undo-list nil)
101 (not (or (eq last-buffer-undo-list buffer-undo-list)
102 (and (null (car-safe buffer-undo-list))
103 (eq last-buffer-undo-list
104 (cdr-safe buffer-undo-list)))))
105 (or (eq buffer-undo-list pending-undo-list)
106 (eq (cdr buffer-undo-list) pending-undo-list))))
107 :suffix (if (eq last-command 'redo) "More" "")]
108 ["Cut" kill-primary-selection
109 :active (selection-owner-p)]
110 ["Copy" copy-primary-selection
111 :active (selection-owner-p)]
112 ["Paste" yank-clipboard-selection
113 :active (selection-exists-p 'CLIPBOARD)]
114 ["Clear" delete-primary-selection
115 :active (selection-owner-p)]
117 ["Search..." isearch-forward]
118 ["Search Backward..." isearch-backward]
119 ["Replace..." query-replace]
121 ["Search (Regexp)..." isearch-forward-regexp]
122 ["Search Backward (Regexp)..." isearch-backward-regexp]
123 ["Replace (Regexp)..." query-replace-regexp]
125 ["Goto Line..." goto-line]
126 ["What Line" what-line]
128 :filter bookmark-menu-filter)
130 ["Start Macro Recording" start-kbd-macro
131 :active (not defining-kbd-macro)]
132 ["End Macro Recording" end-kbd-macro
133 :active defining-kbd-macro]
134 ["Execute Last Macro" call-last-kbd-macro
135 :active last-kbd-macro]
137 ["Show Message Log" show-message-log]
140 ,@(if (featurep 'mule)
142 ("Describe language support")
143 ("Set language environment")
145 ["Toggle input method" toggle-input-method]
146 ["Select input method" select-input-method]
147 ["Describe input method" describe-input-method]
149 ["Describe current coding systems"
150 describe-current-coding-system]
151 ["Set coding system of buffer file"
152 set-buffer-file-coding-system]
153 ;; not implemented yet
154 ["Set coding system of terminal"
155 set-terminal-coding-system :active nil]
156 ;; not implemented yet
157 ["Set coding system of keyboard"
158 set-keyboard-coding-system :active nil]
159 ;; not implemented yet
160 ["Set coding system of process"
161 set-current-process-coding-system :active nil]
163 ["Show character table" view-charset-by-menu]
164 ;; not implemented yet
165 ["Show diagnosis for MULE" mule-diag :active nil]
166 ["Show many languages" view-hello-file])))
169 ["Read Mail (VM)..." vm
170 :active (fboundp 'vm)]
171 ["Read Mail (MH)..." (mh-rmail t)
172 :active (fboundp 'mh-rmail)]
173 ["Send mail..." compose-mail
174 :active (fboundp 'compose-mail)]
176 :active (fboundp 'gnus)]
178 :active (fboundp 'w3)]
180 :active (fboundp 'gopher)]
182 ["Spell-Check Buffer" ispell-buffer
183 :active (fboundp 'ispell-buffer)]
184 ["Toggle VI emulation" toggle-viper-mode
185 :active (fboundp 'toggle-viper-mode)]
188 ["3-Month Calendar" calendar
189 :active (fboundp 'calendar)]
191 :active (fboundp 'diary)]
193 :active (fboundp 'holidays)]
194 ;; we're all pagans at heart ...
195 ["Phases of the Moon" phases-of-moon
196 :active (fboundp 'phases-of-moon)]
197 ["Sunrise/Sunset" sunrise-sunset
198 :active (fboundp 'sunrise-sunset)])
202 :active (fboundp 'xmine)]
204 :active (fboundp 'tetris)]
206 :active (fboundp 'sokoban)]
207 ["Quote from Zippy" yow
208 :active (fboundp 'yow)]
209 ["Psychoanalyst" doctor
210 :active (fboundp 'doctor)]
211 ["Psychoanalyze Zippy!" psychoanalyze-pinhead
212 :active (fboundp 'psychoanalyze-pinhead)]
213 ["Random Flames" flame
214 :active (fboundp 'flame)]
215 ["Dunnet (Adventure)" dunnet
216 :active (fboundp 'dunnet)]
217 ["Towers of Hanoi" hanoi
218 :active (fboundp 'hanoi)]
220 :active (fboundp 'life)]
221 ["Multiplication Puzzle" mpuz
222 :active (fboundp 'mpuz)]))
226 ("Emacs" :filter (lambda (&rest junk)
227 (cdr (custom-menu-create 'emacs))))
228 ["Group..." customize-group]
229 ["Variable..." customize-variable]
230 ["Face..." customize-face]
231 ["Saved..." customize-saved]
232 ["Set..." customize-customized]
233 ["Apropos..." customize-apropos]
234 ["Browse..." customize-browse]
235 ["List Packages" pui-list-packages]
236 ["Update Packages" package-get-custom])
240 (setq overwrite-mode (if overwrite-mode nil 'overwrite-mode-textual))
241 (customize-set-variable 'overwrite-mode overwrite-mode))
242 :style toggle :selected overwrite-mode]
243 ["Case Sensitive Search"
244 (customize-set-variable 'case-fold-search
245 (setq case-fold-search (not case-fold-search)))
246 :style toggle :selected (not case-fold-search)]
247 ["Case Matching Replace"
248 (customize-set-variable 'case-replace (not case-replace))
249 :style toggle :selected case-replace]
250 ["Auto Delete Selection"
251 (customize-set-variable 'pending-delete-mode (not pending-delete-mode))
253 :selected (and (boundp 'pending-delete-mode) pending-delete-mode)
254 :active (boundp 'pending-delete-mode)]
256 (customize-set-variable 'zmacs-regions (not zmacs-regions))
257 :style toggle :selected zmacs-regions]
258 ["Mouse Paste At Text Cursor"
259 (customize-set-variable 'mouse-yank-at-point (not mouse-yank-at-point))
260 :style toggle :selected mouse-yank-at-point]
261 ("Newline at end of file..."
263 (customize-set-variable 'require-final-newline nil)
264 :style radio :selected (not require-final-newline)]
266 (customize-set-variable 'require-final-newline t)
267 :style radio :selected (eq require-final-newline t)]
269 (customize-set-variable 'require-final-newline 'ask)
270 :style radio :selected (and require-final-newline
271 (not (eq require-final-newline t)))])
272 ["Add Newline When Moving Past End"
273 (customize-set-variable 'next-line-add-newlines
274 (not next-line-add-newlines))
275 :style toggle :selected next-line-add-newlines]
278 ["Teach Extended Commands"
279 (customize-set-variable 'teach-extended-commands-p
280 (not teach-extended-commands-p))
281 :style toggle :selected teach-extended-commands-p]
283 (customize-set-variable 'debug-on-error (not debug-on-error))
284 :style toggle :selected debug-on-error]
286 (customize-set-variable 'debug-on-quit (not debug-on-quit))
287 :style toggle :selected debug-on-quit]
290 ["Command-Line Switches for `lpr'/`lp'..."
291 ;; better to directly open a customization buffer, since the value
292 ;; must be a list of strings, which is somewhat complex to prompt for.
293 (customize-variable 'lpr-switches)
294 (boundp 'lpr-switches)]
295 ("Pretty-Print Paper Size"
297 (customize-set-variable 'ps-paper-type 'letter)
299 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'letter))
300 :active (boundp 'ps-paper-type)]
302 (customize-set-variable 'ps-paper-type 'letter-small)
304 :selected (and (boundp 'ps-paper-type)
305 (eq ps-paper-type 'letter-small))
306 :active (boundp 'ps-paper-type)]
308 (customize-set-variable 'ps-paper-type 'legal)
310 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'legal))
311 :active (boundp 'ps-paper-type)]
313 (customize-set-variable 'ps-paper-type 'statement)
315 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'statement))
316 :active (boundp 'ps-paper-type)]
318 (customize-set-variable 'ps-paper-type 'executive)
320 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'executive))
321 :active (boundp 'ps-paper-type)]
323 (customize-set-variable 'ps-paper-type 'tabloid)
325 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'tabloid))
326 :active (boundp 'ps-paper-type)]
328 (customize-set-variable 'ps-paper-type 'ledger)
330 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'ledger))
331 :active (boundp 'ps-paper-type)]
333 (customize-set-variable 'ps-paper-type 'a3)
335 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'a3))
336 :active (boundp 'ps-paper-type)]
338 (customize-set-variable 'ps-paper-type 'a4)
340 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'a4))
341 :active (boundp 'ps-paper-type)]
343 (customize-set-variable 'ps-paper-type 'a4small)
345 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'a4small))
346 :active (boundp 'ps-paper-type)]
348 (customize-set-variable 'ps-paper-type 'b4)
350 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'b4))
351 :active (boundp 'ps-paper-type)]
353 (customize-set-variable 'ps-paper-type 'b5)
355 :selected (and (boundp 'ps-paper-type) (eq ps-paper-type 'b5))
356 :active (boundp 'ps-paper-type)]
359 (cond (ps-print-color-p
360 (customize-set-variable 'ps-print-color-p nil)
361 ;; I'm wondering whether all this muck is usefull.
362 (and (boundp 'original-face-background)
363 original-face-background
364 (set-face-background 'default original-face-background)))
366 (customize-set-variable 'ps-print-color-p t)
367 (setq original-face-background
368 (face-background-instance 'default))
369 (set-face-background 'default "white")))
371 :selected (and (boundp 'ps-print-color-p) ps-print-color-p)
372 :active (boundp 'ps-print-color-p)])
373 ("\"Other Window\" Location"
374 ["Always in Same Frame"
375 (customize-set-variable
376 'get-frame-for-buffer-default-instance-limit nil)
378 :selected (null get-frame-for-buffer-default-instance-limit)]
379 ["Other Frame (2 Frames Max)"
380 (customize-set-variable 'get-frame-for-buffer-default-instance-limit 2)
382 :selected (eq 2 get-frame-for-buffer-default-instance-limit)]
383 ["Other Frame (3 Frames Max)"
384 (customize-set-variable 'get-frame-for-buffer-default-instance-limit 3)
386 :selected (eq 3 get-frame-for-buffer-default-instance-limit)]
387 ["Other Frame (4 Frames Max)"
388 (customize-set-variable 'get-frame-for-buffer-default-instance-limit 4)
390 :selected (eq 4 get-frame-for-buffer-default-instance-limit)]
391 ["Other Frame (5 Frames Max)"
392 (customize-set-variable 'get-frame-for-buffer-default-instance-limit 5)
394 :selected (eq 5 get-frame-for-buffer-default-instance-limit)]
395 ["Always Create New Frame"
396 (customize-set-variable 'get-frame-for-buffer-default-instance-limit 0)
398 :selected (eq 0 get-frame-for-buffer-default-instance-limit)]
400 ["Temp Buffers Always in Same Frame"
401 (customize-set-variable 'temp-buffer-show-function
402 'show-temp-buffer-in-current-frame)
404 :selected (eq temp-buffer-show-function
405 'show-temp-buffer-in-current-frame)]
406 ["Temp Buffers Like Other Buffers"
407 (customize-set-variable 'temp-buffer-show-function nil)
409 :selected (null temp-buffer-show-function)]
411 ["Make current frame gnuserv target"
412 (customize-set-variable 'gnuserv-frame (if (eq gnuserv-frame t) nil t))
414 :selected (and (boundp 'gnuserv-frame) (eq gnuserv-frame t))
415 :active (boundp 'gnuserv-frame)]
418 ("Syntax Highlighting"
420 (progn ;; becomes buffer local
422 (customize-set-variable 'font-lock-mode font-lock-mode))
424 :selected (and (boundp 'font-lock-mode) font-lock-mode)
425 :active (boundp 'font-lock-mode)]
427 (customize-set-variable 'font-lock-auto-fontify
428 (not font-lock-auto-fontify))
430 :selected (and (boundp 'font-lock-auto-fontify) font-lock-auto-fontify)
431 :active (fboundp 'font-lock-mode)]
436 (font-lock-use-default-fonts)
437 (customize-set-variable 'font-lock-use-fonts t)
438 (customize-set-variable 'font-lock-use-colors nil)
441 :selected (and (boundp 'font-lock-use-fonts) font-lock-use-fonts)
442 :active (fboundp 'font-lock-mode)]
446 (font-lock-use-default-colors)
447 (customize-set-variable 'font-lock-use-colors t)
448 (customize-set-variable 'font-lock-use-fonts nil)
451 :selected (and (boundp 'font-lock-use-colors) font-lock-use-colors)
452 :active (boundp 'font-lock-mode)]
457 (if (or (and (not (integerp font-lock-maximum-decoration))
458 (not (eq t font-lock-maximum-decoration)))
459 (and (integerp font-lock-maximum-decoration)
460 (<= font-lock-maximum-decoration 0)))
462 (customize-set-variable 'font-lock-maximum-decoration nil)
463 (font-lock-recompute-variables)))
465 :active (fboundp 'font-lock-mode)
466 :selected (and (boundp 'font-lock-maximium-decoration)
467 (or (and (not (integerp font-lock-maximum-decoration))
468 (not (eq t font-lock-maximum-decoration)))
469 (and (integerp font-lock-maximum-decoration)
470 (<= font-lock-maximum-decoration 0))))]
474 (if (and (integerp font-lock-maximum-decoration)
475 (= 1 font-lock-maximum-decoration))
477 (customize-set-variable 'font-lock-maximum-decoration 1)
478 (font-lock-recompute-variables)))
480 :active (fboundp 'font-lock-mode)
481 :selected (and (boundp 'font-lock-maximium-decoration)
482 (integerp font-lock-maximum-decoration)
483 (= 1 font-lock-maximum-decoration))]
487 (if (and (integerp font-lock-maximum-decoration)
488 (= 2 font-lock-maximum-decoration))
490 (customize-set-variable 'font-lock-maximum-decoration 2)
491 (font-lock-recompute-variables)))
493 :active (fboundp 'font-lock-mode)
494 :selected (and (boundp 'font-lock-maximum-decoration)
495 (integerp font-lock-maximum-decoration)
496 (= 2 font-lock-maximum-decoration))]
500 (if (or (eq font-lock-maximum-decoration t)
501 (and (integerp font-lock-maximum-decoration)
502 (>= font-lock-maximum-decoration 3)))
504 (customize-set-variable 'font-lock-maximum-decoration t)
505 (font-lock-recompute-variables)))
507 :active (fboundp 'font-lock-mode)
508 :selected (and (boundp 'font-lock-maximum-decoration)
509 (or (eq font-lock-maximum-decoration t)
510 (and (integerp font-lock-maximum-decoration)
511 (>= font-lock-maximum-decoration 3))))]
514 (progn ;; becomes buffer local
516 (customize-set-variable 'lazy-shot-mode lazy-shot-mode)
517 ;; this shouldn't be necessary so there has to
518 ;; be a redisplay bug lurking somewhere (or
519 ;; possibly another event handler bug)
521 :active (and (boundp 'font-lock-mode) (boundp 'lazy-shot-mode)
524 :selected (and (boundp 'lazy-shot-mode) lazy-shot-mode)]
526 (progn ;; becomes buffer local
528 (customize-set-variable 'fast-lock-mode fast-lock-mode)
529 ;; this shouldn't be necessary so there has to
530 ;; be a redisplay bug lurking somewhere (or
531 ;; possibly another event handler bug)
533 :active (and (boundp 'font-lock-mode) (boundp 'fast-lock-mode)
536 :selected (and (boundp 'fast-lock-mode) fast-lock-mode)]
538 ("Paren Highlighting"
540 (customize-set-variable 'paren-mode nil)
542 :selected (and (boundp 'paren-mode) (not paren-mode))
543 :active (boundp 'paren-mode)]
545 (customize-set-variable 'paren-mode 'blink-paren)
547 :selected (and (boundp 'paren-mode) (eq paren-mode 'blink-paren))
548 :active (boundp 'paren-mode)]
550 (customize-set-variable 'paren-mode 'paren)
552 :selected (and (boundp 'paren-mode) (eq paren-mode 'paren))
553 :active (boundp 'paren-mode)]
555 (customize-set-variable 'paren-mode 'sexp)
557 :selected (and (boundp 'paren-mode) (eq paren-mode 'sexp))
558 :active (boundp 'paren-mode)]
560 ;; (customize-set-variable 'paren-mode 'nested)
562 ;; :selected (and (boundp 'paren-mode) (eq paren-mode 'nested))
563 ;; :active (boundp 'paren-mode)]
567 ["Frame-Local Font Menu"
568 (customize-set-variable 'font-menu-this-frame-only-p
569 (not font-menu-this-frame-only-p))
571 :selected (and (boundp 'font-menu-this-frame-only-p)
572 font-menu-this-frame-only-p)]
573 ,@(if (featurep 'scrollbar)
575 (customize-set-variable 'scrollbars-visible-p
576 (not scrollbars-visible-p))
578 :selected scrollbars-visible-p]))
579 ;; I don't think this is of any interest. - dverna apr. 98
580 ;; #### I beg to differ! Many FSFmacs converts hate the 3D
581 ;; modeline, and it was perfectly fine to be able to turn them
582 ;; off through the Options menu. I would have uncommented this
583 ;; source, but the code for saving options would not save the
584 ;; modeline 3D-ness. Grrr. --hniksic
587 ;; (if (zerop (specifier-instance modeline-shadow-thickness))
588 ;; (set-specifier modeline-shadow-thickness 2)
589 ;; (set-specifier modeline-shadow-thickness 0))
590 ;; (redraw-modeline t))
592 ;; :selected (let ((thickness
593 ;; (specifier-instance modeline-shadow-thickness)))
594 ;; (and (integerp thickness)
595 ;; (> thickness 0)))]
597 (progn ;; becomes buffer-local
598 (setq truncate-lines (not truncate-lines))
599 (customize-set-variable 'truncate-lines truncate-lines))
601 :selected truncate-lines]
603 (customize-set-variable 'blink-cursor-mode (not blink-cursor-mode))
605 :selected (and (boundp 'blink-cursor-mode) blink-cursor-mode)
606 :active (boundp 'blink-cursor-mode)]
610 (customize-set-variable 'bar-cursor nil)
611 (force-cursor-redisplay))
613 :selected (null bar-cursor)]
614 ["Bar cursor (1 pixel)"
616 (customize-set-variable 'bar-cursor t)
617 (force-cursor-redisplay))
619 :selected (eq bar-cursor t)]
620 ["Bar cursor (2 pixels)"
622 (customize-set-variable 'bar-cursor 2)
623 (force-cursor-redisplay))
625 :selected (and bar-cursor (not (eq bar-cursor t)))]
629 (customize-set-variable 'line-number-mode (not line-number-mode))
631 :style toggle :selected line-number-mode]
634 (customize-set-variable 'column-number-mode
635 (not column-number-mode))
637 :style toggle :selected column-number-mode]
639 ("Menubar Appearance"
640 ["Buffers Menu Length..."
641 (customize-set-variable
642 'buffers-menu-max-size
643 ;; would it be better to open a customization buffer ?
646 "Enter number of buffers to display (or 0 for unlimited): ")))
647 (if (eq val 0) nil val)))]
648 ["Multi-Operation Buffers Sub-Menus"
649 (customize-set-variable 'complex-buffers-menu-p
650 (not complex-buffers-menu-p))
652 :selected complex-buffers-menu-p]
653 ("Buffers Menu Sorting"
654 ["Most Recently Used"
656 (customize-set-variable 'buffers-menu-sort-function nil)
657 (customize-set-variable 'buffers-menu-grouping-function nil))
659 :selected (null buffers-menu-sort-function)]
662 (customize-set-variable 'buffers-menu-sort-function
663 'sort-buffers-menu-alphabetically)
664 (customize-set-variable 'buffers-menu-grouping-function nil))
666 :selected (eq 'sort-buffers-menu-alphabetically
667 buffers-menu-sort-function)]
668 ["By Major Mode, Then Alphabetically"
670 (customize-set-variable
671 'buffers-menu-sort-function
672 'sort-buffers-menu-by-mode-then-alphabetically)
673 (customize-set-variable
674 'buffers-menu-grouping-function
675 'group-buffers-menu-by-mode-then-alphabetically))
677 :selected (eq 'sort-buffers-menu-by-mode-then-alphabetically
678 buffers-menu-sort-function)])
679 ["Submenus for Buffer Groups"
680 (customize-set-variable 'buffers-menu-submenus-for-groups-p
681 (not buffers-menu-submenus-for-groups-p))
683 :selected buffers-menu-submenus-for-groups-p]
685 ["Ignore Scaled Fonts"
686 (customize-set-variable 'font-menu-ignore-scaled-fonts
687 (not font-menu-ignore-scaled-fonts))
689 :selected (and (boundp 'font-menu-ignore-scaled-fonts)
690 font-menu-ignore-scaled-fonts)]
692 ,@(if (featurep 'toolbar)
693 '(("Toolbar Appearance"
695 (customize-set-variable 'toolbar-visible-p
696 (not toolbar-visible-p))
698 :selected toolbar-visible-p]
700 (customize-set-variable 'toolbar-captioned-p
701 (not toolbar-captioned-p))
703 :selected toolbar-captioned-p]
706 (customize-set-variable 'default-toolbar-position 'top)
708 :selected (eq default-toolbar-position 'top)]
710 (customize-set-variable 'default-toolbar-position 'bottom)
712 :selected (eq default-toolbar-position 'bottom)]
714 (customize-set-variable 'default-toolbar-position 'left)
716 :selected (eq default-toolbar-position 'left)]
718 (customize-set-variable 'default-toolbar-position 'right)
720 :selected (eq default-toolbar-position 'right)]
725 (customize-set-variable 'mouse-avoidance-mode
726 (if mouse-avoidance-mode nil 'banish))
728 :selected (and (boundp 'mouse-avoidance-mode) mouse-avoidance-mode)
729 :active (and (boundp 'mouse-avoidance-mode)
730 (device-on-window-system-p))]
732 (customize-set-variable 'strokes-mode (not strokes-mode))
734 :selected (and (boundp 'strokes-mode) strokes-mode)
735 :active (and (boundp 'strokes-mode)
736 (device-on-window-system-p))]
740 (customize-set-variable 'browse-url-browser-function 'browse-url-w3)
742 :selected (and (boundp 'browse-url-browser-function)
743 (eq browse-url-browser-function 'browse-url-w3))
744 :active (and (boundp 'browse-url-browser-function)
745 (fboundp 'browse-url-w3)
746 (fboundp 'w3-fetch))]
748 (customize-set-variable 'browse-url-browser-function
749 'browse-url-netscape)
751 :selected (and (boundp 'browse-url-browser-function)
752 (eq browse-url-browser-function 'browse-url-netscape))
753 :active (and (boundp 'browse-url-browser-function)
754 (fboundp 'browse-url-netscape))]
756 (customize-set-variable 'browse-url-browser-function
759 :selected (and (boundp 'browse-url-browser-function)
760 (eq browse-url-browser-function 'browse-url-mosaic))
761 :active (and (boundp 'browse-url-browser-function)
762 (fboundp 'browse-url-mosaic))]
764 (customize-set-variable 'browse-url-browser-function 'browse-url-cci)
766 :selected (and (boundp 'browse-url-browser-function)
767 (eq browse-url-browser-function 'browse-url-cci))
768 :active (and (boundp 'browse-url-browser-function)
769 (fboundp 'browse-url-cci))]
771 (customize-set-variable 'browse-url-browser-function
772 'browse-url-iximosaic)
774 :selected (and (boundp 'browse-url-browser-function)
775 (eq browse-url-browser-function 'browse-url-iximosaic))
776 :active (and (boundp 'browse-url-browser-function)
777 (fboundp 'browse-url-iximosaic))]
779 (customize-set-variable 'browse-url-browser-function
780 'browse-url-lynx-xterm)
782 :selected (and (boundp 'browse-url-browser-function)
783 (eq browse-url-browser-function 'browse-url-lynx-xterm))
784 :active (and (boundp 'browse-url-browser-function)
785 (fboundp 'browse-url-lynx-xterm))]
787 (customize-set-variable 'browse-url-browser-function
788 'browse-url-lynx-emacs)
790 :selected (and (boundp 'browse-url-browser-function)
791 (eq browse-url-browser-function 'browse-url-lynx-emacs))
792 :active (and (boundp 'browse-url-browser-function)
793 (fboundp 'browse-url-lynx-emacs))]
795 (customize-set-variable 'browse-url-browser-function
798 :selected (and (boundp 'browse-url-browser-function)
799 (eq browse-url-browser-function 'browse-url-grail))
800 :active (and (boundp 'browse-url-browser-function)
801 (fboundp 'browse-url-grail))]
804 ["Edit Faces..." (customize-face nil)]
805 ("Font" :filter font-menu-family-constructor)
806 ("Size" :filter font-menu-size-constructor)
807 ; ("Weight" :filter font-menu-weight-constructor)
809 ["Save Options" customize-save-customized]
813 :filter buffers-menu-filter
814 ["Read Only" (toggle-read-only)
815 :style toggle :selected buffer-read-only]
816 ["List All Buffers" list-buffers]
822 :active (fboundp 'grep)]
823 ["Compile..." compile
824 :active (fboundp 'compile)]
826 :active (fboundp 'shell)]
827 ["Shell Command..." shell-command
828 :active (fboundp 'shell-command)]
829 ["Shell Command on Region..." shell-command-on-region
830 :active (and (fboundp 'shell-command-on-region) (region-exists-p))]
831 ["Debug (GDB)..." gdb
832 :active (fboundp 'gdb)]
833 ["Debug (DBX)..." dbx
834 :active (fboundp 'dbx)]
837 ["Find Tag..." find-tag]
838 ["Find Other Window..." find-tag-other-window]
839 ["Next Tag..." (find-tag nil)]
840 ["Next Other Window..." (find-tag-other-window nil)]
841 ["Next File" next-file]
843 ["Tags Search..." tags-search]
844 ["Tags Replace..." tags-query-replace]
845 ["Continue Search/Replace" tags-loop-continue]
847 ["Pop stack" pop-tag-mark]
848 ["Apropos..." tags-apropos]
850 ["Set Tags Table File..." visit-tags-table]
853 nil ; the partition: menus after this are flushright
856 ["About XEmacs..." about-xemacs]
858 ["Installation" describe-installation
859 :active (boundp 'Installation-string)]
861 ,(if (featurep 'mule)
863 (let ((lang language-info-alist)
866 (and (setq tut (assq 'tutorial (car lang)))
867 (not (string= (caar lang) "ASCII"))
871 `[,(caar lang) (help-with-tutorial nil ,(cdr tut))]
873 (setq lang (cdr lang)))
874 (append `("Tutorials"
875 :filter tutorials-menu-filter
876 ["Default" help-with-tutorial t
877 ,(concat "(" current-language-environment ")")])
879 ;; Non mule tutorials.
880 (let ((lang tutorial-supported-languages)
886 (help-with-tutorial ,(format "TUTORIAL.%s"
889 (setq lang (cdr lang)))
890 (append '("Tutorials"
891 ["English" help-with-tutorial])
893 ["News" view-emacs-news]
894 ["Packages" finder-by-keyword]
895 ["Splash" xemacs-splash-buffer])
898 ["FAQ (local)" xemacs-local-faq]
899 ["FAQ via WWW" xemacs-www-faq (boundp 'browse-url-browser-function)]
900 ["Home Page" xemacs-www-page (boundp 'browse-url-browser-function)])
902 ["Sample .emacs" (find-file (locate-data-file "sample.emacs")) (locate-data-file "sample.emacs")]
903 ["Sample .Xdefaults" (find-file (locate-data-file "sample.Xdefaults")) (locate-data-file "sample.Xdefaults")]
904 ["Sample enriched" (find-file (locate-data-file "enriched.doc")) (locate-data-file "enriched.doc")])
907 ["Key Binding..." Info-goto-emacs-key-command-node]
908 ["Command..." Info-goto-emacs-command-node]
909 ["Function..." Info-elisp-ref]
910 ["Topic..." Info-query])
913 ["Unix Manual..." manual-entry])
915 ["Mode" describe-mode]
916 ["Apropos..." hyper-apropos]
917 ["Apropos Docs..." apropos-documentation]
919 ["Key..." describe-key]
920 ["Bindings" describe-bindings]
921 ["Mouse Bindings" describe-pointer]
922 ["Recent Keys" view-lossage]
924 ["Function..." describe-function]
925 ["Variable..." describe-variable]
926 ["Locate Command..." where-is])
928 ["Recent Messages" view-lossage]
930 ["No Warranty" describe-no-warranty]
931 ["XEmacs License" describe-copying]
932 ["The Latest Version" describe-distribution])
933 ["Send Bug Report..." report-emacs-bug]))))
936 (defun maybe-add-init-button ()
938 Adds `Load .emacs' button to menubar when starting up with -q."
939 ;; by Stig@hackvan.com
942 ((file-exists-p (expand-file-name ".emacs" "~"))
945 (progn (delete-menu-item '("Load .emacs"))
946 (load-user-init-file (user-login-name)))
951 (add-hook 'before-init-hook 'maybe-add-init-button)
956 (defvar put-buffer-names-in-file-menu t)
959 ;;; The Bookmarks menu
961 (defun bookmark-menu-filter (&rest ignore)
962 (let ((definedp (and (boundp 'bookmark-alist)
967 :filter (lambda (&rest junk)
968 (mapcar #'(lambda (bmk)
969 `[,bmk (bookmark-jump ',bmk)])
970 (bookmark-all-names))))
971 ["Jump to Bookmark" nil nil])
972 ["Set bookmark" bookmark-set
973 :active (fboundp 'bookmark-set)]
975 ["Insert contents" bookmark-menu-insert
976 :active (fboundp 'bookmark-menu-insert)]
977 ["Insert location" bookmark-menu-locate
978 :active (fboundp 'bookmark-menu-locate)]
980 ["Rename bookmark" bookmark-menu-rename
981 :active (fboundp 'bookmark-menu-rename)]
984 :filter (lambda (&rest junk)
985 (mapcar #'(lambda (bmk)
986 `[,bmk (bookmark-delete ',bmk)])
987 (bookmark-all-names))))
988 ["Delete Bookmark" nil nil])
989 ["Edit Bookmark List" bookmark-bmenu-list ,definedp]
991 ["Save bookmarks" bookmark-save ,definedp]
992 ["Save bookmarks as..." bookmark-write ,definedp]
993 ["Load a bookmark file" bookmark-load
994 :active (fboundp 'bookmark-load)])))
998 (defgroup buffers-menu nil
999 "Customization of `Buffers' menu."
1002 (defcustom buffers-menu-max-size 25
1003 "*Maximum number of entries which may appear on the \"Buffers\" menu.
1004 If this is 10, then only the ten most-recently-selected buffers will be
1005 shown. If this is nil, then all buffers will be shown. Setting this to
1006 a large number or nil will slow down menu responsiveness."
1007 :type '(choice (const :tag "Show all" nil)
1009 :group 'buffers-menu)
1011 (defcustom complex-buffers-menu-p nil
1012 "*If non-nil, the buffers menu will contain several commands.
1013 Commands will be presented as submenus of each buffer line. If this
1014 is false, then there will be only one command: select that buffer."
1016 :group 'buffers-menu)
1018 (defcustom buffers-menu-submenus-for-groups-p nil
1019 "*If non-nil, the buffers menu will contain one submenu per group of buffers.
1020 The grouping function is specified in `buffers-menu-grouping-function'.
1021 If this is an integer, do not build submenus if the number of buffers
1022 is not larger than this value."
1023 :type '(choice (const :tag "No Subgroups" nil)
1024 (integer :tag "Max. submenus" 10)
1025 (sexp :format "%t\n" :tag "Allow Subgroups" :value t))
1026 :group 'buffers-menu)
1028 (defcustom buffers-menu-switch-to-buffer-function 'switch-to-buffer
1029 "*The function to call to select a buffer from the buffers menu.
1030 `switch-to-buffer' is a good choice, as is `pop-to-buffer'."
1031 :type '(radio (function-item switch-to-buffer)
1032 (function-item pop-to-buffer)
1033 (function :tag "Other"))
1034 :group 'buffers-menu)
1036 (defcustom buffers-menu-omit-function 'buffers-menu-omit-invisible-buffers
1037 "*If non-nil, a function specifying the buffers to omit from the buffers menu.
1038 This is passed a buffer and should return non-nil if the buffer should be
1039 omitted. The default value `buffers-menu-omit-invisible-buffers' omits
1040 buffers that are normally considered \"invisible\" (those whose name
1041 begins with a space)."
1042 :type '(choice (const :tag "None" nil)
1044 :group 'buffers-menu)
1046 (defcustom buffers-menu-format-buffer-line-function 'format-buffers-menu-line
1047 "*The function to call to return a string to represent a buffer in the
1048 buffers menu. The function is passed a buffer and should return a string.
1049 The default value `format-buffers-menu-line' just returns the name of
1050 the buffer. Also check out `slow-format-buffers-menu-line' which
1051 returns a whole bunch of info about a buffer."
1053 :group 'buffers-menu)
1055 (defcustom buffers-menu-sort-function
1056 'sort-buffers-menu-by-mode-then-alphabetically
1057 "*If non-nil, a function to sort the list of buffers in the buffers menu.
1058 It will be passed two arguments (two buffers to compare) and should return
1059 T if the first is \"less\" than the second. One possible value is
1060 `sort-buffers-menu-alphabetically'; another is
1061 `sort-buffers-menu-by-mode-then-alphabetically'."
1062 :type '(choice (const :tag "None" nil)
1064 :group 'buffers-menu)
1066 (defcustom buffers-menu-grouping-function
1067 'group-buffers-menu-by-mode-then-alphabetically
1068 "*If non-nil, a function to group buffers in the buffers menu together.
1069 It will be passed two arguments, successive members of the sorted buffers
1070 list after being passed through `buffers-menu-sort-function'. It should
1071 return non-nil if the second buffer begins a new group. The return value
1072 should be the name of the old group, which may be used in hierarchical
1073 buffers menus. The last invocation of the function contains nil as the
1074 second argument, so that the name of the last group can be determined.
1076 The sensible values of this function are dependent on the value specified
1077 for `buffers-menu-sort-function'."
1078 :type '(choice (const :tag "None" nil)
1080 :group 'buffers-menu)
1082 (defun buffers-menu-omit-invisible-buffers (buf)
1083 "For use as a value of `buffers-menu-omit-function'.
1084 Omits normally invisible buffers (those whose name begins with a space)."
1085 (not (null (string-match "\\` " (buffer-name buf)))))
1087 (defun sort-buffers-menu-alphabetically (buf1 buf2)
1088 "For use as a value of `buffers-menu-sort-function'.
1089 Sorts the buffers in alphabetical order by name, but puts buffers beginning
1090 with a star at the end of the list."
1091 (let* ((nam1 (buffer-name buf1))
1092 (nam2 (buffer-name buf2))
1093 (star1p (not (null (string-match "\\`*" nam1))))
1094 (star2p (not (null (string-match "\\`*" nam2)))))
1095 (if (not (eq star1p star2p))
1097 (string-lessp nam1 nam2))))
1099 (defun sort-buffers-menu-by-mode-then-alphabetically (buf1 buf2)
1100 "For use as a value of `buffers-menu-sort-function'.
1101 Sorts first by major mode and then alphabetically by name, but puts buffers
1102 beginning with a star at the end of the list."
1103 (let* ((nam1 (buffer-name buf1))
1104 (nam2 (buffer-name buf2))
1105 (star1p (not (null (string-match "\\`*" nam1))))
1106 (star2p (not (null (string-match "\\`*" nam2))))
1107 (mode1 (symbol-value-in-buffer 'major-mode buf1))
1108 (mode2 (symbol-value-in-buffer 'major-mode buf2)))
1109 (cond ((not (eq star1p star2p)) (not star1p))
1110 ((and star1p star2p (string-lessp nam1 nam2)))
1111 ((string-lessp mode1 mode2) t)
1112 ((string-lessp mode2 mode1) nil)
1113 (t (string-lessp nam1 nam2)))))
1115 ;; this version is too slow on some machines.
1116 (defun slow-format-buffers-menu-line (buffer)
1117 "For use as a value of `buffers-menu-format-buffer-line-function'.
1118 This returns a string containing a bunch of info about the buffer."
1119 (format "%s%s %-19s %6s %-15s %s"
1120 (if (buffer-modified-p buffer) "*" " ")
1121 (if (symbol-value-in-buffer 'buffer-read-only buffer) "%" " ")
1122 (buffer-name buffer)
1123 (buffer-size buffer)
1124 (symbol-value-in-buffer 'mode-name buffer)
1125 (or (buffer-file-name buffer) "")))
1127 (defun format-buffers-menu-line (buffer)
1128 "For use as a value of `buffers-menu-format-buffer-line-function'.
1129 This just returns the buffer's name."
1130 (buffer-name buffer))
1132 (defun group-buffers-menu-by-mode-then-alphabetically (buf1 buf2)
1133 "For use as a value of `buffers-menu-grouping-function'.
1134 This groups buffers by major mode. It only really makes sense if
1135 `buffers-menu-sorting-function' is
1136 `sort-buffers-menu-by-mode-then-alphabetically'."
1137 (cond ((string-match "\\`*" (buffer-name buf1))
1138 (and (null buf2) "*Misc*"))
1140 (string-match "\\`*" (buffer-name buf2))
1141 (not (eq (symbol-value-in-buffer 'major-mode buf1)
1142 (symbol-value-in-buffer 'major-mode buf2))))
1143 (symbol-value-in-buffer 'mode-name buf1))
1146 (defun buffer-menu-save-buffer (buffer)
1151 (defun buffer-menu-write-file (buffer)
1154 (write-file (read-file-name
1155 (format "Write %s to file: "
1156 (buffer-name (current-buffer)))))))
1158 (defsubst build-buffers-menu-internal (buffers)
1164 (setq line (funcall buffers-menu-format-buffer-line-function
1166 (if complex-buffers-menu-p
1169 (vector "Switch to Buffer"
1170 (list buffers-menu-switch-to-buffer-function
1171 (setq name (buffer-name buffer)))
1173 (if (eq buffers-menu-switch-to-buffer-function
1175 (vector "Switch to Buffer, Other Frame"
1176 (list 'switch-to-buffer-other-frame
1177 (setq name (buffer-name buffer)))
1180 (if (and (buffer-modified-p buffer)
1181 (buffer-file-name buffer))
1182 (vector "Save Buffer"
1183 (list 'buffer-menu-save-buffer name) t)
1184 ["Save Buffer" nil nil]
1186 (vector "Save As..."
1187 (list 'buffer-menu-write-file name) t)
1188 (vector "Delete Buffer" (list 'kill-buffer name)
1190 ;; ### We don't want buffer names to be translated,
1191 ;; ### so we put the buffer name in the suffix.
1192 ;; ### Also, avoid losing with non-ASCII buffer names.
1193 ;; ### We still lose, however, if complex-buffers-menu-p. --mrb
1195 (list buffers-menu-switch-to-buffer-function
1196 (buffer-name buffer))
1200 (defun buffers-menu-filter (menu)
1201 "This is the menu filter for the top-level buffers \"Buffers\" menu.
1202 It dynamically creates a list of buffers to use as the contents of the menu.
1203 Only the most-recently-used few buffers will be listed on the menu, for
1204 efficiency reasons. You can control how many buffers will be shown by
1205 setting `buffers-menu-max-size'. You can control the text of the menu
1206 items by redefining the function `format-buffers-menu-line'."
1207 (let ((buffers (delete-if buffers-menu-omit-function (buffer-list))))
1208 (and (integerp buffers-menu-max-size)
1209 (> buffers-menu-max-size 1)
1210 (> (length buffers) buffers-menu-max-size)
1211 ;; shorten list of buffers (not with submenus!)
1212 (not (and buffers-menu-grouping-function
1213 buffers-menu-submenus-for-groups-p))
1214 (setcdr (nthcdr buffers-menu-max-size buffers) nil))
1215 (if buffers-menu-sort-function
1216 (setq buffers (sort buffers buffers-menu-sort-function)))
1217 (if (and buffers-menu-grouping-function
1218 buffers-menu-submenus-for-groups-p
1219 (or (not (integerp buffers-menu-submenus-for-groups-p))
1220 (> (length buffers) buffers-menu-submenus-for-groups-p)))
1221 (let (groups groupnames current-group)
1224 (let ((groupname (funcall buffers-menu-grouping-function
1225 (car sublist) (cadr sublist))))
1226 (setq current-group (cons (car sublist) current-group))
1229 (setq groups (cons (nreverse current-group)
1231 (setq groupnames (cons groupname groupnames))
1232 (setq current-group nil)))))
1236 #'(lambda (groupname group)
1237 (cons groupname (build-buffers-menu-internal group)))
1238 (nreverse groupnames)
1239 (nreverse groups))))
1240 (if buffers-menu-grouping-function
1245 (cond ((funcall buffers-menu-grouping-function
1246 (car sublist) (cadr sublist))
1247 (list (car sublist) t))
1248 (t (list (car sublist)))))
1250 ;; remove a trailing separator.
1251 (and (>= (length buffers) 2)
1252 (let ((lastcdr (nthcdr (- (length buffers) 2) buffers)))
1253 (if (eq t (cadr lastcdr))
1254 (setcdr lastcdr nil))))))
1255 (setq buffers (build-buffers-menu-internal buffers)))
1256 (append menu buffers)
1259 (defun language-environment-menu-filter (menu)
1260 "This is the menu filter for the \"Language Environment\" submenu."
1261 (mapcar (lambda (env-sym)
1262 `[ ,(capitalize (symbol-name env-sym))
1263 (set-language-environment ',env-sym)])
1264 language-environment-list))
1267 ;;; The Options menu
1269 ;; We'll keep those variables here for a while, in order to provide a
1270 ;; function for porting the old options file that a user may own to Custom.
1272 (defvar options-save-faces nil
1273 "*Non-nil value means save-options will save information about faces.
1274 A nil value means save-options will not save face information.
1275 Set this non-nil only if you use M-x edit-faces to change face
1276 settings. If you use M-x customize-face or the \"Browse Faces...\"
1277 menu entry, you will see a button in the Customize Face buffer that you
1278 can use to permanently save your face changes.
1280 M-x edit-faces is deprecated. Support for it and this variable will
1281 be discontinued in a future release.")
1283 (defvar save-options-init-file nil
1284 "File into which to save forms to load the options file (nil for .emacs).
1285 Normally this is nil, which means save into your .emacs file (the value
1286 of `user-init-file'.")
1288 (defvar save-options-file ".xemacs-options"
1289 "File to save options into.
1290 This file is loaded from your .emacs file.
1291 If this is a relative filename, it is put into the same directory as your
1298 (if (featurep 'mule)
1299 (defun tutorials-menu-filter (menu-items)
1300 ;; If there's a tutorial for the current language environment, make it
1301 ;; appear first as the default one. Otherwise, use the english one.
1302 (let* ((menu menu-items)
1303 (item (pop menu-items)))
1309 (assoc current-language-environment language-info-alist))
1310 current-language-environment
1316 (set-menubar default-menubar)
1321 (defconst default-popup-menu
1323 ["Undo" advertised-undo
1324 :active (and (not (eq buffer-undo-list t))
1325 (or buffer-undo-list pending-undo-list))
1326 :suffix (if (or (eq last-command 'undo)
1327 (eq last-command 'advertised-undo))
1329 ["Cut" kill-primary-selection
1330 :active (selection-owner-p)]
1331 ["Copy" copy-primary-selection
1332 :active (selection-owner-p)]
1333 ["Paste" yank-clipboard-selection
1334 :active (selection-exists-p 'CLIPBOARD)]
1335 ["Clear" delete-primary-selection
1336 :active (selection-owner-p)]
1338 ["Select Block" mark-paragraph]
1339 ["Split Window" split-window-vertically]
1340 ["Unsplit Window" delete-other-windows]
1343 (defvar global-popup-menu nil
1344 "The global popup menu. This is present in all modes.
1345 See the function `popup-menu' for a description of menu syntax.")
1347 (defvar mode-popup-menu nil
1348 "The mode-specific popup menu. Automatically buffer local.
1349 This is appended to the default items in `global-popup-menu'.
1350 See the function `popup-menu' for a description of menu syntax.")
1351 (make-variable-buffer-local 'mode-popup-menu)
1353 ;; In an effort to avoid massive menu clutter, this mostly worthless menu is
1354 ;; superceded by any local popup menu...
1355 (setq-default mode-popup-menu default-popup-menu)
1357 (defvar activate-popup-menu-hook nil
1358 "Function or functions run before a mode-specific popup menu is made visible.
1359 These functions are called with no arguments, and should interrogate and
1360 modify the value of `global-popup-menu' or `mode-popup-menu' as desired.
1361 Note: this hook is only run if you use `popup-mode-menu' for activating the
1362 global and mode-specific commands; if you have your own binding for button3,
1363 this hook won't be run.")
1365 (defun popup-mode-menu ()
1366 "Pop up a menu of global and mode-specific commands.
1367 The menu is computed by combining `global-popup-menu' and `mode-popup-menu'."
1369 (run-hooks 'activate-popup-menu-hook)
1371 (cond ((and global-popup-menu mode-popup-menu)
1372 ;; Merge global-popup-menu and mode-popup-menu
1373 (check-menu-syntax mode-popup-menu)
1374 (let* ((title (car mode-popup-menu))
1375 (items (cdr mode-popup-menu))
1377 ;; Strip keywords from local menu for attaching them at the top
1379 (keywordp (car items)))
1380 ;; Push both keyword and its argument.
1381 (push (pop items) mode-filters)
1382 (push (pop items) mode-filters))
1383 (setq mode-filters (nreverse mode-filters))
1384 ;; If mode-filters contains a keyword already present in
1385 ;; `global-popup-menu', you will probably lose.
1386 (append (list (car global-popup-menu))
1388 (cdr global-popup-menu)
1390 (if popup-menu-titles (list title))
1391 (if popup-menu-titles '("---" "---"))
1396 (error "No menu defined in this buffer"))))))
1398 (defun popup-buffer-menu (event)
1399 "Pop up a copy of the Buffers menu (from the menubar) where the mouse is clicked."
1401 (let ((window (and (event-over-text-area-p event) (event-window event)))
1404 (error "Pointer must be in a normal window"))
1405 (select-window window)
1407 (setq bmenu (assoc "Buffers" current-menubar)))
1409 (setq bmenu (assoc "Buffers" default-menubar)))
1411 (error "Can't find the Buffers menu"))
1412 (popup-menu bmenu)))
1414 (defun popup-menubar-menu (event)
1415 "Pop up a copy of menu that also appears in the menubar"
1416 ;; by Stig@hackvan.com
1418 (let ((window (and (event-over-text-area-p event) (event-window event)))
1421 (error "Pointer must be in a normal window"))
1422 (select-window window)
1423 (and current-menubar (run-hooks 'activate-menubar-hook))
1424 ;; ##### Instead of having to copy this just to safely get rid of
1425 ;; any nil what we should really do is fix up the internal menubar
1426 ;; code to just ignore nil if generating a popup menu
1427 (setq popup-menubar (delete nil (copy-sequence (or current-menubar
1429 (popup-menu (cons "Menubar Menu" popup-menubar))
1432 (global-set-key 'button3 'popup-mode-menu)
1433 ;; shift button3 and shift button2 are reserved for Hyperbole
1434 (global-set-key '(meta control button3) 'popup-buffer-menu)
1435 ;; The following command is way too dangerous with Custom.
1436 ;; (global-set-key '(meta shift button3) 'popup-menubar-menu)
1438 ;; Here's a test of the cool new menu features (from Stig).
1440 ;;(setq mode-popup-menu
1441 ;; '("Test Popup Menu"
1443 ;; ["this item won't appear because of the menu filter" ding t]
1448 ;; "--:singleDashedLine"
1449 ;; "singleDashedLine"
1450 ;; "--:doubleDashedLine"
1451 ;; "doubleDashedLine"
1454 ;; "--:shadowEtchedIn"
1456 ;; "--:shadowEtchedOut"
1457 ;; "shadowEtchedOut"
1458 ;; "--:shadowDoubleEtchedIn"
1459 ;; "shadowDoubleEtchedIn"
1460 ;; "--:shadowDoubleEtchedOut"
1461 ;; "shadowDoubleEtchedOut"
1462 ;; "--:shadowEtchedInDash"
1463 ;; "shadowEtchedInDash"
1464 ;; "--:shadowEtchedOutDash"
1465 ;; "shadowEtchedOutDash"
1466 ;; "--:shadowDoubleEtchedInDash"
1467 ;; "shadowDoubleEtchedInDash"
1468 ;; "--:shadowDoubleEtchedOutDash"
1469 ;; "shadowDoubleEtchedOutDash"
1472 (defun xemacs-splash-buffer ()
1473 "Redisplay XEmacs splash screen in a buffer."
1475 (let ((buffer (get-buffer-create "*Splash*")))
1477 (erase-buffer buffer)
1478 (startup-splash-frame)
1479 (pop-to-buffer buffer)
1480 (delete-other-windows)))
1483 ;;; backwards compatibility
1484 (provide 'x-menubar)
1485 (provide 'menubar-items)
1487 ;;; x-menubar.el ends here.