menu-bar.el 59.4 KB
Newer Older
1
;;; menu-bar.el --- define a default menu bar
2

Pavel Janík's avatar
Pavel Janík committed
3
;; Copyright (C) 1993, 1994, 1995, 2000, 2001, 2002 Free Software Foundation, Inc.
Erik Naggum's avatar
Erik Naggum committed
4

5
;; Author: RMS
Richard M. Stallman's avatar
Richard M. Stallman committed
6
;; Maintainer: FSF
7
;; Keywords: internal, mouse
8

Richard M. Stallman's avatar
Richard M. Stallman committed
9 10 11 12 13 14 15 16 17 18 19 20 21
;; This file is part of GNU Emacs.

;; GNU Emacs is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.

;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
Erik Naggum's avatar
Erik Naggum committed
22 23 24
;; along with GNU Emacs; see the file COPYING.  If not, write to the
;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
;; Boston, MA 02111-1307, USA.
Richard M. Stallman's avatar
Richard M. Stallman committed
25

26 27
;; Avishai Yacobi suggested some menu rearrangements.

28 29
;;; Commentary:

Erik Naggum's avatar
Erik Naggum committed
30 31
;;; Code:

32 33
;;; User options:

Richard M. Stallman's avatar
Richard M. Stallman committed
34
(defcustom buffers-menu-max-size 10
35 36 37
  "*Maximum number of entries which may appear on the Buffers menu.
If this is 10, then only the ten most-recently-selected buffers are shown.
If this is nil, then all buffers are shown.
Richard M. Stallman's avatar
Richard M. Stallman committed
38 39 40 41
A large number or nil slows down menu responsiveness."
  :type '(choice integer
		 (const :tag "All" nil))
  :group 'mouse)
42

43 44 45 46
;; Don't clobber an existing menu-bar keymap, to preserve any menu-bar key
;; definitions made in loaddefs.el.
(or (lookup-key global-map [menu-bar])
    (define-key global-map [menu-bar] (make-sparse-keymap "menu-bar")))
47
(defvar menu-bar-help-menu (make-sparse-keymap "Help"))
48 49

;; Force Help item to come last, after the major mode's own items.
50 51 52
;; The symbol used to be called `help', but that gets confused with the
;; help key.
(setq menu-bar-final-items '(help-menu))
53

54
(define-key global-map [menu-bar help-menu] (cons "Help" menu-bar-help-menu))
55 56
(defvar menu-bar-tools-menu (make-sparse-keymap "Tools"))
(define-key global-map [menu-bar tools] (cons "Tools" menu-bar-tools-menu))
57 58 59 60 61 62 63 64 65 66 67
;; This definition is just to show what this looks like.
;; It gets overridden below when menu-bar-update-buffers is called.
(define-key global-map [menu-bar buffer]
  (cons "Buffers" (make-sparse-keymap "Buffers")))
(defvar menu-bar-options-menu (make-sparse-keymap "Options"))
(define-key global-map [menu-bar options]
  (cons "Options" menu-bar-options-menu))
(defvar menu-bar-edit-menu (make-sparse-keymap "Edit"))
(define-key global-map [menu-bar edit] (cons "Edit" menu-bar-edit-menu))
(defvar menu-bar-files-menu (make-sparse-keymap "File"))
(define-key global-map [menu-bar files] (cons "File" menu-bar-files-menu))
68 69 70

;; This alias is for compatibility with 19.28 and before.
(defvar menu-bar-file-menu menu-bar-files-menu)
71 72 73 74

;; This is referenced by some code below; it is defined in uniquify.el
(defvar uniquify-buffer-name-style)

75

76
;; The "File" menu items
77
(define-key menu-bar-files-menu [exit-emacs]
78 79
  '(menu-item "Exit Emacs" save-buffers-kill-emacs
	      :help "Save unsaved buffers, then exit"))
80 81 82 83

(define-key menu-bar-files-menu [separator-exit]
  '("--"))

84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
;; Don't use delete-frame as event name because that is a special
;; event.
(define-key menu-bar-files-menu [delete-this-frame]
  '(menu-item "Delete Frame" delete-frame
	      :visible (fboundp 'delete-frame)
	      :enable (delete-frame-enabled-p)
	      :help "Delete currently selected frame"))
(define-key menu-bar-files-menu [make-frame-on-display]
  '(menu-item "New Frame on Display..." make-frame-on-display
	      :visible (fboundp 'make-frame-on-display)
	      :help "Open a new frame on another display"))
(define-key menu-bar-files-menu [make-frame]
  '(menu-item "New Frame" make-frame-command
	      :visible (fboundp 'make-frame-command)
	      :help "Open a new frame"))

100
(define-key menu-bar-files-menu [one-window]
101 102 103
  '(menu-item "Unsplit Windows" delete-other-windows
	      :enable (not (one-window-p t nil))
	      :help "Make selected window fill its frame"))
104 105

(define-key menu-bar-files-menu [split-window]
106 107 108 109 110 111 112
  '(menu-item "Split Window" split-window-vertically
	      :help "Split selected window in two"))

(define-key menu-bar-files-menu [separator-window]
  '(menu-item "--"))

(define-key menu-bar-files-menu [ps-print-region]
113 114 115 116 117 118 119
  '(menu-item "Postscript Print Region (B+W)" ps-print-region
	      :enable mark-active
	      :help "Pretty-print marked region in black and white to PostScript printer"))
(define-key menu-bar-files-menu [ps-print-buffer]
  '(menu-item "Postscript Print Buffer (B+W)" ps-print-buffer
	      :help "Pretty-print current buffer in black and white to PostScript printer"))
(define-key menu-bar-files-menu [ps-print-region-faces]
120 121 122
  '(menu-item "Postscript Print Region" ps-print-region-with-faces
	      :enable mark-active
	      :help "Pretty-print marked region to PostScript printer"))
123
(define-key menu-bar-files-menu [ps-print-buffer-faces]
124 125 126 127 128 129 130 131 132 133 134 135
  '(menu-item "Postscript Print Buffer" ps-print-buffer-with-faces
	      :help "Pretty-print current buffer to PostScript printer"))
(define-key menu-bar-files-menu [print-region]
  '(menu-item "Print Region" print-region
	      :enable mark-active
	      :help "Print region between mark and current position"))
(define-key menu-bar-files-menu [print-buffer]
  '(menu-item "Print Buffer" print-buffer
	      :help "Print current buffer with page headings"))

(define-key menu-bar-files-menu [separator-print]
  '(menu-item "--"))
136

137
(define-key menu-bar-files-menu [recover-session]
138 139
  '(menu-item "Recover Crashed Session..." recover-session
	      :enable (and auto-save-list-file-prefix
140 141 142
			   (file-directory-p
                            (file-name-directory auto-save-list-file-prefix))
                           (directory-files
143 144 145 146 147 148 149 150
			    (file-name-directory auto-save-list-file-prefix)
			    nil
			    (concat "\\`"
				    (regexp-quote
				     (file-name-nondirectory
				      auto-save-list-file-prefix)))
			    t))
	      :help "Recover edits from a crashed session"))
