1 ;;; menu-bar.el --- define a default menu bar
3 ;; Copyright (C) 1993, 1994, 1995, 2000, 2001, 2002, 2003, 2004,
4 ;; 2005, 2006 Free Software Foundation, Inc.
8 ;; Keywords: internal, mouse
10 ;; This file is part of GNU Emacs.
12 ;; GNU Emacs is free software; you can redistribute it and/or modify
13 ;; it under the terms of the GNU General Public License as published by
14 ;; the Free Software Foundation; either version 2, or (at your option)
17 ;; GNU Emacs is distributed in the hope that it will be useful,
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ;; GNU General Public License for more details.
22 ;; You should have received a copy of the GNU General Public License
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the
24 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
25 ;; Boston, MA 02110-1301, USA.
27 ;; Avishai Yacobi suggested some menu rearrangements.
35 (defcustom buffers-menu-max-size
10
36 "*Maximum number of entries which may appear on the Buffers menu.
37 If this is 10, then only the ten most-recently-selected buffers are shown.
38 If this is nil, then all buffers are shown.
39 A large number or nil slows down menu responsiveness."
40 :type
'(choice integer
41 (const :tag
"All" nil
))
44 ;; Don't clobber an existing menu-bar keymap, to preserve any menu-bar key
45 ;; definitions made in loaddefs.el.
46 (or (lookup-key global-map
[menu-bar
])
47 (define-key global-map
[menu-bar
] (make-sparse-keymap "menu-bar")))
48 (defvar menu-bar-help-menu
(make-sparse-keymap "Help"))
50 ;; Force Help item to come last, after the major mode's own items.
51 ;; The symbol used to be called `help', but that gets confused with the
53 (setq menu-bar-final-items
'(help-menu))
55 (define-key global-map
[menu-bar help-menu
] (cons "Help" menu-bar-help-menu
))
56 (defvar menu-bar-tools-menu
(make-sparse-keymap "Tools"))
57 (define-key global-map
[menu-bar tools
] (cons "Tools" menu-bar-tools-menu
))
58 ;; This definition is just to show what this looks like.
59 ;; It gets overridden below when menu-bar-update-buffers is called.
60 (define-key global-map
[menu-bar buffer
]
61 (cons "Buffers" (make-sparse-keymap "Buffers")))
62 (defvar menu-bar-options-menu
(make-sparse-keymap "Options"))
63 (define-key global-map
[menu-bar options
]
64 (cons "Options" menu-bar-options-menu
))
65 (defvar menu-bar-edit-menu
(make-sparse-keymap "Edit"))
66 (define-key global-map
[menu-bar edit
] (cons "Edit" menu-bar-edit-menu
))
67 (defvar menu-bar-file-menu
(make-sparse-keymap "File"))
68 (define-key global-map
[menu-bar file
] (cons "File" menu-bar-file-menu
))
70 ;; This alias is for compatibility with 19.28 and before.
71 (defvar menu-bar-files-menu menu-bar-file-menu
)
73 ;; This is referenced by some code below; it is defined in uniquify.el
74 (defvar uniquify-buffer-name-style
)
77 ;; The "File" menu items
78 (define-key menu-bar-file-menu
[exit-emacs
]
79 '(menu-item "Exit Emacs" save-buffers-kill-emacs
80 :help
"Save unsaved buffers, then exit"))
82 (define-key menu-bar-file-menu
[separator-exit
]
85 ;; Don't use delete-frame as event name because that is a special
87 (define-key menu-bar-file-menu
[delete-this-frame
]
88 '(menu-item "Delete Frame" delete-frame
89 :visible
(fboundp 'delete-frame
)
90 :enable
(delete-frame-enabled-p)
91 :help
"Delete currently selected frame"))
92 (define-key menu-bar-file-menu
[make-frame-on-display
]
93 '(menu-item "New Frame on Display..." make-frame-on-display
94 :visible
(fboundp 'make-frame-on-display
)
95 :help
"Open a new frame on another display"))
96 (define-key menu-bar-file-menu
[make-frame
]
97 '(menu-item "New Frame" make-frame-command
98 :visible
(fboundp 'make-frame-command
)
99 :help
"Open a new frame"))
101 (define-key menu-bar-file-menu
[one-window
]
102 '(menu-item "Remove Splits" delete-other-windows
103 :enable
(not (one-window-p t nil
))
104 :help
"Selected window grows to fill the whole frame"))
106 (define-key menu-bar-file-menu
[split-window
]
107 '(menu-item "Split Window" split-window-vertically
108 :enable
(and (menu-bar-menu-frame-live-and-visible-p)
109 (menu-bar-non-minibuffer-window-p))
110 :help
"Split selected window in two windows"))
112 (define-key menu-bar-file-menu
[separator-window
]
115 (define-key menu-bar-file-menu
[ps-print-region
]
116 '(menu-item "Postscript Print Region (B+W)" ps-print-region
118 :help
"Pretty-print marked region in black and white to PostScript printer"))
119 (define-key menu-bar-file-menu
[ps-print-buffer
]
120 '(menu-item "Postscript Print Buffer (B+W)" ps-print-buffer
121 :enable
(menu-bar-menu-frame-live-and-visible-p)
122 :help
"Pretty-print current buffer in black and white to PostScript printer"))
123 (define-key menu-bar-file-menu
[ps-print-region-faces
]
124 '(menu-item "Postscript Print Region" ps-print-region-with-faces
126 :help
"Pretty-print marked region to PostScript printer"))
127 (define-key menu-bar-file-menu
[ps-print-buffer-faces
]
128 '(menu-item "Postscript Print Buffer" ps-print-buffer-with-faces
129 :enable
(menu-bar-menu-frame-live-and-visible-p)
130 :help
"Pretty-print current buffer to PostScript printer"))
131 (define-key menu-bar-file-menu
[print-region
]
132 '(menu-item "Print Region" print-region
134 :help
"Print region between mark and current position"))
135 (define-key menu-bar-file-menu
[print-buffer
]
136 '(menu-item "Print Buffer" print-buffer
137 :enable
(menu-bar-menu-frame-live-and-visible-p)
138 :help
"Print current buffer with page headings"))
140 (define-key menu-bar-file-menu
[separator-print
]
143 (define-key menu-bar-file-menu
[recover-session
]
144 '(menu-item "Recover Crashed Session" recover-session
145 :enable
(and auto-save-list-file-prefix
147 (file-name-directory auto-save-list-file-prefix
))
149 (file-name-directory auto-save-list-file-prefix
)
153 (file-name-nondirectory
154 auto-save-list-file-prefix
)))
156 :help
"Recover edits from a crashed session"))
157 (define-key menu-bar-file-menu
[revert-buffer
]
158 '(menu-item "Revert Buffer" revert-buffer
159 :enable
(or revert-buffer-function
160 revert-buffer-insert-file-contents-function
161 (and buffer-file-number
162 (or (buffer-modified-p)
163 (not (verify-visited-file-modtime
164 (current-buffer))))))
165 :help
"Re-read current buffer from its file"))
166 (define-key menu-bar-file-menu
[write-file
]
167 '(menu-item "Save As..." write-file
168 :enable
(and (menu-bar-menu-frame-live-and-visible-p)
169 (menu-bar-non-minibuffer-window-p))
170 :help
"Write current buffer to another file"))
171 (define-key menu-bar-file-menu
[save-buffer
]
172 '(menu-item "Save" save-buffer
173 :enable
(and (buffer-modified-p)
175 (menu-bar-non-minibuffer-window-p))
176 :help
"Save current buffer to its file"))
178 (define-key menu-bar-file-menu
[separator-save
]
181 (defun menu-find-file-existing ()
182 "Edit the existing file FILENAME."
184 (let* ((mustmatch (not (and (fboundp 'x-uses-old-gtk-dialog
)
185 (x-uses-old-gtk-dialog))))
186 (filename (car (find-file-read-args "Find file: " mustmatch
))))
188 (find-file-existing filename
)
189 (find-file filename
))))
192 (define-key menu-bar-file-menu
[kill-buffer
]
193 '(menu-item "Close" kill-this-buffer
194 :enable
(kill-this-buffer-enabled-p)
195 :help
"Discard (kill) current buffer"))
196 (define-key menu-bar-file-menu
[insert-file
]
197 '(menu-item "Insert File..." insert-file
198 :enable
(menu-bar-non-minibuffer-window-p)
199 :help
"Insert another file into current buffer"))
200 (define-key menu-bar-file-menu
[dired]
201 '(menu-item "Open Directory..." dired
202 :enable (menu-bar-non-minibuffer-window-p)
203 :help "Read a directory, to operate on its files"))
204 (define-key menu-bar-file-menu [open-file]
205 '(menu-item "Open File..." menu-find-file-existing
206 :enable (menu-bar-non-minibuffer-window-p)
207 :help "Read an existing file into an Emacs buffer"))
208 (define-key menu-bar-file-menu [new-file]
209 '(menu-item "Visit New File..." find-file
210 :enable (menu-bar-non-minibuffer-window-p)
211 :help "Specify a new file's name, to edit the file"))
214 ;; The "Edit" menu items
216 ;; The "Edit->Search" submenu
217 (defvar menu-bar-last-search-type nil
218 "Type of last non-incremental search command called from the menu.")
220 (defun nonincremental-repeat-search-forward ()
221 "Search forward for the previous search string or regexp."
224 ((and (eq menu-bar-last-search-type 'string)
226 (search-forward (car search-ring)))
227 ((and (eq menu-bar-last-search-type 'regexp)
229 (re-search-forward (car regexp-search-ring)))
231 (error "No previous search"))))
233 (defun nonincremental-repeat-search-backward ()
234 "Search backward for the previous search string or regexp."
237 ((and (eq menu-bar-last-search-type 'string)
239 (search-backward (car search-ring)))
240 ((and (eq menu-bar-last-search-type 'regexp)
242 (re-search-backward (car regexp-search-ring)))
244 (error "No previous search"))))
246 (defun nonincremental-search-forward (string)
247 "Read a string and search for it nonincrementally."
248 (interactive "sSearch for string: ")
249 (setq menu-bar-last-search-type 'string)
250 (if (equal string "")
251 (search-forward (car search-ring))
252 (isearch-update-ring string nil)
253 (search-forward string)))
255 (defun nonincremental-search-backward (string)
256 "Read a string and search backward for it nonincrementally."
257 (interactive "sSearch for string: ")
258 (setq menu-bar-last-search-type 'string)
259 (if (equal string "")
260 (search-backward (car search-ring))
261 (isearch-update-ring string nil)
262 (search-backward string)))
264 (defun nonincremental-re-search-forward (string)
265 "Read a regular expression and search for it nonincrementally."
266 (interactive "sSearch for regexp: ")
267 (setq menu-bar-last-search-type 'regexp)
268 (if (equal string "")
269 (re-search-forward (car regexp-search-ring))
270 (isearch-update-ring string t)
271 (re-search-forward string)))
273 (defun nonincremental-re-search-backward (string)
274 "Read a regular expression and search backward for it nonincrementally."
275 (interactive "sSearch for regexp: ")
276 (setq menu-bar-last-search-type 'regexp)
277 (if (equal string "")
278 (re-search-backward (car regexp-search-ring))
279 (isearch-update-ring string t)
280 (re-search-backward string)))
282 (defvar menu-bar-search-menu (make-sparse-keymap "Search"))
284 ;; The Edit->Search->Incremental Search menu
285 (defvar menu-bar-i-search-menu
286 (make-sparse-keymap "Incremental Search"))
288 (define-key menu-bar-i-search-menu [isearch-backward-regexp]
289 '(menu-item "Backward Regexp..." isearch-backward-regexp
290 :help "Search backwards for a regular expression as you type it"))
291 (define-key menu-bar-i-search-menu [isearch-forward-regexp]
292 '(menu-item "Forward Regexp..." isearch-forward-regexp
293 :help "Search forward for a regular expression as you type it"))
294 (define-key menu-bar-i-search-menu [isearch-backward]
295 '(menu-item "Backward String..." isearch-backward
296 :help "Search backwards for a string as you type it"))
297 (define-key menu-bar-i-search-menu [isearch-forward]
298 '(menu-item "Forward String..." isearch-forward
299 :help "Search forward for a string as you type it"))
302 (define-key menu-bar-search-menu [i-search]
303 (list 'menu-item "Incremental Search" menu-bar-i-search-menu
304 :help "Incremental Search finds partial matches while you type the search string.\nIt is most convenient from the keyboard. Try it!"))
305 (define-key menu-bar-search-menu [separator-tag-isearch]
308 (define-key menu-bar-search-menu [tags-continue]
309 '(menu-item "Continue Tags Search" tags-loop-continue
310 :help "Continue last tags search operation"))
311 (define-key menu-bar-search-menu [tags-srch]
312 '(menu-item "Search tagged files..." tags-search
313 :help "Search for a regexp in all tagged files"))
314 (define-key menu-bar-search-menu [separator-tag-search]
317 (define-key menu-bar-search-menu [repeat-search-back]
318 '(menu-item "Repeat Backwards" nonincremental-repeat-search-backward
319 :enable (or (and (eq menu-bar-last-search-type 'string)
321 (and (eq menu-bar-last-search-type 'regexp)
323 :help "Repeat last search backwards"))
324 (define-key menu-bar-search-menu [repeat-search-fwd]
325 '(menu-item "Repeat Forward" nonincremental-repeat-search-forward
326 :enable (or (and (eq menu-bar-last-search-type 'string)
328 (and (eq menu-bar-last-search-type 'regexp)
330 :help "Repeat last search forward"))
331 (define-key menu-bar-search-menu [separator-repeat-search]
334 (define-key menu-bar-search-menu [re-search-backward]
335 '(menu-item "Regexp Backwards..." nonincremental-re-search-backward
336 :help "Search backwards for a regular expression"))
337 (define-key menu-bar-search-menu [re-search-forward]
338 '(menu-item "Regexp Forward..." nonincremental-re-search-forward
339 :help "Search forward for a regular expression"))
341 (define-key menu-bar-search-menu [search-backward]
342 '(menu-item "String Backwards..." nonincremental-search-backward
343 :help "Search backwards for a string"))
344 (define-key menu-bar-search-menu [search-forward]
345 '(menu-item "String Forward..." nonincremental-search-forward
346 :help "Search forward for a string"))
348 ;; The Edit->Replace submenu
350 (defvar menu-bar-replace-menu (make-sparse-keymap "Replace"))
352 (define-key menu-bar-replace-menu [tags-repl-continue]
353 '(menu-item "Continue Replace" tags-loop-continue
354 :help "Continue last tags replace operation"))
355 (define-key menu-bar-replace-menu [tags-repl]
356 '(menu-item "Replace in tagged files..." tags-query-replace
357 :help "Interactively replace a regexp in all tagged files"))
358 (define-key menu-bar-replace-menu [separator-replace-tags]
361 (define-key menu-bar-replace-menu [query-replace-regexp]
362 '(menu-item "Replace Regexp..." query-replace-regexp
363 :enable (not buffer-read-only)
364 :help "Replace regular expression interactively, ask about each occurrence"))
365 (define-key menu-bar-replace-menu [query-replace]
366 '(menu-item "Replace String..." query-replace
367 :enable (not buffer-read-only)
368 :help "Replace string interactively, ask about each occurrence"))
370 ;;; Assemble the top-level Edit menu items.
371 (define-key menu-bar-edit-menu [props]
372 '(menu-item "Text Properties" facemenu-menu
373 :help "Change properties of text in region"))
375 (define-key menu-bar-edit-menu [fill]
376 '(menu-item "Fill" fill-region
377 :enable (and mark-active (not buffer-read-only))
379 "Fill text in region to fit between left and right margin"))
381 (define-key menu-bar-edit-menu [separator-bookmark]
384 (define-key menu-bar-edit-menu [bookmark]
385 '(menu-item "Bookmarks" menu-bar-bookmark-map
386 :help "Record positions and jump between them"))
388 (defvar menu-bar-goto-menu (make-sparse-keymap "Go To"))
390 (define-key menu-bar-goto-menu [set-tags-name]
391 '(menu-item "Set Tags File Name..." visit-tags-table
392 :help "Tell Tags commands which tag table file to use"))
394 (define-key menu-bar-goto-menu [separator-tag-file]
397 (define-key menu-bar-goto-menu [apropos-tags]
398 '(menu-item "Tags Apropos..." tags-apropos
399 :help "Find function/variables whose names match regexp"))
400 (define-key menu-bar-goto-menu [next-tag-otherw]
401 '(menu-item "Next Tag in Other Window"
402 menu-bar-next-tag-other-window
403 :enable (and (boundp 'tags-location-ring)
404 (not (ring-empty-p tags-location-ring)))
405 :help "Find next function/variable matching last tag name in another window"))
407 (defun menu-bar-next-tag-other-window ()
408 "Find the next definition of the tag already specified."
410 (find-tag-other-window nil t))
412 (defun menu-bar-next-tag ()
413 "Find the next definition of the tag already specified."
417 (define-key menu-bar-goto-menu [next-tag]
418 '(menu-item "Find Next Tag"
420 :enable (and (boundp 'tags-location-ring)
421 (not (ring-empty-p tags-location-ring)))
422 :help "Find next function/variable matching last tag name"))
423 (define-key menu-bar-goto-menu [find-tag-otherw]
424 '(menu-item "Find Tag in Other Window..." find-tag-other-window
425 :help "Find function/variable definition in another window"))
426 (define-key menu-bar-goto-menu [find-tag]
427 '(menu-item "Find Tag..." find-tag
428 :help "Find definition of function or variable"))
430 (define-key menu-bar-goto-menu [separator-tags]
433 (define-key menu-bar-goto-menu [end-of-buf]
434 '(menu-item "Goto End of Buffer" end-of-buffer))
435 (define-key menu-bar-goto-menu [beg-of-buf]
436 '(menu-item "Goto Beginning of Buffer" beginning-of-buffer))
437 (define-key menu-bar-goto-menu [go-to-pos]
438 '(menu-item "Goto Buffer Position..." goto-char
439 :help "Read a number N and go to buffer position N"))
440 (define-key menu-bar-goto-menu [go-to-line]
441 '(menu-item "Goto Line..." goto-line
442 :help "Read a line number and go to that line"))
444 (define-key menu-bar-edit-menu [goto]
445 (list 'menu-item "Go To" menu-bar-goto-menu))
447 (define-key menu-bar-edit-menu [replace]
448 (list 'menu-item "Replace" menu-bar-replace-menu))
450 (define-key menu-bar-edit-menu [search]
451 (list 'menu-item "Search" menu-bar-search-menu))
453 (define-key menu-bar-edit-menu [separator-search]
456 (define-key menu-bar-edit-menu [mark-whole-buffer]
457 '(menu-item "Select All" mark-whole-buffer
458 :help "Mark the whole buffer for a subsequent cut/copy."))
459 (define-key menu-bar-edit-menu [clear]
460 '(menu-item "Clear" delete-region
461 :enable (and mark-active
462 (not buffer-read-only)
463 (not (mouse-region-match)))
465 "Delete the text in region between mark and current position"))
466 (defvar yank-menu (cons "Select Yank" nil))
467 (fset 'yank-menu (cons 'keymap yank-menu))
468 (define-key menu-bar-edit-menu [select-paste]
469 '(menu-item "Select and Paste" yank-menu
470 :enable (and (cdr yank-menu) (not buffer-read-only))
471 :help "Paste (yank) text cut or copied earlier"))
472 (define-key menu-bar-edit-menu [paste]
473 '(menu-item "Paste" yank
475 ;; Emacs compiled --without-x doesn't have
476 ;; x-selection-exists-p.
477 (fboundp 'x-selection-exists-p)
478 (x-selection-exists-p) (not buffer-read-only))
479 :help "Paste (yank) text most recently cut/copied"))
480 (define-key menu-bar-edit-menu [copy]
481 '(menu-item "Copy" menu-bar-kill-ring-save
483 :help "Copy text in region between mark and current position"
484 :keys "\\[kill-ring-save]"))
485 (define-key menu-bar-edit-menu [cut]
486 '(menu-item "Cut" kill-region
487 :enable (and mark-active (not buffer-read-only))
489 "Cut (kill) text in region between mark and current position"))
490 (define-key menu-bar-edit-menu [undo]
491 '(menu-item "Undo" undo
492 :enable (and (not buffer-read-only)
493 (not (eq t buffer-undo-list))
494 (if (eq last-command 'undo)
495 (listp pending-undo-list)
496 (consp buffer-undo-list)))
497 :help "Undo last operation"))
500 (defun menu-bar-kill-ring-save (beg end)
502 (if (mouse-region-match)
503 (message "Selecting a region with the mouse does `copy' automatically")
504 (kill-ring-save beg end)))
506 ;; These are alternative definitions for the cut, paste and copy
507 ;; menu items. Use them if your system expects these to use the clipboard.
509 (put 'clipboard-kill-region 'menu-enable 'mark-active)
510 (put 'clipboard-kill-ring-save 'menu-enable 'mark-active)
511 (put 'clipboard-yank 'menu-enable
512 '(or (and (fboundp 'x-selection-exists-p) (x-selection-exists-p))
513 (x-selection-exists-p 'CLIPBOARD)))
515 (defun clipboard-yank ()
516 "Insert the clipboard contents, or the last stretch of killed text."
518 (let ((x-select-enable-clipboard t))
521 (defun clipboard-kill-ring-save (beg end)
522 "Copy region to kill ring, and save in the X clipboard."
524 (let ((x-select-enable-clipboard t))
525 (kill-ring-save beg end)))
527 (defun clipboard-kill-region (beg end)
528 "Kill the region, and save it in the X clipboard."
530 (let ((x-select-enable-clipboard t))
531 (kill-region beg end)))
533 (defun menu-bar-enable-clipboard ()
534 "Make CUT, PASTE and COPY (keys and menu bar items) use the clipboard.
535 Do the same for the keys of the same name."
537 ;; We can't use constant list structure here because it becomes pure,
538 ;; and because it gets modified with cache data.
539 (define-key menu-bar-edit-menu [paste]
540 (cons "Paste" (cons "Paste text from clipboard" 'clipboard-yank)))
541 (define-key menu-bar-edit-menu [copy]
542 (cons "Copy" (cons "Copy text in region to the clipboard"
543 'clipboard-kill-ring-save)))
544 (define-key menu-bar-edit-menu [cut]
545 (cons "Cut" (cons "Delete text in region and copy it to the clipboard"
546 'clipboard-kill-region)))
548 ;; These are Sun server keysyms for the Cut, Copy and Paste keys
549 ;; (also for XFree86 on Sun keyboard):
550 (define-key global-map [f20] 'clipboard-kill-region)
551 (define-key global-map [f16] 'clipboard-kill-ring-save)
552 (define-key global-map [f18] 'clipboard-yank)
554 (define-key global-map [cut] 'clipboard-kill-region)
555 (define-key global-map [copy] 'clipboard-kill-ring-save)
556 (define-key global-map [paste] 'clipboard-yank))
558 ;; The "Options" menu items
560 (defvar menu-bar-custom-menu (make-sparse-keymap "Customize"))
562 (define-key menu-bar-custom-menu [customize-apropos-groups]
563 '(menu-item "Groups Matching Regexp..." customize-apropos-groups
564 :help "Browse groups whose names match regexp"))
565 (define-key menu-bar-custom-menu [customize-apropos-faces]
566 '(menu-item "Faces Matching Regexp..." customize-apropos-faces
567 :help "Browse faces whose names match regexp"))
568 (define-key menu-bar-custom-menu [customize-apropos-options]
569 '(menu-item "Options Matching Regexp..." customize-apropos-options
570 :help "Browse options whose names match regexp"))
571 (define-key menu-bar-custom-menu [customize-apropos]
572 '(menu-item "Settings Matching Regexp..." customize-apropos
573 :help "Browse customizable settings whose names match regexp"))
574 (define-key menu-bar-custom-menu [separator-1]
576 (define-key menu-bar-custom-menu [customize-group]
577 '(menu-item "Specific Group..." customize-group
578 :help "Customize settings of specific group"))
579 (define-key menu-bar-custom-menu [customize-face]
580 '(menu-item "Specific Face..." customize-face
581 :help "Customize attributes of specific face"))
582 (define-key menu-bar-custom-menu [customize-option]
583 '(menu-item "Specific Option..." customize-option
584 :help "Customize value of specific option"))
585 (define-key menu-bar-custom-menu [separator-2]
587 (define-key menu-bar-custom-menu [customize-changed-options]
588 '(menu-item "New Options..." customize-changed-options
589 :help "Options added or changed in recent Emacs versions"))
590 (define-key menu-bar-custom-menu [customize-saved]
591 '(menu-item "Saved Options" customize-saved
592 :help "Customize previously saved options"))
593 (define-key menu-bar-custom-menu [separator-3]
595 (define-key menu-bar-custom-menu [customize-browse]
596 '(menu-item "Browse Customization Groups" customize-browse
597 :help "Browse all customization groups"))
598 (define-key menu-bar-custom-menu [customize]
599 '(menu-item "Top-level Customization Group" customize
600 :help "The master group called `Emacs'"))
602 ;(defvar menu-bar-preferences-menu (make-sparse-keymap "Preferences"))
604 (defmacro menu-bar-make-mm-toggle (fname doc help &optional props)
605 "Make a menu-item for a global minor mode toggle.
606 FNAME is the minor mode's name (variable and function).
607 DOC is the text to use for the menu entry.
608 HELP is the text to use for the tooltip.
609 PROPS are additional properties."
610 `'(menu-item ,doc ,fname
613 :button (:toggle . (and (default-boundp ',fname)
614 (default-value ',fname)))))
616 (defmacro menu-bar-make-toggle (name variable doc message help &rest body)
618 (defun ,name (&optional interactively)
619 ,(concat "Toggle whether to " (downcase (substring help 0 1))
620 (substring help 1) ".
621 In an interactive call, record this option as a candidate for saving
622 by \"Save Options\" in Custom buffers.")
624 (if ,(if body `(progn . ,body)
626 (custom-load-symbol ',variable)
627 (let ((set (or (get ',variable 'custom-set) 'set-default))
628 (get (or (get ',variable 'custom-get) 'default-value)))
629 (funcall set ',variable (not (funcall get ',variable))))))
630 (message ,message "enabled")
631 (message ,message "disabled"))
632 ;; The function `customize-mark-as-set' must only be called when
633 ;; a variable is set interactively, as the purpose is to mark it as
634 ;; a candidate for "Save Options", and we do not want to save options
635 ;; the user have already set explicitly in his init file.
636 (if interactively (customize-mark-as-set ',variable)))
637 '(menu-item ,doc ,name
639 :button (:toggle . (and (default-boundp ',variable)
640 (default-value ',variable))))))
642 ;;; Assemble all the top-level items of the "Options" menu
643 (define-key menu-bar-options-menu [customize]
644 (list 'menu-item "Customize Emacs" menu-bar-custom-menu
645 :help "Full customization of every Emacs feature"))
647 (defun menu-bar-options-save ()
648 "Save current values of Options menu items using Custom."
650 (let ((need-save nil))
651 ;; These are set with menu-bar-make-mm-toggle, which does not
652 ;; put on a customized-value property.
653 (dolist (elt '(line-number-mode column-number-mode size-indication-mode
654 cua-mode show-paren-mode transient-mark-mode
655 blink-cursor-mode display-time-mode display-battery-mode))
656 (and (customize-mark-to-save elt)
658 ;; These are set with `customize-set-variable'.
659 (dolist (elt '(scroll-bar-mode
660 debug-on-quit debug-on-error
661 tooltip-mode menu-bar-mode tool-bar-mode
662 save-place uniquify-buffer-name-style fringe-mode
663 indicate-empty-lines indicate-buffer-boundaries
665 current-language-environment default-input-method
666 ;; Saving `text-mode-hook' is somewhat questionable,
667 ;; as we might get more than we bargain for, if
668 ;; other code may has added hooks as well.
669 ;; Nonetheless, not saving it would like be confuse
671 ;; -- Per Abrahamsen <abraham@dina.kvl.dk> 2002-02-11.
673 (and (get elt 'customized-value)
674 (customize-mark-to-save elt)
676 ;; Save if we changed anything.
680 (define-key menu-bar-options-menu [save]
681 '(menu-item "Save Options" menu-bar-options-save
682 :help "Save options set from the menu above"))
684 (define-key menu-bar-options-menu [custom-separator]
687 (define-key menu-bar-options-menu [mouse-set-font]
688 '(menu-item "Set Font/Fontset..." mouse-set-font
689 :visible (display-multi-font-p)
690 :help "Select a font from list of known fonts/fontsets"))
692 ;; The "Show/Hide" submenu of menu "Options"
694 (defvar menu-bar-showhide-menu (make-sparse-keymap "Show/Hide"))
696 (define-key menu-bar-showhide-menu [column-number-mode]
697 (menu-bar-make-mm-toggle column-number-mode
699 "Show the current column number in the mode line"))
701 (define-key menu-bar-showhide-menu [line-number-mode]
702 (menu-bar-make-mm-toggle line-number-mode
704 "Show the current line number in the mode line"))
706 (define-key menu-bar-showhide-menu [size-indication-mode]
707 (menu-bar-make-mm-toggle size-indication-mode
709 "Show the size of the buffer in the mode line"))
711 (define-key menu-bar-showhide-menu [linecolumn-separator]
714 (define-key menu-bar-showhide-menu [showhide-battery]
715 (menu-bar-make-mm-toggle display-battery-mode
717 "Display battery status information in mode line"))
719 (define-key menu-bar-showhide-menu [showhide-date-time]
720 (menu-bar-make-mm-toggle display-time-mode
721 "Time, Load and Mail"
722 "Display time, system load averages and \
723 mail status in mode line"))
725 (define-key menu-bar-showhide-menu [datetime-separator]
728 (define-key menu-bar-showhide-menu [showhide-speedbar]
729 '(menu-item "Speedbar" speedbar-frame-mode
730 :help "Display a Speedbar quick-navigation frame"
732 . (and (boundp 'speedbar-frame)
733 (frame-live-p (symbol-value 'speedbar-frame))
735 (symbol-value 'speedbar-frame))))))
737 (defvar menu-bar-showhide-fringe-menu (make-sparse-keymap "Fringe"))
739 (defvar menu-bar-showhide-fringe-ind-menu
740 (make-sparse-keymap "Buffer boundaries"))
742 (defun menu-bar-showhide-fringe-ind-customize ()
743 "Show customization buffer for `indicate-buffer-boundaries'."
745 (customize-variable 'indicate-buffer-boundaries))
747 (define-key menu-bar-showhide-fringe-ind-menu [customize]
748 '(menu-item "Other (Customize)"
749 menu-bar-showhide-fringe-ind-customize
750 :help "Additional choices available through Custom buffer"
751 :visible (display-graphic-p)))
753 (defun menu-bar-showhide-fringe-ind-mixed ()
754 "Display top and bottom indicators in opposite fringes, arrows in right."
756 (customize-set-variable 'indicate-buffer-boundaries
757 '((t . right) (top . left))))
759 (define-key menu-bar-showhide-fringe-ind-menu [mixed]
760 '(menu-item "Opposite, Arrows Right" menu-bar-showhide-fringe-ind-mixed
762 "Show top/bottom indicators in opposite fringes, arrows in right"
763 :visible (display-graphic-p)
764 :button (:radio . (eq indicate-buffer-boundaries
765 '((t . right) (top . left))))))
767 (defun menu-bar-showhide-fringe-ind-box ()
768 "Display top and bottom indicators in opposite fringes."
770 (customize-set-variable 'indicate-buffer-boundaries
771 '((top . left) (bottom . right))))
773 (define-key menu-bar-showhide-fringe-ind-menu [box]
774 '(menu-item "Opposite, No Arrows" menu-bar-showhide-fringe-ind-box
775 :help "Show top/bottom indicators in opposite fringes, no arrows"
776 :visible (display-graphic-p)
777 :button (:radio . (eq indicate-buffer-boundaries
778 '((top . left) (bottom . right))))))
780 (defun menu-bar-showhide-fringe-ind-right ()
781 "Display buffer boundaries and arrows in the right fringe."
783 (customize-set-variable 'indicate-buffer-boundaries 'right))
785 (define-key menu-bar-showhide-fringe-ind-menu [right]
786 '(menu-item "In Right Fringe" menu-bar-showhide-fringe-ind-right
787 :help "Show buffer boundaries and arrows in right fringe"
788 :visible (display-graphic-p)
789 :button (:radio . (eq indicate-buffer-boundaries 'right))))
791 (defun menu-bar-showhide-fringe-ind-left ()
792 "Display buffer boundaries and arrows in the left fringe."
794 (customize-set-variable 'indicate-buffer-boundaries 'left))
796 (define-key menu-bar-showhide-fringe-ind-menu [left]
797 '(menu-item "In Left Fringe" menu-bar-showhide-fringe-ind-left
798 :help "Show buffer boundaries and arrows in left fringe"
799 :visible (display-graphic-p)
800 :button (:radio . (eq indicate-buffer-boundaries 'left))))
802 (defun menu-bar-showhide-fringe-ind-none ()
803 "Do not display any buffer boundary indicators."
805 (customize-set-variable 'indicate-buffer-boundaries nil))
807 (define-key menu-bar-showhide-fringe-ind-menu [none]
808 '(menu-item "No Indicators" menu-bar-showhide-fringe-ind-none
809 :help "Hide all buffer boundary indicators and arrows"
810 :visible (display-graphic-p)
811 :button (:radio . (eq indicate-buffer-boundaries nil))))
813 (define-key menu-bar-showhide-fringe-menu [showhide-fringe-ind]
814 (list 'menu-item "Buffer Boundaries" menu-bar-showhide-fringe-ind-menu
815 :visible `(display-graphic-p)
816 :help "Indicate buffer boundaries in fringe"))
818 (define-key menu-bar-showhide-fringe-menu [indicate-empty-lines]
819 (menu-bar-make-toggle toggle-indicate-empty-lines indicate-empty-lines
820 "Empty Line Indicators"
821 "Indicating of empty lines %s"
822 "Indicate trailing empty lines in fringe"))
824 (defun menu-bar-showhide-fringe-menu-customize ()
825 "Show customization buffer for `fringe-mode'."
827 (customize-variable 'fringe-mode))
829 (define-key menu-bar-showhide-fringe-menu [customize]
830 '(menu-item "Customize Fringe" menu-bar-showhide-fringe-menu-customize
831 :help "Detailed customization of fringe"
832 :visible (display-graphic-p)))
834 (defun menu-bar-showhide-fringe-menu-customize-reset ()
835 "Reset the fringe mode: display fringes on both sides of a window."
837 (customize-set-variable 'fringe-mode nil))
839 (define-key menu-bar-showhide-fringe-menu [default]
840 '(menu-item "Default" menu-bar-showhide-fringe-menu-customize-reset
841 :help "Default width fringe on both left and right side"
842 :visible (display-graphic-p)
843 :button (:radio . (eq fringe-mode nil))))
845 (defun menu-bar-showhide-fringe-menu-customize-right ()
846 "Display fringes only on the right of each window."
849 (customize-set-variable 'fringe-mode '(0 . nil)))
851 (define-key menu-bar-showhide-fringe-menu [right]
852 '(menu-item "On the Right" menu-bar-showhide-fringe-menu-customize-right
853 :help "Fringe only on the right side"
854 :visible (display-graphic-p)
855 :button (:radio . (equal fringe-mode '(0 . nil)))))
857 (defun menu-bar-showhide-fringe-menu-customize-left ()
858 "Display fringes only on the left of each window."
861 (customize-set-variable 'fringe-mode '(nil . 0)))
863 (define-key menu-bar-showhide-fringe-menu [left]
864 '(menu-item "On the Left" menu-bar-showhide-fringe-menu-customize-left
865 :help "Fringe only on the left side"
866 :visible (display-graphic-p)
867 :button (:radio . (equal fringe-mode '(nil . 0)))))
869 (defun menu-bar-showhide-fringe-menu-customize-disable ()
870 "Do not display window fringes."
873 (customize-set-variable 'fringe-mode 0))
875 (define-key menu-bar-showhide-fringe-menu [none]
876 '(menu-item "None" menu-bar-showhide-fringe-menu-customize-disable
877 :help "Turn off fringe"
878 :visible (display-graphic-p)
879 :button (:radio . (eq fringe-mode 0))))
881 (define-key menu-bar-showhide-menu [showhide-fringe]
882 (list 'menu-item "Fringe" menu-bar-showhide-fringe-menu
883 :visible `(display-graphic-p)
884 :help "Select fringe mode"))
886 (defvar menu-bar-showhide-scroll-bar-menu (make-sparse-keymap "Scroll-bar"))
888 (define-key menu-bar-showhide-scroll-bar-menu [right]
889 '(menu-item "On the Right"
890 menu-bar-right-scroll-bar
891 :help "Scroll-bar on the right side"
892 :visible (display-graphic-p)
893 :button (:radio . (eq (cdr (assq 'vertical-scroll-bars
894 (frame-parameters))) 'right))))
895 (defun menu-bar-right-scroll-bar ()
896 "Display scroll bars on the right of each window."
898 (customize-set-variable 'scroll-bar-mode 'right))
900 (define-key menu-bar-showhide-scroll-bar-menu [left]
901 '(menu-item "On the Left"
902 menu-bar-left-scroll-bar
903 :help "Scroll-bar on the left side"
904 :visible (display-graphic-p)
905 :button (:radio . (eq (cdr (assq 'vertical-scroll-bars
906 (frame-parameters))) 'left))))
908 (defun menu-bar-left-scroll-bar ()
909 "Display scroll bars on the left of each window."
911 (customize-set-variable 'scroll-bar-mode 'left))
913 (define-key menu-bar-showhide-scroll-bar-menu [none]
915 menu-bar-no-scroll-bar
916 :help "Turn off scroll-bar"
917 :visible (display-graphic-p)
918 :button (:radio . (eq (cdr (assq 'vertical-scroll-bars
919 (frame-parameters))) nil))))
921 (defun menu-bar-no-scroll-bar ()
922 "Turn off scroll bars."
924 (customize-set-variable 'scroll-bar-mode nil))
926 (define-key menu-bar-showhide-menu [showhide-scroll-bar]
927 (list 'menu-item "Scroll-bar" menu-bar-showhide-scroll-bar-menu
928 :visible `(display-graphic-p)
929 :help "Select scroll-bar mode"))
931 (define-key menu-bar-showhide-menu [showhide-tooltip-mode]
932 (list 'menu-item "Tooltips" 'tooltip-mode
933 :help "Toggle tooltips on/off"
934 :visible `(and (display-graphic-p) (fboundp 'x-show-tip))
935 :button `(:toggle . tooltip-mode)))
937 (define-key menu-bar-showhide-menu [menu-bar-mode]
938 '(menu-item "Menu-bar" menu-bar-mode
939 :help "Toggle menu-bar on/off"
940 :button (:toggle . menu-bar-mode)))
942 (define-key menu-bar-showhide-menu [showhide-tool-bar]
943 (list 'menu-item "Tool-bar" 'tool-bar-mode
944 :help "Turn tool-bar on/off"
945 :visible `(display-graphic-p)
946 :button `(:toggle . tool-bar-mode)))
948 (define-key menu-bar-options-menu [showhide]
949 (list 'menu-item "Show/Hide" menu-bar-showhide-menu
950 :help "Toggle on/off various display features"))
952 (define-key menu-bar-options-menu [showhide-separator]
955 (define-key menu-bar-options-menu [mule]
956 ;; It is better not to use backquote here,
957 ;; because that makes a bootstrapping problem
958 ;; if you need to recompile all the Lisp files using interpreted code.
959 (list 'menu-item "Mule (Multilingual Environment)" mule-menu-keymap
960 ;; Most of the MULE menu actually does make sense in unibyte mode,
961 ;; e.g. language selection.
962 ;;; ':visible 'default-enable-multibyte-characters
963 ':help "Default language, encodings, input method"))
964 ;(setq menu-bar-final-items (cons 'mule menu-bar-final-items))
965 ;(define-key menu-bar-options-menu [preferences]
966 ; (list 'menu-item "Preferences" menu-bar-preferences-menu
967 ; :help "Toggle important global options"))
969 (define-key menu-bar-options-menu [mule-separator]
972 (define-key menu-bar-options-menu [debug-on-quit]
973 (menu-bar-make-toggle toggle-debug-on-quit debug-on-quit
974 "Enter Debugger on Quit/C-g" "Debug on Quit %s"
975 "Enter Lisp debugger when C-g is pressed"))
976 (define-key menu-bar-options-menu [debug-on-error]
977 (menu-bar-make-toggle toggle-debug-on-error debug-on-error
978 "Enter Debugger on Error" "Debug on Error %s"
979 "Enter Lisp debugger when an error is signaled"))
980 (define-key menu-bar-options-menu [debugger-separator]
983 (define-key menu-bar-options-menu [blink-cursor-mode]
984 (menu-bar-make-mm-toggle blink-cursor-mode
986 "Whether the cursor blinks (Blink Cursor mode)"))
987 (define-key menu-bar-options-menu [cursor-separator]
990 (define-key menu-bar-options-menu [save-place]
991 (menu-bar-make-toggle toggle-save-place-globally save-place
992 "Save Place in Files between Sessions"
993 "Saving place in files %s"
994 "Visit files of previous session when restarting Emacs"
996 ;; Do it by name, to avoid a free-variable
997 ;; warning during byte compilation.
999 'save-place (not (symbol-value 'save-place)))))
1001 (define-key menu-bar-options-menu [uniquify]
1002 (menu-bar-make-toggle toggle-uniquify-buffer-names uniquify-buffer-name-style
1003 "Use Directory Names in Buffer Names"
1004 "Directory name in buffer names (uniquify) %s"
1005 "Uniquify buffer names by adding parent directory names"
1007 (setq uniquify-buffer-name-style
1008 (if (not uniquify-buffer-name-style)
1011 (define-key menu-bar-options-menu [edit-options-separator]
1013 (define-key menu-bar-options-menu [cua-mode]
1014 (menu-bar-make-mm-toggle cua-mode
1015 "C-x/C-c/C-v Cut and Paste (CUA)"
1016 "Use C-z/C-x/C-c/C-v keys for undo/cut/copy/paste"
1017 (:visible (or (not (boundp 'cua-enable-cua-keys))
1018 cua-enable-cua-keys))))
1020 (define-key menu-bar-options-menu [cua-emulation-mode]
1021 (menu-bar-make-mm-toggle cua-mode
1022 "Shift movement mark region (CUA)"
1023 "Use shifted movement keys to set and extend the region."
1024 (:visible (and (boundp 'cua-enable-cua-keys)
1025 (not cua-enable-cua-keys)))))
1027 (define-key menu-bar-options-menu [case-fold-search]
1028 (menu-bar-make-toggle toggle-case-fold-search case-fold-search
1029 "Case-Insensitive Search"
1030 "Case-Insensitive Search %s"
1031 "Ignore letter-case in search"))
1033 (defun menu-bar-text-mode-auto-fill ()
1035 (toggle-text-mode-auto-fill)
1036 ;; This is somewhat questionable, as `text-mode-hook'
1037 ;; might have changed outside customize.
1038 ;; -- Per Abrahamsen <abraham@dina.kvl.dk> 2002-02-11.
1039 (customize-mark-as-set 'text-mode-hook))
1041 (define-key menu-bar-options-menu [auto-fill-mode]
1042 '(menu-item "Word Wrap in Text Modes"
1043 menu-bar-text-mode-auto-fill
1044 :help "Automatically fill text between left and right margins (Auto Fill)"
1045 :button (:toggle . (if (listp text-mode-hook)
1046 (member 'turn-on-auto-fill text-mode-hook)
1047 (eq 'turn-on-auto-fill text-mode-hook)))))
1048 (define-key menu-bar-options-menu [truncate-lines]
1049 '(menu-item "Truncate Long Lines in this Buffer"
1050 toggle-truncate-lines
1051 :help "Truncate long lines on the screen"
1052 :button (:toggle . truncate-lines)
1053 :enable (menu-bar-menu-frame-live-and-visible-p)))
1055 (define-key menu-bar-options-menu [highlight-separator]
1057 (define-key menu-bar-options-menu [highlight-paren-mode]
1058 (menu-bar-make-mm-toggle show-paren-mode
1059 "Paren Match Highlighting"
1060 "Highlight matching/mismatched parentheses at cursor (Show Paren mode)"))
1061 (define-key menu-bar-options-menu [transient-mark-mode]
1062 (menu-bar-make-mm-toggle transient-mark-mode
1063 "Active Region Highlighting"
1064 "Make text in active region stand out in color (Transient Mark mode)"
1065 (:enable (not cua-mode))))
1068 ;; The "Tools" menu items
1070 (defun send-mail-item-name ()
1071 (let* ((known-send-mail-commands '((sendmail-user-agent . "sendmail")
1072 (mh-e-user-agent . "MH")
1073 (message-user-agent . "Gnus Message")
1074 (gnus-user-agent . "Gnus")))
1075 (name (assq mail-user-agent known-send-mail-commands)))
1077 (setq name (cdr name))
1078 (setq name (symbol-name mail-user-agent))
1079 (if (string-match "\\(.+\\)-user-agent" name)
1080 (setq name (match-string 1 name))))
1083 (defun read-mail-item-name ()
1084 (let* ((known-rmail-commands '((rmail . "RMAIL")
1087 (known (assq read-mail-command known-rmail-commands)))
1088 (if known (cdr known) (symbol-name read-mail-command))))
1090 (defvar menu-bar-games-menu (make-sparse-keymap "Games"))
1092 (define-key menu-bar-tools-menu [games]
1093 (list 'menu-item "Games" menu-bar-games-menu))
1095 (define-key menu-bar-tools-menu [separator-games]
1098 (define-key menu-bar-games-menu [zone]
1099 '(menu-item "Zone Out" zone
1100 :help "Play tricks with Emacs display when Emacs is idle"))
1101 (define-key menu-bar-games-menu [yow]
1102 '(menu-item "Random Quotation" yow
1103 :help "Display a random Zippy quotation"))
1104 (define-key menu-bar-games-menu [tetris]
1105 '(menu-item "Tetris" tetris))
1106 (define-key menu-bar-games-menu [solitaire]
1107 '(menu-item "Solitaire" solitaire))
1108 (define-key menu-bar-games-menu [snake]
1109 '(menu-item "Snake" snake
1110 :help "Move snake around avoiding collisions"))
1111 (define-key menu-bar-games-menu [mult]
1112 '(menu-item "Multiplication Puzzle" mpuz
1113 :help "Exercise brain with multiplication"))
1114 (define-key menu-bar-games-menu [life]
1115 '(menu-item "Life" life
1116 :help "Watch how John Conway's cellular automaton evolves"))
1117 (define-key menu-bar-games-menu [hanoi]
1118 '(menu-item "Towers of Hanoi" hanoi
1119 :help "Watch Towers-of-Hanoi puzzle solved by Emacs"))
1120 (define-key menu-bar-games-menu [gomoku]
1121 '(menu-item "Gomoku" gomoku
1122 :help "Mark 5 contiguous squares (like tic-tac-toe)"))
1123 (define-key menu-bar-games-menu [black-box]
1124 '(menu-item "Blackbox" blackbox
1125 :help "Find balls in a black box by shooting rays"))
1126 (define-key menu-bar-games-menu [adventure]
1127 '(menu-item "Adventure" dunnet
1128 :help "Dunnet, a text Adventure game for Emacs"))
1129 (define-key menu-bar-games-menu [5x5]
1130 '(menu-item "5x5" 5x5
1131 :help "Fill in all the squares on a 5x5 board"))
1133 (define-key menu-bar-tools-menu [simple-calculator]
1134 '(menu-item "Simple Calculator" calculator
1135 :help "Invoke the Emacs built-in quick calculator"))
1136 (define-key menu-bar-tools-menu [calc]
1137 '(menu-item "Programmable Calculator" calc
1138 :help "Invoke the Emacs built-in full scientific calculator"))
1139 (define-key menu-bar-tools-menu [calendar]
1140 '(menu-item "Display Calendar" calendar))
1142 (define-key menu-bar-tools-menu [separator-net]
1145 (define-key menu-bar-tools-menu [directory-search]
1146 '(menu-item "Directory Search" eudc-tools-menu
1147 :help "Query directory servers via LDAP, CCSO PH/QI or BBDB"))
1148 (define-key menu-bar-tools-menu [compose-mail]
1150 'menu-item `(format "Send Mail (with %s)" (send-mail-item-name))
1152 :visible `(and mail-user-agent (not (eq mail-user-agent 'ignore)))
1153 :help "Send a mail message"))
1154 (define-key menu-bar-tools-menu [rmail]
1156 'menu-item `(format "Read Mail (with %s)" (read-mail-item-name))
1158 :visible `(and read-mail-command (not (eq read-mail-command 'ignore)))
1159 :help "Read your mail and reply to it"))
1161 (defun menu-bar-read-mail ()
1162 "Read mail using `read-mail-command'."
1164 (call-interactively read-mail-command))
1166 (define-key menu-bar-tools-menu [gnus]
1167 '(menu-item "Read Net News (Gnus)" gnus
1168 :help "Read network news groups"))
1170 (define-key menu-bar-tools-menu [separator-vc]
1173 (defvar vc-menu-map (make-sparse-keymap "Version Control"))
1174 (define-key menu-bar-tools-menu [pcl-cvs]
1175 '(menu-item "PCL-CVS" cvs-global-menu
1176 :help "Module-level interface to CVS"))
1177 (define-key menu-bar-tools-menu [vc]
1178 (list 'menu-item "Version Control" vc-menu-map
1179 :help "Interface to RCS, CVS, SCCS"))
1181 (define-key menu-bar-tools-menu [separator-compare]
1184 (define-key menu-bar-tools-menu [ediff-misc]
1185 '(menu-item "Ediff Miscellanea" menu-bar-ediff-misc-menu
1186 :help "Ediff manual, customization, sessions, etc."))
1187 (define-key menu-bar-tools-menu [epatch]
1188 '(menu-item "Apply Patch" menu-bar-epatch-menu))
1189 (define-key menu-bar-tools-menu [ediff-merge]
1190 '(menu-item "Merge" menu-bar-ediff-merge-menu
1191 :help "Merge different revisions of files/directories"))
1192 (define-key menu-bar-tools-menu [compare]
1193 '(menu-item "Compare (Ediff)" menu-bar-ediff-menu
1194 :help "Display differences between files/directories"))
1197 (define-key menu-bar-tools-menu [separator-spell]
1200 (define-key menu-bar-tools-menu [spell]
1201 '(menu-item "Spell Checking" ispell-menu-map))
1203 (define-key menu-bar-tools-menu [separator-prog]
1206 (define-key menu-bar-tools-menu [gdb]
1207 '(menu-item "Debugger (GDB)..." gdb
1208 :help "Debug a program from within Emacs with GDB"))
1209 (define-key menu-bar-tools-menu [shell-on-region]
1210 '(menu-item "Shell Command on Region..." shell-command-on-region
1212 :help "Pass marked region to a shell command"))
1213 (define-key menu-bar-tools-menu [shell]
1214 '(menu-item "Shell Command..." shell-command
1215 :help "Invoke a shell command and catch its output"))
1216 (define-key menu-bar-tools-menu [compile]
1217 '(menu-item "Compile..." compile
1218 :help "Invoke compiler or Make, view compilation errors"))
1219 (define-key menu-bar-tools-menu [grep]
1220 '(menu-item "Search Files (with grep)..." grep
1221 :help "Search files for strings or regexps (with grep)"))
1224 ;; The "Help" menu items
1226 (defvar menu-bar-describe-menu (make-sparse-keymap "Describe"))
1228 (define-key menu-bar-describe-menu [mule-diag]
1229 '(menu-item "Show All of Mule Status" mule-diag
1230 :visible default-enable-multibyte-characters
1231 :help "Display multilingual environment settings"))
1232 (define-key menu-bar-describe-menu [describe-coding-system-briefly]
1233 '(menu-item "Describe Coding System (Briefly)..."
1234 describe-current-coding-system-briefly
1235 :visible default-enable-multibyte-characters))
1236 (define-key menu-bar-describe-menu [describe-coding-system]
1237 '(menu-item "Describe Coding System..." describe-coding-system
1238 :visible default-enable-multibyte-characters))
1239 (define-key menu-bar-describe-menu [describe-input-method]
1240 '(menu-item "Describe Input Method..." describe-input-method
1241 :visible default-enable-multibyte-characters
1242 :help "Keyboard layout for specific input method"))
1243 (define-key menu-bar-describe-menu [describe-language-environment]
1244 (list 'menu-item "Describe Language Environment"
1245 describe-language-environment-map
1246 :help "Show multilingual settings for a specific language"))
1248 (define-key menu-bar-describe-menu [separator-desc-mule]
1251 (define-key menu-bar-describe-menu [list-keybindings]
1252 '(menu-item "List Key Bindings" describe-bindings
1253 :help "Display all current keybindings (keyboard shortcuts)"))
1254 (define-key menu-bar-describe-menu [describe-current-display-table]
1255 '(menu-item "Describe Display Table" describe-current-display-table
1256 :help "Describe the current display table"))
1257 (define-key menu-bar-describe-menu [describe-face]
1258 '(menu-item "Describe Face..." describe-face
1259 :help "Display the properties of a face"))
1260 (define-key menu-bar-describe-menu [describe-variable]
1261 '(menu-item "Describe Variable..." describe-variable
1262 :help "Display documentation of variable/option"))
1263 (define-key menu-bar-describe-menu [describe-function]
1264 '(menu-item "Describe Function..." describe-function
1265 :help "Display documentation of function/command"))
1266 (define-key menu-bar-describe-menu [describe-key-1]
1267 '(menu-item "Describe Key or Mouse Operation..." describe-key
1268 ;; Users typically don't identify keys and menu items...
1269 :help "Display documentation of command bound to a \
1270 key, a click, or a menu-item"))
1271 (define-key menu-bar-describe-menu [describe-mode]
1272 '(menu-item "Describe Buffer Modes" describe-mode
1273 :help "Describe this buffer's major and minor mode"))
1275 (defvar menu-bar-apropos-menu (make-sparse-keymap "Apropos"))
1276 (defun menu-bar-read-lispref ()
1277 "Display the Emacs Lisp Reference manual in Info mode."
1281 (defun menu-bar-read-lispintro ()
1282 "Display the Introduction to Emacs Lisp Programming in Info mode."
1286 (defun search-emacs-glossary ()
1287 "Display the Glossary node of the Emacs manual in Info mode."
1289 (info "(emacs)Glossary"))
1291 (defun emacs-index-search (topic)
1292 "Look up TOPIC in the indices of the Emacs User Manual."
1293 (interactive "sSubject to look up: ")
1297 (defun elisp-index-search (topic)
1298 "Look up TOPIC in the indices of the Emacs Lisp Reference Manual."
1299 (interactive "sSubject to look up: ")
1303 (define-key menu-bar-apropos-menu [apropos-documentation]
1304 '(menu-item "Search Documentation Strings..." apropos-documentation
1306 "Find functions and variables whose doc strings match a regexp"))
1307 (define-key menu-bar-apropos-menu [apropos]
1308 '(menu-item "Find Any Object by Name..." apropos
1309 :help "Find symbols of any kind whose names match a regexp"))
1310 (define-key menu-bar-apropos-menu [apropos-value]
1311 '(menu-item "Find Options by Value..." apropos-value
1312 :help "Find variables whose values match a regexp"))
1313 (define-key menu-bar-apropos-menu [apropos-variables]
1314 '(menu-item "Find Options by Name..." apropos-variable
1315 :help "Find variables whose names match a regexp"))
1316 (define-key menu-bar-apropos-menu [apropos-commands]
1317 '(menu-item "Find Commands by Name..." apropos-command
1318 :help "Find commands whose names match a regexp"))
1319 (define-key menu-bar-apropos-menu [sep1]
1321 (define-key menu-bar-apropos-menu [elisp-index-search]
1322 '(menu-item "Look Up Subject in ELisp Manual..." elisp-index-search
1323 :help "Find description of a subject in Emacs Lisp manual"))
1324 (define-key menu-bar-apropos-menu [emacs-index-search]
1325 '(menu-item "Look Up Subject in User Manual..." emacs-index-search
1326 :help "Find description of a subject in Emacs User manual"))
1327 (define-key menu-bar-apropos-menu [emacs-glossary]
1328 '(menu-item "Emacs Terminology" search-emacs-glossary
1329 :help "Display the Glossary section of the Emacs manual"))
1331 (defvar menu-bar-manuals-menu (make-sparse-keymap "More Manuals"))
1333 (define-key menu-bar-manuals-menu [man]
1334 '(menu-item "Read Man Page..." manual-entry
1335 :help "Man-page docs for external commands and libraries"))
1336 (define-key menu-bar-manuals-menu [sep2]
1338 (define-key menu-bar-manuals-menu [order-emacs-manuals]
1339 '(menu-item "Ordering Manuals" view-order-manuals
1340 :help "How to order manuals from the Free Software Foundation"))
1341 (define-key menu-bar-manuals-menu [info]
1342 '(menu-item "All Other Manuals (Info)" Info-directory
1343 :help "Read any of the installed manuals"))
1344 (define-key menu-bar-manuals-menu [info-elisp]
1345 '(menu-item "Emacs Lisp Reference" menu-bar-read-lispref
1346 :help "Read the Emacs Lisp Reference manual"))
1347 (define-key menu-bar-manuals-menu [info-elintro]
1348 '(menu-item "Introduction to Emacs Lisp" menu-bar-read-lispintro
1349 :help "Read the Introduction to Emacs Lisp Programming"))
1350 (define-key menu-bar-manuals-menu [sep3]
1352 (define-key menu-bar-manuals-menu [command]
1353 '(menu-item "Find Command in Manual..." Info-goto-emacs-command-node
1354 :help "Display manual section that describes a command"))
1355 (define-key menu-bar-manuals-menu [key]
1356 '(menu-item "Find Key in Manual..." Info-goto-emacs-key-command-node
1357 :help "Display manual section that describes a key"))
1359 (define-key menu-bar-help-menu [eliza]
1360 '(menu-item "Emacs Psychotherapist" doctor
1361 :help "Our doctor will help you feel better"))
1362 (define-key menu-bar-help-menu [sep4]
1364 (define-key menu-bar-help-menu [describe-no-warranty]
1365 '(menu-item "(Non)Warranty" describe-no-warranty
1366 :help "Explain that Emacs has NO WARRANTY"))
1367 (define-key menu-bar-help-menu [describe-copying]
1368 '(menu-item "Copying Conditions" describe-copying
1369 :help "Show the Emacs license (GPL)"))
1370 (define-key menu-bar-help-menu [describe-distribution]
1371 '(menu-item "Getting New Versions" describe-distribution
1372 :help "How to get latest versions of Emacs"))
1373 (define-key menu-bar-help-menu [more]
1374 '(menu-item "External Packages" menu-bar-help-extra-packages
1375 :help "Lisp packages distributed separately for use in Emacs"))
1376 (defun menu-bar-help-extra-packages ()
1377 "Display help about some additional packages available for Emacs."
1379 (let (enable-local-variables)
1380 (view-file (expand-file-name "MORE.STUFF"
1383 (define-key menu-bar-help-menu [about]
1384 '(menu-item "About Emacs" display-splash-screen
1385 :help "Display version number, copyright info, and basic help"))
1386 (define-key menu-bar-help-menu [sep2]
1388 (define-key menu-bar-help-menu [finder-by-keyword]
1389 '(menu-item "Find Emacs Packages" finder-by-keyword
1390 :help "Find packages and features by keyword"))
1391 (define-key menu-bar-help-menu [manuals]
1392 (list 'menu-item "More Manuals" menu-bar-manuals-menu
1393 :help "Search and browse on-line manuals"))
1394 (define-key menu-bar-help-menu [emacs-manual]
1395 '(menu-item "Read the Emacs Manual" info-emacs-manual
1396 :help "Full documentation of Emacs features"))
1397 (define-key menu-bar-help-menu [describe]
1398 (list 'menu-item "Describe" menu-bar-describe-menu
1399 :help "Describe commands, variables, keys"))
1400 (define-key menu-bar-help-menu [apropos]
1401 (list 'menu-item "Search Documentation" menu-bar-apropos-menu
1402 :help "Look up terms, find commands, options, etc. (Apropos)"))
1403 (define-key menu-bar-help-menu [sep1]
1405 (define-key menu-bar-help-menu [report-emacs-bug]
1406 '(menu-item "Send Bug Report..." report-emacs-bug
1407 :help "Send e-mail to Emacs maintainers"))
1408 (define-key menu-bar-help-menu [emacs-problems]
1409 '(menu-item "Emacs Known Problems" view-emacs-problems))
1410 (define-key menu-bar-help-menu [emacs-news]
1411 '(menu-item "Emacs News" view-emacs-news
1412 :help "New features of this version"))
1413 (define-key menu-bar-help-menu [emacs-faq]
1414 '(menu-item "Emacs FAQ" view-emacs-FAQ))
1416 (defun help-with-tutorial-spec-language ()
1417 "Use the Emacs tutorial, specifying which language you want."
1419 (help-with-tutorial t))
1421 (define-key menu-bar-help-menu [emacs-tutorial-language-specific]
1422 '(menu-item "Emacs Tutorial (choose language)..."
1423 help-with-tutorial-spec-language
1424 :help "Learn how to use Emacs (choose a language)"))
1425 (define-key menu-bar-help-menu [emacs-tutorial]
1426 '(menu-item "Emacs Tutorial" help-with-tutorial
1427 :help "Learn how to use Emacs"))
1429 (defun menu-bar-menu-frame-live-and-visible-p ()
1430 "Return non-nil if the menu frame is alive and visible.
1431 The menu frame is the frame for which we are updating the menu."
1432 (let ((menu-frame (or menu-updating-frame (selected-frame))))
1433 (and (frame-live-p menu-frame)
1434 (frame-visible-p menu-frame))))
1436 (defun menu-bar-non-minibuffer-window-p ()
1437 "Return non-nil if selected window of the menu frame is not a minibuf window.
1439 See the documentation of `menu-bar-menu-frame-live-and-visible-p'
1440 for the definition of the menu frame."
1441 (let ((menu-frame (or menu-updating-frame (selected-frame))))
1442 (not (window-minibuffer-p (frame-selected-window menu-frame)))))
1444 (defun kill-this-buffer () ; for the menu bar
1445 "Kill the current buffer."
1447 (kill-buffer (current-buffer)))
1449 (defun kill-this-buffer-enabled-p ()
1451 (buffers (buffer-list)))
1453 (or (string-match "^ " (buffer-name (car buffers)))
1454 (setq count (1+ count)))
1455 (setq buffers (cdr buffers)))
1456 (and (menu-bar-non-minibuffer-window-p)
1459 (put 'dired 'menu-enable '(menu-bar-non-minibuffer-window-p))
1461 ;; Permit deleting frame if it would leave a visible or iconified frame.
1462 (defun delete-frame-enabled-p ()
1463 "Return non-nil if `delete-frame' should be enabled in the menu bar."
1464 (let ((frames (frame-list))
1467 (if (frame-visible-p (car frames))
1468 (setq count (1+ count)))
1469 (setq frames (cdr frames)))
1472 (defcustom yank-menu-length 20
1473 "*Maximum length to display in the yank-menu."
1477 (defun menu-bar-update-yank-menu (string old)
1478 (let ((front (car (cdr yank-menu)))
1479 (menu-string (if (<= (length string) yank-menu-length)
1482 (substring string 0 (/ yank-menu-length 2))
1484 (substring string (- (/ yank-menu-length 2)))))))
1485 ;; Don't let the menu string be all dashes
1486 ;; because that has a special meaning in a menu.
1487 (if (string-match "\\`-+\\'" menu-string)
1488 (setq menu-string (concat menu-string " ")))
1489 ;; If we're supposed to be extending an existing string, and that
1490 ;; string really is at the front of the menu, then update it in place.
1491 (if (and old (or (eq old (car front))
1492 (string= old (car front))))
1494 (setcar front string)
1495 (setcar (cdr front) menu-string))
1498 (cons string (cons menu-string 'menu-bar-select-yank))
1500 (if (> (length (cdr yank-menu)) kill-ring-max)
1501 (setcdr (nthcdr kill-ring-max yank-menu) nil)))
1503 (put 'menu-bar-select-yank 'apropos-inhibit t)
1504 (defun menu-bar-select-yank ()
1505 "Insert the stretch of previously-killed text selected from menu.
1506 The menu shows all the killed text sequences stored in `kill-ring'."
1509 (insert last-command-event))
1512 (defcustom buffers-menu-show-directories 'unless-uniquify
1513 "If non-nil, show directories in the Buffers menu for buffers that have them.
1514 The special value `unless-uniquify' means that directories will be shown
1515 unless `uniquify-buffer-name-style' is non-nil (in which case, buffer
1516 names should include enough of a buffer's directory to distinguish it
1517 from other buffers).
1519 Setting this variable directly does not take effect until next time the
1520 Buffers menu is regenerated."
1521 :set (lambda (symbol value)
1523 (menu-bar-update-buffers t))
1524 :initialize 'custom-initialize-default
1525 :type '(choice (const :tag "Never" nil)
1526 (const :tag "Unless uniquify is enabled" unless-uniquify)
1527 (const :tag "Always" t))
1530 (defcustom buffers-menu-show-status t
1531 "If non-nil, show modified/read-only status of buffers in the Buffers menu.
1532 Setting this variable directly does not take effect until next time the
1533 Buffers menu is regenerated."
1534 :set (lambda (symbol value)
1536 (menu-bar-update-buffers t))
1537 :initialize 'custom-initialize-default
1541 (defvar list-buffers-directory nil)
1543 (defvar menu-bar-update-buffers-maxbuf)
1545 (defun menu-bar-select-buffer ()
1547 (switch-to-buffer last-command-event))
1549 (defun menu-bar-select-frame ()
1552 (dolist (f (frame-list))
1553 (when (equal last-command-event (frame-parameter f 'name))
1555 ;; FRAME can be nil when user specifies the selected frame.
1556 (setq frame (or frame (selected-frame)))
1557 (make-frame-visible frame)
1559 (select-frame frame)))
1561 (defun menu-bar-update-buffers-1 (elt)
1562 (let* ((buf (car elt))
1564 (and (if (eq buffers-menu-show-directories 'unless-uniquify)
1565 (or (not (boundp 'uniquify-buffer-name-style))
1566 (null uniquify-buffer-name-style))
1567 buffers-menu-show-directories)
1568 (or (buffer-file-name buf)
1569 (buffer-local-value 'list-buffers-directory buf)))))
1571 (setq file (file-name-directory file)))
1572 (when (and file (> (length file) 20))
1573 (setq file (concat "..." (substring file -17))))
1574 (cons (if buffers-menu-show-status
1575 (let ((mod (if (buffer-modified-p buf) "*" ""))
1576 (ro (if (buffer-local-value 'buffer-read-only buf) "%" "")))
1578 (format "%s %s%s -- %s" (cdr elt) mod ro file)
1579 (format "%s %s%s" (cdr elt) mod ro)))
1581 (format "%s -- %s" (cdr elt) file)
1585 ;; Used to cache the menu entries for commands in the Buffers menu
1586 (defvar menu-bar-buffers-menu-command-entries nil)
1588 (defun menu-bar-update-buffers (&optional force)
1589 ;; If user discards the Buffers item, play along.
1590 (and (lookup-key (current-global-map) [menu-bar buffer])
1591 (or force (frame-or-buffer-changed-p))
1592 (let ((buffers (buffer-list))
1593 (frames (frame-list))
1594 buffers-menu frames-menu)
1595 ;; If requested, list only the N most recently selected buffers.
1596 (if (and (integerp buffers-menu-max-size)
1597 (> buffers-menu-max-size 1))
1598 (if (> (length buffers) buffers-menu-max-size)
1599 (setcdr (nthcdr buffers-menu-max-size buffers) nil)))
1601 ;; Make the menu of buffers proper.
1604 (mapcar 'list buffers))
1605 (menu-bar-update-buffers-maxbuf 0)
1607 ;; Put into each element of buffer-list
1608 ;; the name for actual display,
1609 ;; perhaps truncated in the middle.
1610 (dolist (buf buffer-list)
1611 (let ((name (buffer-name (car buf))))
1613 (if (> (length name) 27)
1614 (concat (substring name 0 12)
1616 (substring name -12))
1618 ;; Compute the maximum length of any name.
1619 (dolist (buf buffer-list)
1620 (unless (eq ?\ (aref (cdr buf) 0))
1621 (setq menu-bar-update-buffers-maxbuf
1622 (max menu-bar-update-buffers-maxbuf
1623 (length (cdr buf))))))
1624 ;; Set ALIST to an alist of the form
1625 ;; ITEM-STRING . BUFFER
1626 (dolist (buf buffer-list)
1627 (unless (eq ?\ (aref (cdr buf) 0))
1628 (push (menu-bar-update-buffers-1 buf) alist)))
1629 ;; Now make the actual list of items, and add
1630 ;; some miscellaneous buffer commands to the end.
1631 (mapcar (lambda (pair)
1632 ;; This is somewhat risque, to use
1633 ;; the buffer name itself as the event
1634 ;; type to define, but it works.
1635 ;; It would not work to use the buffer
1636 ;; since a buffer as an event has its
1638 (nconc (list (buffer-name (cdr pair))
1641 'menu-bar-select-buffer))
1644 ;; Make a Frames menu if we have more than one frame.
1648 (cons "Select Frame"
1652 (list (frame-parameter frame 'name)
1653 (frame-parameter frame 'name)
1655 'menu-bar-select-frame))
1657 ;; Put it after the normal buffers
1660 `((frames-separator "--")
1661 (frames menu-item "Frames" ,frames-menu))))))
1663 ;; Add in some normal commands at the end of the menu. We use
1664 ;; the copy cached in `menu-bar-buffers-menu-command-entries'
1665 ;; if it's been set already. Note that we can't use constant
1666 ;; lists for the menu-entries, because the low-level menu-code
1668 (unless menu-bar-buffers-menu-command-entries
1669 (setq menu-bar-buffers-menu-command-entries
1670 (list '(command-separator "--")
1675 :help "Switch to the \"next\" buffer in a cyclic order")
1676 (list 'previous-buffer
1680 :help "Switch to the \"previous\" buffer in a cyclic order")
1681 (list 'select-named-buffer
1683 "Select Named Buffer..."
1685 :help "Prompt for a buffer name, and select that buffer in the current window")
1686 (list 'list-all-buffers
1690 :help "Pop up a window listing all emacs buffers"
1693 (nconc buffers-menu menu-bar-buffers-menu-command-entries))
1695 (setq buffers-menu (cons 'keymap (cons "Select Buffer" buffers-menu)))
1696 (define-key (current-global-map) [menu-bar buffer]
1697 ;; Call copy-sequence so the string is not pure.
1698 (cons (copy-sequence "Buffers") buffers-menu)))))
1700 (add-hook 'menu-bar-update-hook 'menu-bar-update-buffers)
1702 (menu-bar-update-buffers)
1704 ;; this version is too slow
1705 ;;(defun format-buffers-menu-line (buffer)
1706 ;; "Returns a string to represent the given buffer in the Buffer menu.
1707 ;;nil means the buffer shouldn't be listed. You can redefine this."
1708 ;; (if (string-match "\\` " (buffer-name buffer))
1711 ;; (set-buffer buffer)
1712 ;; (let ((size (buffer-size)))
1713 ;; (format "%s%s %-19s %6s %-15s %s"
1714 ;; (if (buffer-modified-p) "*" " ")
1715 ;; (if buffer-read-only "%" " ")
1719 ;; (or (buffer-file-name) ""))))))
1721 ;;; Set up a menu bar menu for the minibuffer.
1723 (dolist (map (list minibuffer-local-map
1724 ;; This shouldn't be necessary, but there's a funny
1725 ;; bug in keymap.c that I don't understand yet. -stef
1726 minibuffer-local-completion-map))
1727 (define-key map [menu-bar minibuf]
1728 (cons "Minibuf" (make-sparse-keymap "Minibuf"))))
1730 (let ((map minibuffer-local-completion-map))
1731 (define-key map [menu-bar minibuf ?\?]
1732 (list 'menu-item "List Completions" 'minibuffer-completion-help
1733 :help "Display all possible completions"))
1734 (define-key map [menu-bar minibuf space]
1735 (list 'menu-item "Complete Word" 'minibuffer-complete-word
1736 :help "Complete at most one word"))
1737 (define-key map [menu-bar minibuf tab]
1738 (list 'menu-item "Complete" 'minibuffer-complete
1739 :help "Complete as far as possible")))
1741 (let ((map minibuffer-local-map))
1742 (define-key map [menu-bar minibuf quit]
1743 (list 'menu-item "Quit" 'keyboard-escape-quit
1744 :help "Abort input and exit minibuffer"))
1745 (define-key map [menu-bar minibuf return]
1746 (list 'menu-item "Enter" 'exit-minibuffer
1747 :help "Terminate input and exit minibuffer")))
1750 ;; This comment is taken from tool-bar.el near
1751 ;; (put 'tool-bar-mode ...)
1752 ;; We want to pretend the menu bar by standard is on, as this will make
1753 ;; customize consider disabling the menu bar a customization, and save
1754 ;; that. We could do this for real by setting :init-value below, but
1755 ;; that would overwrite disabling the tool bar from X resources.
1756 (put 'menu-bar-mode 'standard-value '(t))
1759 (define-minor-mode menu-bar-mode
1760 "Toggle display of a menu bar on each frame.
1761 This command applies to all frames that exist and frames to be
1762 created in the future.
1763 With a numeric argument, if the argument is positive,
1764 turn on menu bars; otherwise, turn off menu bars."
1769 ;; Make menu-bar-mode and default-frame-alist consistent.
1770 (modify-all-frames-parameters (list (cons 'menu-bar-lines
1771 (if menu-bar-mode 1 0))))
1773 ;; Make the message appear when Emacs is idle. We can not call message
1774 ;; directly. The minor-mode message "Menu-bar mode disabled" comes
1775 ;; after this function returns, overwriting any message we do here.
1776 (when (and (interactive-p) (not menu-bar-mode))
1777 (run-with-idle-timer 0 nil 'message
1778 "Menu-bar mode disabled. Use M-x menu-bar-mode to make the menu bar appear."))
1783 ;;; arch-tag: 6e6a3c22-4ec4-4d3d-8190-583f8ef94ced
1784 ;;; menu-bar.el ends here