151
(define-key menu-bar-files-menu [revert-buffer]
152 153 154 155 156 157 158 159
  '(menu-item "Revert Buffer" revert-buffer
	      :enable (or revert-buffer-function
			  revert-buffer-insert-file-contents-function
			  (and (buffer-file-name)
			       (or (buffer-modified-p)
				   (not (verify-visited-file-modtime
					 (current-buffer))))))
	      :help "Re-read current buffer from its file"))
160
(define-key menu-bar-files-menu [write-file]
161 162 163 164 165 166 167
  '(menu-item "Save Buffer As..." write-file
	      :enable (not (window-minibuffer-p
			    (frame-selected-window menu-updating-frame)))
	      :help "Write current buffer to another file"))
(define-key menu-bar-files-menu [save-buffer]
  '(menu-item "Save (current buffer)" save-buffer
	      :enable (and (buffer-modified-p)
168
			   (buffer-file-name)
169 170 171 172 173 174 175 176 177 178
			   (not (window-minibuffer-p
				 (frame-selected-window menu-updating-frame))))
	      :help "Save current buffer to its file"))

(define-key menu-bar-files-menu [separator-save]
  '(menu-item "--"))

(define-key menu-bar-files-menu [kill-buffer]
  '(menu-item "Close (current buffer)" kill-this-buffer
	      :enable (kill-this-buffer-enabled-p)
179
	      :help "Discard current buffer"))
180 181 182 183 184 185 186 187 188 189 190 191 192 193
(define-key menu-bar-files-menu [insert-file]
  '(menu-item "Insert File..." insert-file
	      :enable (not (window-minibuffer-p
			    (frame-selected-window menu-updating-frame)))
	      :help "Insert another file into current buffer"))
(define-key menu-bar-files-menu [dired]
  '(menu-item "Open Directory..." dired
	      :help "Read a directory, operate on its files"))
(define-key menu-bar-files-menu [open-file]
  '(menu-item "Open File..." find-file
	      :enable (not (window-minibuffer-p
			    (frame-selected-window menu-updating-frame)))
	      :help "Read a file into an Emacs buffer"))

194

195
;; The "Edit" menu items
196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227
(defun nonincremental-search-forward (string)
  "Read a string and search for it nonincrementally."
  (interactive "sSearch for string: ")
  (if (equal string "")
      (search-forward (car search-ring))
    (isearch-update-ring string nil)
    (search-forward string)))

(defun nonincremental-search-backward (string)
  "Read a string and search backward for it nonincrementally."
  (interactive "sSearch for string: ")
  (if (equal string "")
      (search-backward (car search-ring))
    (isearch-update-ring string nil)
    (search-backward string)))

(defun nonincremental-re-search-forward (string)
  "Read a regular expression and search for it nonincrementally."
  (interactive "sSearch for regexp: ")
  (if (equal string "")
      (re-search-forward (car regexp-search-ring))
    (isearch-update-ring string t)
    (re-search-forward string)))

(defun nonincremental-re-search-backward (string)
  "Read a regular expression and search backward for it nonincrementally."
  (interactive "sSearch for regexp: ")
  (if (equal string "")
      (re-search-backward (car regexp-search-ring))
    (isearch-update-ring string t)
    (re-search-backward string)))

228
(defun nonincremental-repeat-search-forward ()
229 230
  "Search forward for the previous search string."
  (interactive)
231 232
  (if (null search-ring)
      (error "No previous search"))
233 234
  (search-forward (car search-ring)))

235
(defun nonincremental-repeat-search-backward ()
236 237
  "Search backward for the previous search string."
  (interactive)
238 239
  (if (null search-ring)
      (error "No previous search"))
240 241
  (search-backward (car search-ring)))

242
(defun nonincremental-repeat-re-search-forward ()
243 244
  "Search forward for the previous regular expression."
  (interactive)
Richard M. Stallman's avatar
Richard M. Stallman committed
245
  (if (null regexp-search-ring)
246
      (error "No previous search"))
247 248
  (re-search-forward (car regexp-search-ring)))

249
(defun nonincremental-repeat-re-search-backward ()
250 251
  "Search backward for the previous regular expression."
  (interactive)
Richard M. Stallman's avatar
Richard M. Stallman committed
252
  (if (null regexp-search-ring)
253
      (error "No previous search"))
254 255
  (re-search-backward (car regexp-search-ring)))

256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291
(defvar menu-bar-search-menu (make-sparse-keymap "Search"))
(defvar menu-bar-adv-search-menu
  (make-sparse-keymap "Advanced Search/Replace"))

(define-key menu-bar-adv-search-menu [tags-continue]
  '(menu-item "Continue Tags Search/Replace" tags-loop-continue
	      :help "Continue last tags search/replace operation"))
(define-key menu-bar-adv-search-menu [tags-repl]
  '(menu-item "Replace in all tagged files" tags-query-replace
	      :help "Interactively replace a regexp in all tagged files"))
(define-key menu-bar-adv-search-menu [tags-srch]
  '(menu-item "Search in all tagged files" tags-search
	      :help "Search for a regexp in all tagged files"))

(define-key menu-bar-adv-search-menu [separator-tag-search]
  '(menu-item "--"))

(define-key menu-bar-adv-search-menu [query-replace-regexp]
  '(menu-item "Replace Regexp..." query-replace-regexp
	      :enable (not buffer-read-only)
	      :help "Replace regular expression, ask about each occurrence"))
(define-key menu-bar-adv-search-menu [repeat-regexp-back]
  '(menu-item "Repeat Regexp Backwards"
	      nonincremental-repeat-re-search-backward
	      :enable regexp-search-ring
	      :help "Repeat last regular expression search backwards"))
(define-key menu-bar-adv-search-menu [repeat-regexp-fwd]
  '(menu-item "Repeat Regexp" nonincremental-repeat-re-search-forward
	      :enable regexp-search-ring
	      :help "Repeat last regular expression search forward"))
(define-key menu-bar-adv-search-menu [re-search-backward]
  '(menu-item "Search Regexp Backwards..." nonincremental-re-search-backward
	      :help "Search backwards for a regular expression"))
(define-key menu-bar-adv-search-menu [re-search-forward]
  '(menu-item "Search Regexp..." nonincremental-re-search-forward
	      :help "Search forward for a regular expression"))
292 293 294 295
(define-key menu-bar-adv-search-menu [separator-tag-isearch]
  '(menu-item "--"))
(define-key menu-bar-adv-search-menu [isearch-backward]
  '(menu-item "Incremental Search Backwards..." isearch-backward
296
	      :help "Search backwards for a string as you type it"))
297 298
(define-key menu-bar-adv-search-menu [isearch-forward]
  '(menu-item "Incremental Search..." isearch-forward
299
	      :help "Search forward for a string as you type it"))
300 301 302
(define-key menu-bar-search-menu [re-search]
  (list 'menu-item "Advanced Search/Replace" menu-bar-adv-search-menu
	      :help "Regexp and Tags search and replace"))
303

304 305 306 307
(define-key menu-bar-search-menu [query-replace]
  '(menu-item "Replace..." query-replace
	      :enable (not buffer-read-only)
	      :help "Replace string interactively, ask about each occurrence"))
308
(define-key menu-bar-search-menu [repeat-search-back]
309 310 311
  '(menu-item "Repeat Backwards" nonincremental-repeat-search-backward
	      :enable search-ring
	      :help "Repeat last search backwards"))
312
(define-key menu-bar-search-menu [repeat-search-fwd]
313 314 315
  '(menu-item "Repeat Search" nonincremental-repeat-search-forward
	      :enable search-ring
	      :help "Repeat last search forward"))
316
(define-key menu-bar-search-menu [search-backward]
317 318
  '(menu-item "Search Backwards..." nonincremental-search-backward
	      :help "Search backwards for a string"))
319
(define-key menu-bar-search-menu [search-forward]
320 321
  '(menu-item "Search..." nonincremental-search-forward
	      :help "Search forward for a string"))
322

323 324 325 326
;;; Assemble the top-level Edit menu items.
(define-key menu-bar-edit-menu [props]
  '(menu-item "Text Properties" facemenu-menu
	      :help "Change properties of text in region"))
327

328 329 330 331 332 333 334
(define-key menu-bar-edit-menu [fill]
  '(menu-item "Fill" fill-region
	      :enable (and mark-active (not buffer-read-only))
	      :help
	      "Fill text in region to fit between left and right margin"))

(define-key menu-bar-edit-menu [separator-bookmark]
335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354
  '(menu-item "--"))

(define-key menu-bar-edit-menu [bookmark]
  '(menu-item "Bookmarks" menu-bar-bookmark-map
	      :help "Record positions and jump between them"))

(defvar menu-bar-goto-menu (make-sparse-keymap "Go To"))

(define-key menu-bar-goto-menu [set-tags-name]
  '(menu-item "Set Tags File Name" visit-tags-table
	      :help "Tell Tags commands which tag table file to use"))

(define-key menu-bar-goto-menu [separator-tag-file]
  '(menu-item "--"))

(define-key menu-bar-goto-menu [apropos-tags]
  '(menu-item "Tags Apropos" tags-apropos
	      :help "Find function/variables whose names match regexp"))
(define-key menu-bar-goto-menu [next-tag-otherw]
  '(menu-item "Next Tag in Other Window"
355
	      (lambda () (interactive)  (find-tag-other-window nil t))
356 357
	      :enable (and (boundp 'tags-location-ring)
			   (not (ring-empty-p tags-location-ring)))
358 359 360
	      :help "Find next function/variable matching last tag name in another window"))
(define-key menu-bar-goto-menu [next-tag]
  '(menu-item "Find Next Tag"
361
	      (lambda () (interactive) (find-tag nil t))
362 363
	      :enable (and (boundp 'tags-location-ring)
			   (not (ring-empty-p tags-location-ring)))
364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391
	      :help "Find next function/variable matching last tag name"))
(define-key menu-bar-goto-menu [find-tag-otherw]
  '(menu-item "Find Tag in Other Window..." find-tag-other-window
	      :help "Find function/variable definition in another window"))
(define-key menu-bar-goto-menu [find-tag]
  '(menu-item "Find Tag..." find-tag
	      :help "Find definition of function or variable"))

(define-key menu-bar-goto-menu [separator-tags]
  '(menu-item "--"))

(define-key menu-bar-goto-menu [end-of-buf]
  '(menu-item "Goto End of Buffer" end-of-buffer))
(define-key menu-bar-goto-menu [beg-of-buf]
  '(menu-item "Goto Beginning of Buffer" beginning-of-buffer))
(define-key menu-bar-goto-menu [go-to-pos]
  '(menu-item "Goto Buffer Position..." goto-char
	      :help "Read a number N and go to buffer position N"))
(define-key menu-bar-goto-menu [go-to-line]
  '(menu-item "Goto Line..." goto-line
	      :help "Read a line number and go to that line"))

(define-key menu-bar-edit-menu [goto]
  (list 'menu-item "Go To" menu-bar-goto-menu))

(define-key menu-bar-edit-menu [search]
  (list 'menu-item "Search" menu-bar-search-menu))

392 393 394
(define-key menu-bar-edit-menu [separator-search]
  '(menu-item "--"))

395 396 397
(define-key menu-bar-edit-menu [mark-whole-buffer]
  '(menu-item "Select All" mark-whole-buffer
	      :help "Mark the whole buffer for a subsequent cut/copy."))
398 399 400 401 402 403
(define-key menu-bar-edit-menu [clear]
  '(menu-item "Clear" delete-region
	      :enable (and mark-active
			   (not buffer-read-only)
			   (not (mouse-region-match)))
	      :help
404
	      "Delete the text in region between mark and current position"))
405 406
(defvar yank-menu (cons "Select Yank" nil))
(fset 'yank-menu (cons 'keymap yank-menu))
407 408 409
(define-key menu-bar-edit-menu [select-paste]
  '(menu-item "Select and Paste" yank-menu
	      :enable (and (cdr yank-menu) (not buffer-read-only))
410
	      :help "Paste (yank) text cut or copied earlier"))
411 412
(define-key menu-bar-edit-menu [paste]
  '(menu-item "Paste" yank
413 414 415 416 417
	      :enable (and
		       ;; Emacs compiled --without-x doesn't have
		       ;; x-selection-exists-p.
		       (fboundp 'x-selection-exists-p)
		       (x-selection-exists-p) (not buffer-read-only))
418
	      :help "Paste (yank) text most recently cut/copied"))
419 420 421
(define-key menu-bar-edit-menu [copy]
  '(menu-item "Copy" menu-bar-kill-ring-save
	      :enable mark-active
422 423
	      :help "Copy text in region between mark and current position"
	      :keys "\\[kill-ring-save]"))
424 425 426
(define-key menu-bar-edit-menu [cut]
  '(menu-item "Cut" kill-region
	      :enable (and mark-active (not buffer-read-only))
427 428
	      :help
	      "Cut (kill) text in region between mark and current position"))
429 430 431 432 433 434 435 436 437
(define-key menu-bar-edit-menu [undo]
  '(menu-item "Undo" undo
	      :enable (and (not buffer-read-only)
			   (not (eq t buffer-undo-list))
			   (if (eq last-command 'undo)
			       pending-undo-list
			     (consp buffer-undo-list)))
	      :help "Undo last operation"))

438

439 440 441
(defun menu-bar-kill-ring-save (beg end)
  (interactive "r")
  (if (mouse-region-match)
442
      (message "Selecting a region with the mouse does `copy' automatically")
443 444
    (kill-ring-save beg end)))

445 446
(autoload 'ispell-menu-map "ispell" nil t 'keymap)

447
;; These are alternative definitions for the cut, paste and copy
448
;; menu items.  Use them if your system expects these to use the clipboard.
449 450 451 452

(put 'clipboard-kill-region 'menu-enable 'mark-active)
(put 'clipboard-kill-ring-save 'menu-enable 'mark-active)
(put 'clipboard-yank 'menu-enable
453 454
     '(or (and (fboundp 'x-selection-exists-p) (x-selection-exists-p))
	  (x-selection-exists-p 'CLIPBOARD)))
455 456

(defun clipboard-yank ()
457
  "Insert the clipboard contents, or the last stretch of killed text."
458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474
  (interactive)
  (let ((x-select-enable-clipboard t))
    (yank)))

(defun clipboard-kill-ring-save (beg end)
  "Copy region to kill ring, and save in the X clipboard."
  (interactive "r")
  (let ((x-select-enable-clipboard t))
    (kill-ring-save beg end)))

(defun clipboard-kill-region (beg end)
  "Kill the region, and save it in the X clipboard."
  (interactive "r")
  (let ((x-select-enable-clipboard t))
    (kill-region beg end)))

(defun menu-bar-enable-clipboard ()
475 476
  "Make CUT, PASTE and COPY (keys and menu bar items) use the clipboard.
Do the same for the keys of the same name."
477
  (interactive)
478 479 480
  ;; We can't use constant list structure here because it becomes pure,
  ;; and because it gets modified with cache data.
  (define-key menu-bar-edit-menu [paste]
481
    (cons "Paste" (cons "Paste text from clipboard" 'clipboard-yank)))
482
  (define-key menu-bar-edit-menu [copy]
483 484
    (cons "Copy" (cons "Copy text in region to the clipboard"
		       'clipboard-kill-ring-save)))
485
  (define-key menu-bar-edit-menu [cut]
486 487
    (cons "Cut" (cons "Delete text in region and copy it to the clipboard"
		      'clipboard-kill-region)))
488 489 490 491 492 493 494 495

  (define-key global-map [f20] 'clipboard-kill-region)
  (define-key global-map [f16] 'clipboard-kill-ring-save)
  (define-key global-map [f18] 'clipboard-yank)
  ;; X11R6 versions
  (define-key global-map [cut] 'clipboard-kill-region)
  (define-key global-map [copy] 'clipboard-kill-ring-save)
  (define-key global-map [paste] 'clipboard-yank))
496

497
;; The "Options" menu items
498 499 500

(defvar menu-bar-custom-menu (make-sparse-keymap "Customize"))

501
(define-key menu-bar-custom-menu [customize-apropos-groups]
502 503
  '(menu-item "Groups Matching Regexp..." customize-apropos-groups
	      :help "Browse groups whose names match regexp"))
504
(define-key menu-bar-custom-menu [customize-apropos-faces]
505 506
  '(menu-item "Faces Matching Regexp..." customize-apropos-faces
	      :help "Browse faces whose names match regexp"))
507
(define-key menu-bar-custom-menu [customize-apropos-options]
508 509
  '(menu-item "Options Matching Regexp..." customize-apropos-options
	      :help "Browse options whose names match regexp"))
510
(define-key menu-bar-custom-menu [customize-apropos]
511 512
  '(menu-item "Settings Matching Regexp..." customize-apropos
	      :help "Browse customizable settings whose names match regexp"))
513
(define-key menu-bar-custom-menu [separator-1]
514
  '("--"))
Richard M. Stallman's avatar
Richard M. Stallman committed
515
(define-key menu-bar-custom-menu [customize-group]
516 517
  '(menu-item "Specific Group..." customize-group
	      :help "Customize settings of specific group"))
518
(define-key menu-bar-custom-menu [customize-face]
519 520
  '(menu-item "Specific Face..." customize-face
	      :help "Customize attributes of specific face"))
521
(define-key menu-bar-custom-menu [customize-option]
522
  '(menu-item "Specific Option..." customize-option
523 524 525
	      :help "Customize value of specific option"))
(define-key menu-bar-custom-menu [separator-2]
  '("--"))
Dan Nicolaescu's avatar
Dan Nicolaescu committed
526
(define-key menu-bar-custom-menu [customize-changed-options]
527 528 529 530 531
  '(menu-item "New Options..." customize-changed-options
	      :help "Options added or changed in recent Emacs versions"))
(define-key menu-bar-custom-menu [customize-saved]
  '(menu-item "Saved Options" customize-saved
	      :help "Customize previously saved options"))
532 533
(define-key menu-bar-custom-menu [separator-3]
  '("--"))
Per Abrahamsen's avatar
Per Abrahamsen committed
534
(define-key menu-bar-custom-menu [customize-browse]
535 536
  '(menu-item "Browse Customization Groups" customize-browse
	      :help "Browse all customization groups"))
537
(define-key menu-bar-custom-menu [customize]
538 539
  '(menu-item "Top-level Customization Group" customize
	      :help "The master group called `Emacs'"))
540

541
;(defvar menu-bar-preferences-menu (make-sparse-keymap "Preferences"))
542

543
(defmacro menu-bar-make-toggle (name variable doc message help &optional props &rest body)
544 545
  `(progn
     (defun ,name ()
546 547
       ,(concat "Toggle whether to " (downcase (substring help 0 1))
		(substring help 1) ".")
548 549
       (interactive)
       (if ,(if body `(progn . ,body)
550
	      `(progn
551 552 553 554 555
		 (custom-load-symbol ',variable)
		 (let ((set (or (get ',variable 'custom-set) 'set-default))
		       (get (or (get ',variable 'custom-get) 'default-value)))
		   (funcall set ',variable (not (funcall get ',variable))))))
	   (message ,message "enabled")
556
  	 (message ,message "disabled")))
557 558 559 560 561 562
     ;; The function `customize-mark-as-set' must only be called when
     ;; a variable is set interactively, as the purpose is to mark it
     ;; as a candidate for "Save Options", and we do not want to save
     ;; options the user have already set explicitly in his init
     ;; file.  Unfortunately, he could very likely call the function
     ;; defined above there.  So we put `customize-mark-as-set' in a
563
     ;; lambda expression.
564 565 566 567 568
     ;; -- Per Abrahamsen <abraham@dina.kvl.dk> 2002-02-11.
     '(menu-item ,doc (lambda ()
			(interactive)
			(,name)
			(customize-mark-as-set ',variable))
569
		 ,@(if props props)
570
		 :help ,help
571 572
                 :button (:toggle . (and (default-boundp ',variable)
					 (default-value ',variable))))))
573 574 575 576 577

;;; Assemble all the top-level items of the "Options" menu
(define-key menu-bar-options-menu [customize]
  (list 'menu-item "Customize Emacs" menu-bar-custom-menu
	:help "Full customization of every Emacs feature"))
578 579 580 581

(defun menu-bar-options-save ()
  "Save current values of Options menu items using Custom."
  (interactive)
582
  (let ((need-save nil))
583 584 585 586
    ;; These are set with `customize-set-variable'.
    (dolist (elt '(line-number-mode column-number-mode scroll-bar-mode
		   debug-on-quit debug-on-error menu-bar-mode tool-bar-mode
		   save-place uniquify-buffer-name-style
587
		   case-fold-search cua-mode show-paren-mode
588
		   transient-mark-mode global-font-lock-mode
589
		   display-time-mode auto-compression-mode
590
		   current-language-environment default-input-method
591 592 593 594 595 596 597 598 599 600
		   ;; Saving `text-mode-hook' is somewhat questionable,
		   ;; as we might get more than we bargain for, if
		   ;; other code may has added hooks as well.
		   ;; Nonetheless, not saving it would like be confuse
		   ;; more often.
		   ;; -- Per Abrahamsen <abraham@dina.kvl.dk> 2002-02-11.
		   text-mode-hook))
      (and (get elt 'customized-value)
	   (customize-mark-to-save elt)
	   (setq need-save t)))
601 602 603
    ;; Save if we changed anything.
    (when need-save
      (custom-save-all))))
604 605

(define-key menu-bar-options-menu [save]
606
  '(menu-item "Save Options" menu-bar-options-save
607 608 609 610 611
	      :help "Save options set from the menu above"))

(define-key menu-bar-options-menu [custom-separator]
  '("--"))

612 613 614
;; The "Show/Hide" submenu of menu "Options"

(defvar menu-bar-showhide-menu (make-sparse-keymap "Show/Hide"))
615

616
(define-key menu-bar-showhide-menu [column-number-mode]
617
  (menu-bar-make-toggle toggle-column-number-mode column-number-mode
618 619
			"Show Column Numbers" "Column number mode %s"
			"Show the current column number in the mode line"))
620 621

(define-key menu-bar-showhide-menu [line-number-mode]
622
  (menu-bar-make-toggle toggle-line-number-mode line-number-mode
623 624
			"Show Line Numbers" "Line number mode %s"
			"Show the current line number in the mode line"))
625 626 627 628

(define-key menu-bar-showhide-menu [linecolumn-separator]
  '("--"))

629 630 631 632 633 634 635 636
(defun showhide-date-time ()
  "Toggle whether to show date and time in the mode-line."
  (interactive)
  (if (display-time-mode)
      (message "Display-time mode enabled.")
    (message "Display-time mode disabled.")))

(define-key menu-bar-showhide-menu [showhide-date-time]
637
  '(menu-item "Date and Time" (lambda ()
638 639 640
				(interactive)
				(showhide-date-time)
				(customize-mark-as-set 'display-time-mode))
641
	      :help "Display date and time in the mode line"
642 643 644 645 646
	      :button (:toggle . display-time-mode)))

(define-key menu-bar-showhide-menu [datetime-separator]
  '("--"))

647 648
(define-key menu-bar-showhide-menu [showhide-speedbar]
  '(menu-item "Speedbar" speedbar-frame-mode
649
	      :help "Display a Speedbar quick-navigation frame"
650 651 652
	      :button (:toggle
		       . (and (boundp 'speedbar-frame)
			      (frame-live-p (symbol-value 'speedbar-frame))
653
			      (frame-visible-p
654 655
			       (symbol-value 'speedbar-frame))))))

656 657 658
(defvar menu-bar-showhide-scroll-bar-menu (make-sparse-keymap "Scroll-bar"))

(define-key menu-bar-showhide-scroll-bar-menu [right]
659
  '(menu-item "On the Right"
660 661 662
	      (lambda ()
		(interactive)
		(customize-set-variable 'scroll-bar-mode 'right))
663
	      :help "Scroll-bar on the right side"
664
	      :visible (display-graphic-p)
665 666
	      :button (:radio . (eq (cdr (assq 'vertical-scroll-bars
					       (frame-parameters))) 'right))))
667 668

(define-key menu-bar-showhide-scroll-bar-menu [left]
669
  '(menu-item "On the Left"
670 671 672
	      (lambda ()
		(interactive)
		(customize-set-variable 'scroll-bar-mode 'left))
673
	      :help "Scroll-bar on the left side"
674
	      :visible (display-graphic-p)
675 676
	      :button (:radio . (eq (cdr (assq 'vertical-scroll-bars
					       (frame-parameters))) 'left))))
677 678

(define-key menu-bar-showhide-scroll-bar-menu [none]
679
  '(menu-item "None"
680 681 682
	      (lambda ()
		(interactive)
		(customize-set-variable 'scroll-bar-mode nil))
683
	      :help "Turn off scroll-bar"
684
	      :visible (display-graphic-p)
685 686
	      :button (:radio . (eq (cdr (assq 'vertical-scroll-bars
					       (frame-parameters))) nil))))
687 688

(define-key menu-bar-showhide-menu [showhide-scroll-bar]
689
  (list 'menu-item "Scroll-bar" menu-bar-showhide-scroll-bar-menu
690
	:visible `(display-graphic-p)
691 692 693 694 695 696 697 698
	:help "Select scroll-bar mode"))

(defun showhide-menu-bar ()
  "Toggle whether to turn menu-bar on/off."
  (interactive)
  (menu-bar-mode)
  (if menu-bar-mode
      (message "Menu-bar mode enabled.")
699 700
    (message "Menu-bar mode disabled.  Use M-x menu-bar-mode to make the menu bar appear."))
  (customize-mark-as-set 'menu-bar-mode))
701 702

(define-key menu-bar-showhide-menu [showhide-menu-bar]
703
  '(menu-item "Menu-bar" showhide-menu-bar
704 705 706
	      :help "Toggle menu-bar on/off"
	      :button (:toggle . menu-bar-mode)))

707
(defun showhide-toolbar ()
708 709 710 711
  "Toggle whether to turn tool-bar on/off."
  (interactive)
  (if (tool-bar-mode)
      (message "Tool-bar mode enabled.")
712 713
    (message "Tool-bar mode disabled."))
  (customize-mark-as-set 'tool-bar-mode))
714 715

(define-key menu-bar-showhide-menu [showhide-tool-bar]
716 717 718 719
  (list 'menu-item "Tool-bar" 'showhide-toolbar
	:help "Turn tool-bar on/off"
	:visible `(display-graphic-p)
	:button `(:toggle . tool-bar-mode)))
720 721 722 723 724 725 726 727

(define-key menu-bar-options-menu [showhide]
  (list 'menu-item "Show/Hide" menu-bar-showhide-menu
	:help "Toggle on/off various display features"))

(define-key menu-bar-options-menu [showhide-separator]
  '("--"))

728 729 730 731 732
(define-key menu-bar-options-menu [mule]
  ;; It is better not to use backquote here,
  ;; because that makes a bootstrapping problem
  ;; if you need to recompile all the Lisp files using interpreted code.
  (list 'menu-item "Mule (Multilingual Environment)" mule-menu-keymap
733 734 735
;; Most of the MULE menu actually does make sense in unibyte mode,
;; e.g. language selection.
;;;	':visible 'default-enable-multibyte-characters
736 737 738 739 740 741 742
	':help "Default language, encodings, input method"))
;(setq menu-bar-final-items (cons 'mule menu-bar-final-items))
;(define-key menu-bar-options-menu [preferences]
;  (list 'menu-item "Preferences" menu-bar-preferences-menu
;	:help "Toggle important global options"))

(define-key menu-bar-options-menu [mule-separator]
743
  '("--"))
744 745 746

(define-key menu-bar-options-menu [debug-on-quit]
  (menu-bar-make-toggle toggle-debug-on-quit debug-on-quit
747
			"Enter Debugger on Quit/C-g" "Debug on Quit %s"
748
			"Enter Lisp debugger when C-g is pressed"))
749 750
(define-key menu-bar-options-menu [debug-on-error]
  (menu-bar-make-toggle toggle-debug-on-error debug-on-error
751 752
			"Enter Debugger on Error" "Debug on Error %s"
			"Enter Lisp debugger when an error is signaled"))
753
(define-key menu-bar-options-menu [debugger-separator]
754
  '("--"))
755 756
(define-key menu-bar-options-menu [toggle-auto-compression]
  '(menu-item "Automatic File De/compression"
757 758 759 760 761 762 763
	      (lambda ()
		(interactive)
		(auto-compression-mode)
		(customize-mark-as-set 'auto-compression-mode))
	      :help "Transparently decompress compressed files"
	      :button (:toggle . (rassq 'jka-compr-handler
					file-name-handler-alist))))
764 765
(define-key menu-bar-options-menu [save-place]
  (menu-bar-make-toggle toggle-save-place-globally save-place
766
			"Save Place in Files between Sessions"
767
			"Saving place in files %s"
768 769
			"Save Emacs state for next session"))

770 771
(define-key menu-bar-options-menu [uniquify]
  (menu-bar-make-toggle toggle-uniquify-buffer-names uniquify-buffer-name-style
772
			"Use Directory Names in Buffer Names"
773
			"Directory name in buffer names (uniquify) %s"
774
			"Uniquify buffer names by adding parent directory names"
775
			() ; no props
776 777 778 779
			(require 'uniquify)
			(setq uniquify-buffer-name-style
			      (if (not uniquify-buffer-name-style)
				  'forward))))
780

781 782
(define-key menu-bar-options-menu [edit-options-separator]
  '("--"))
783 784 785 786 787 788 789 790 791 792
(define-key menu-bar-options-menu [cua-mode]
  '(menu-item "CUA-style cut and paste"
	      (lambda ()
		(interactive)
		(cua-mode nil)
		(customize-mark-as-set 'cua-mode)
		(message "CUA-style cut and paste %s"
			 (if cua-mode "enabled" "disabled")))
	      :help "Use C-z/C-x/C-c/C-v keys for undo/cut/copy/paste"
	      :button (:toggle . cua-mode)))
793 794
(define-key menu-bar-options-menu [case-fold-search]
  (menu-bar-make-toggle toggle-case-fold-search case-fold-search
795 796
			"Case-Insensitive Search"
			"Case-Insensitive Search %s"
797
			"Ignore letter-case in search"))
798 799
(define-key menu-bar-options-menu [auto-fill-mode]
  '(menu-item "Word Wrap in Text Modes (Auto Fill)"
800 801 802 803
              (lambda ()
		(interactive)
		(toggle-text-mode-auto-fill)
		;; This is somewhat questionable, as `text-mode-hook'
804
		;; might have changed outside customize.
805 806
		;; -- Per Abrahamsen <abraham@dina.kvl.dk> 2002-02-11.
		(customize-mark-as-set 'text-mode-hook))
807
	      :help "Automatically fill text between left and right margins"
808 809 810
              :button (:toggle . (if (listp text-mode-hook)
				     (member 'turn-on-auto-fill text-mode-hook)
				   (eq 'turn-on-auto-fill text-mode-hook)))))
811
(define-key menu-bar-options-menu [truncate-lines]
812 813 814 815 816
  '(menu-item "Truncate Long Lines in this Buffer"
	      (lambda ()
		(interactive)
		(setq truncate-lines (not truncate-lines))
		(set-buffer-modified-p (buffer-modified-p))
817
		(message "Truncate long lines %s"
818 819 820 821
			 (if truncate-lines "enabled" "disabled")))
	      :help "Truncate long lines on the screen"
	      :button (:toggle . truncate-lines)))

822 823 824 825
(define-key menu-bar-options-menu [highlight-separator]
  '("--"))
(define-key menu-bar-options-menu [highlight-paren-mode]
  (menu-bar-make-toggle toggle-highlight-paren-mode show-paren-mode
826
			"Paren Match Highlighting (Show Paren mode)"
827
			"Show Paren mode %s"
828
			"Highlight matching/mismatched parentheses at cursor"))
829 830
(define-key menu-bar-options-menu [transient-mark-mode]
  (menu-bar-make-toggle toggle-transient-mark-mode transient-mark-mode
831
			"Active Region Highlighting (Transient Mark mode)"
832
			"Transient Mark mode %s"
833 834
			"Make text in active region stand out in color"
			(:enable (not cua-mode))))
835
(define-key menu-bar-options-menu [toggle-global-lazy-font-lock-mode]
836
  (menu-bar-make-toggle toggle-global-lazy-font-lock-mode global-font-lock-mode
837
			"Syntax Highlighting (Global Font Lock mode)"
838
			"Global Font Lock mode %s"
839
			"Colorize text based on language syntax"))
840

841

842 843
;; The "Tools" menu items

844 845 846 847 848 849 850 851 852 853 854 855 856
(defun send-mail-item-name ()
  (let* ((known-send-mail-commands '((sendmail-user-agent . "sendmail")
				     (mh-e-user-agent . "MH")
				     (message-user-agent . "Gnus Message")
				     (gnus-user-agent . "Gnus")))
	 (name (assq mail-user-agent known-send-mail-commands)))
    (if name
	(setq name (cdr name))
      (setq name (symbol-name mail-user-agent))
      (if (string-match "\\(.+\\)-user-agent" name)
	  (setq name (match-string 1 name))))
    name))

857 858 859 860 861 862 863
(defun read-mail-item-name ()
  (let* ((known-rmail-commands '((rmail . "RMAIL")
				 (mh-rmail . "MH")
				 (gnus . "Gnus")))
	 (known (assq read-mail-command known-rmail-commands)))
    (if known (cdr known) (symbol-name read-mail-command))))

864 865 866 867 868 869 870 871
(defvar menu-bar-games-menu (make-sparse-keymap "Games"))

(define-key menu-bar-tools-menu [games]
  (list 'menu-item "Games" menu-bar-games-menu))

(define-key menu-bar-tools-menu [separator-games]
  '("--"))

872 873 874
(define-key menu-bar-games-menu [zone]
  '(menu-item "Zone Out"  zone
	      :help "Play tricks with Emacs display when Emacs is idle"))
875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906
(define-key menu-bar-games-menu [yow]
  '(menu-item "Random Quotation"  yow
	      :help "Display a random Zippy quotation"))
(define-key menu-bar-games-menu [tetris]
  '(menu-item "Tetris"  tetris))
(define-key menu-bar-games-menu [solitaire]
  '(menu-item "Solitaire"  solitaire))
(define-key menu-bar-games-menu [snake]
  '(menu-item "Snake"  snake
	      :help "Move snake around avoiding collisions"))
(define-key menu-bar-games-menu [mult]
  '(menu-item "Multiplication Puzzle"  mpuz
	      :help "Excercise brain with multiplication"))
(define-key menu-bar-games-menu [life]
  '(menu-item "Life"  life
	      :help "Watch how John Conway's cellular automaton evolves"))
(define-key menu-bar-games-menu [hanoi]
  '(menu-item "Towers of Hanoi" hanoi
	      :help "Watch Towers-of-Hanoi puzzle solved by Emacs"))
(define-key menu-bar-games-menu [gomoku]
  '(menu-item "Gomoku"  gomoku
	      :help "Mark 5 contiguous squares (like tic-tac-toe)"))
(define-key menu-bar-games-menu [black-box]
  '(menu-item "Blackbox"  blackbox
	      :help "Find balls in a black box by shooting rays"))
(define-key menu-bar-games-menu [adventure]
  '(menu-item "Adventure"  dunnet
	      :help "Dunnet, a text Adventure game for Emacs"))
(define-key menu-bar-games-menu [5x5]
  '(menu-item "5x5" 5x5
	      :help "Fill in all the squares on a 5x5 board"))

907 908 909 910 911 912
(define-key menu-bar-tools-menu [simple-calculator]
  '(menu-item "Simple Calculator" calculator
	      :help "Invoke the Emacs built-in quick calculator"))
(define-key menu-bar-tools-menu [calc]
  '(menu-item "Programmable Calculator" calc
	      :help "Invoke the Emacs built-in full scientific calculator"))
913
(define-key menu-bar-tools-menu [calendar]
914
  '(menu-item "Display Calendar" calendar))
915 916 917 918

(define-key menu-bar-tools-menu [separator-net]
  '("--"))

919 920 921
(define-key menu-bar-tools-menu [directory-search]
  '(menu-item "Directory Search" eudc-tools-menu
	      :help "Query directory servers via LDAP, CCSO PH/QI or BBDB"))
922
(define-key menu-bar-tools-menu [compose-mail]
923 924 925 926 927
  (list
   'menu-item `(format "Send Mail (with %s)" (send-mail-item-name))
   'compose-mail
   :visible `(and mail-user-agent (not (eq mail-user-agent 'ignore)))
   :help "Send a mail message"))
928
(define-key menu-bar-tools-menu [rmail]
929 930 931 932 933
  (list
   'menu-item `(format "Read Mail (with %s)" (read-mail-item-name))
   (lambda ()
     (interactive)
     (call-interactively read-mail-command))
934
   :visible `(and read-mail-command (not (eq read-mail-command 'ignore)))
935
   :help "Read your mail and reply to it"))
936
(define-key menu-bar-tools-menu [gnus]
937
  '(menu-item "Read Net News (Gnus)" gnus
938 939 940 941 942 943
	      :help "Read network news groups"))

(define-key menu-bar-tools-menu [separator-vc]
  '("--"))

(defvar vc-menu-map (make-sparse-keymap "Version Control"))
944 945 946
(define-key menu-bar-tools-menu [pcl-cvs]
  `(menu-item "PCL-CVS" ,cvs-global-menu
	      :help "Module-level interface to CVS"))
947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976
(define-key menu-bar-tools-menu [vc]
  (list 'menu-item "Version Control" vc-menu-map
	:help "Interface to RCS, CVS, SCCS"))

(define-key menu-bar-tools-menu [separator-compare]
  '("--"))

(define-key menu-bar-tools-menu [ediff-misc]
  '(menu-item "Ediff Miscellanea" menu-bar-ediff-misc-menu
	      :help "Ediff manual, customization, sessions, etc."))
(define-key menu-bar-tools-menu [epatch]
  '(menu-item "Apply Patch" menu-bar-epatch-menu))
(define-key menu-bar-tools-menu [ediff-merge]
  '(menu-item "Merge" menu-bar-ediff-merge-menu
	      :help "Merge different revisions of files/directories"))
(define-key menu-bar-tools-menu [compare]
  '(menu-item "Compare (Ediff)" menu-bar-ediff-menu
	      :help "Display differences between files/directories"))


(define-key menu-bar-tools-menu [separator-spell]
  '("--"))

(define-key menu-bar-tools-menu [spell]
  '(menu-item "Spell Checking" ispell-menu-map))

(define-key menu-bar-tools-menu [separator-prog]
  '("--"))

(define-key menu-bar-tools-menu [gdb]
977 978
  '(menu-item "Debugger (GDB)..." gdb
	      :help "Debug a program from within Emacs with GDB"))
979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995
(define-key menu-bar-tools-menu [shell-on-region]
  '(menu-item "Shell Command on Region..." shell-command-on-region
	      :enable mark-active
	      :help "Pass marked region to a shell command"))
(define-key menu-bar-tools-menu [shell]
  '(menu-item "Shell Command..." shell-command
	      :help "Invoke a shell command and catch its output"))
(define-key menu-bar-tools-menu [compile]
  '(menu-item "Compile..." compile
	      :help "Invoke compiler or Make, view compilation errors"))
(define-key menu-bar-tools-menu [grep]
  '(menu-item "Search Files (Grep)..." grep
	      :help "Search files for strings or regexps (with Grep)"))


;; The "Help" menu items

996 997
(defvar menu-bar-describe-menu (make-sparse-keymap "Describe"))

998 999 1000 1001
(define-key menu-bar-describe-menu [mule-diag]
  '(menu-item "Show All of Mule Status" mule-diag
	      :visible default-enable-multibyte-characters
	      :help "Display multilingual environment settings"))
1002 1003 1004 1005
(define-key menu-bar-describe-menu [describe-coding-system-briefly]
  '(menu-item "Describe Coding System (Briefly)..."
              describe-current-coding-system-briefly
              :visible default-enable-multibyte-characters))
1006 1007 1008 1009 1010 1011 1012 1013
(define-key menu-bar-describe-menu [describe-coding-system]
  '(menu-item "Describe Coding System..." describe-coding-system
	      :visible default-enable-multibyte-characters))
(define-key menu-bar-describe-menu [describe-input-method]
  '(menu-item "Describe Input Method..." describe-input-method
	      :visible default-enable-multibyte-characters
	      :help "Keyboard layout for specific input method"))
(define-key menu-bar-describe-menu [describe-language-environment]
1014 1015 1016
  (list 'menu-item "Describe Language Environment"
	describe-language-environment-map
	:help "Show multilingual settings for a specific language"))
1017 1018

(define-key menu-bar-describe-menu [separator-desc-mule]
1019
  '("--"))
1020 1021 1022 1023

(define-key menu-bar-describe-menu [list-keybindings]
  '(menu-item "List Key Bindings" describe-bindings
	      :help "Display a list of all current keybindings"))
1024 1025 1026 1027 1028 1029
(define-key menu-bar-describe-menu [describe-current-display-table]
  '(menu-item "Describe Display Table" describe-current-display-table
	      :help "Describe the current display table"))
(define-key menu-bar-describe-menu [describe-face]
  '(menu-item "Describe Face..." describe-face
              :help "Display the properties of a face"))
1030
(define-key menu-bar-describe-menu [describe-variable]
1031 1032
  '(menu-item "Describe Variable..." describe-variable
	      :help "Display documentation of variable/option"))
1033
(define-key menu-bar-describe-menu [describe-function]
1034 1035
  '(menu-item "Describe Function..." describe-function
	      :help "Display documentation of function/command"))