| 1 | ;;; menu-bar.el --- define a default menu bar |
| 2 | |
| 3 | ;; Copyright (C) 1993, 1994, 1995, 2000, 2001, 2002, 2003, 2004, |
| 4 | ;; 2005 Free Software Foundation, Inc. |
| 5 | |
| 6 | ;; Author: RMS |
| 7 | ;; Maintainer: FSF |
| 8 | ;; Keywords: internal, mouse |
| 9 | |
| 10 | ;; This file is part of GNU Emacs. |
| 11 | |
| 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) |
| 15 | ;; any later version. |
| 16 | |
| 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. |
| 21 | |
| 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. |
| 26 | |
| 27 | ;; Avishai Yacobi suggested some menu rearrangements. |
| 28 | |
| 29 | ;;; Commentary: |
| 30 | |
| 31 | ;;; Code: |
| 32 | |
| 33 | ;;; User options: |
| 34 | |
| 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)) |
| 42 | :group 'mouse) |
| 43 | |
| 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")) |
| 49 | |
| 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 |
| 52 | ;; help key. |
| 53 | (setq menu-bar-final-items '(help-menu)) |
| 54 | |
| 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)) |
| 69 | |
| 70 | ;; This alias is for compatibility with 19.28 and before. |
| 71 | (defvar menu-bar-files-menu menu-bar-file-menu) |
| 72 | |
| 73 | ;; This is referenced by some code below; it is defined in uniquify.el |
| 74 | (defvar uniquify-buffer-name-style) |
| 75 | |
| 76 | \f |
| 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")) |
| 81 | |
| 82 | (define-key menu-bar-file-menu [separator-exit] |
| 83 | '("--")) |
| 84 | |
| 85 | ;; Don't use delete-frame as event name because that is a special |
| 86 | ;; event. |
| 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")) |
| 100 | |
| 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")) |
| 105 | |
| 106 | (define-key menu-bar-file-menu [split-window] |
| 107 | '(menu-item "Split Window" split-window-vertically |
| 108 | :enable (or (not (display-multi-frame-p)) |
| 109 | (and (frame-live-p menu-updating-frame) |
| 110 | (frame-visible-p menu-updating-frame ) |
| 111 | (not (window-minibuffer-p |
| 112 | (frame-selected-window |
| 113 | menu-updating-frame))))) |
| 114 | :help "Split selected window in two windows")) |
| 115 | |
| 116 | (define-key menu-bar-file-menu [separator-window] |
| 117 | '(menu-item "--")) |
| 118 | |
| 119 | (define-key menu-bar-file-menu [ps-print-region] |
| 120 | '(menu-item "Postscript Print Region (B+W)" ps-print-region |
| 121 | :enable mark-active |
| 122 | :help "Pretty-print marked region in black and white to PostScript printer")) |
| 123 | (define-key menu-bar-file-menu [ps-print-buffer] |
| 124 | '(menu-item "Postscript Print Buffer (B+W)" ps-print-buffer |
| 125 | :enable (or (not (display-multi-frame-p)) |
| 126 | (and (frame-live-p menu-updating-frame) |
| 127 | (frame-visible-p menu-updating-frame))) |
| 128 | :help "Pretty-print current buffer in black and white to PostScript printer")) |
| 129 | (define-key menu-bar-file-menu [ps-print-region-faces] |
| 130 | '(menu-item "Postscript Print Region" ps-print-region-with-faces |
| 131 | :enable mark-active |
| 132 | :help "Pretty-print marked region to PostScript printer")) |
| 133 | (define-key menu-bar-file-menu [ps-print-buffer-faces] |
| 134 | '(menu-item "Postscript Print Buffer" ps-print-buffer-with-faces |
| 135 | :enable (or (not (display-multi-frame-p)) |
| 136 | (and (frame-live-p menu-updating-frame) |
| 137 | (frame-visible-p menu-updating-frame))) |
| 138 | :help "Pretty-print current buffer to PostScript printer")) |
| 139 | (define-key menu-bar-file-menu [print-region] |
| 140 | '(menu-item "Print Region" print-region |
| 141 | :enable mark-active |
| 142 | :help "Print region between mark and current position")) |
| 143 | (define-key menu-bar-file-menu [print-buffer] |
| 144 | '(menu-item "Print Buffer" print-buffer |
| 145 | :enable (or (not (display-multi-frame-p)) |
| 146 | (and (frame-live-p menu-updating-frame) |
| 147 | (frame-visible-p menu-updating-frame))) |
| 148 | :help "Print current buffer with page headings")) |
| 149 | |
| 150 | (define-key menu-bar-file-menu [separator-print] |
| 151 | '(menu-item "--")) |
| 152 | |
| 153 | (define-key menu-bar-file-menu [recover-session] |
| 154 | '(menu-item "Recover Crashed Session" recover-session |
| 155 | :enable (and auto-save-list-file-prefix |
| 156 | (file-directory-p |
| 157 | (file-name-directory auto-save-list-file-prefix)) |
| 158 | (directory-files |
| 159 | (file-name-directory auto-save-list-file-prefix) |
| 160 | nil |
| 161 | (concat "\\`" |
| 162 | (regexp-quote |
| 163 | (file-name-nondirectory |
| 164 | auto-save-list-file-prefix))) |
| 165 | t)) |
| 166 | :help "Recover edits from a crashed session")) |
| 167 | (define-key menu-bar-file-menu [revert-buffer] |
| 168 | '(menu-item "Revert Buffer" revert-buffer |
| 169 | :enable (or revert-buffer-function |
| 170 | revert-buffer-insert-file-contents-function |
| 171 | (and buffer-file-number |
| 172 | (or (buffer-modified-p) |
| 173 | (not (verify-visited-file-modtime |
| 174 | (current-buffer)))))) |
| 175 | :help "Re-read current buffer from its file")) |
| 176 | (define-key menu-bar-file-menu [write-file] |
| 177 | '(menu-item "Save As..." write-file |
| 178 | :enable (or (not (display-multi-frame-p)) |
| 179 | (and (frame-live-p menu-updating-frame) |
| 180 | (frame-visible-p menu-updating-frame ) |
| 181 | (not (window-minibuffer-p |
| 182 | (frame-selected-window |
| 183 | menu-updating-frame))))) |
| 184 | :help "Write current buffer to another file")) |
| 185 | (define-key menu-bar-file-menu [save-buffer] |
| 186 | '(menu-item "Save" save-buffer |
| 187 | :enable (and (buffer-modified-p) |
| 188 | (buffer-file-name) |
| 189 | (or (not (display-multi-frame-p)) |
| 190 | (not (window-minibuffer-p |
| 191 | (frame-selected-window |
| 192 | menu-updating-frame))))) |
| 193 | :help "Save current buffer to its file")) |
| 194 | |
| 195 | (define-key menu-bar-file-menu [separator-save] |
| 196 | '(menu-item "--")) |
| 197 | |
| 198 | (define-key menu-bar-file-menu [kill-buffer] |
| 199 | '(menu-item "Close" kill-this-buffer |
| 200 | :enable (kill-this-buffer-enabled-p) |
| 201 | :help "Discard (kill) current buffer")) |
| 202 | (define-key menu-bar-file-menu [insert-file] |
| 203 | '(menu-item "Insert File..." insert-file |
| 204 | :enable (or (not (display-multi-frame-p)) |
| 205 | (and (not (window-minibuffer-p |
| 206 | (frame-selected-window |
| 207 | menu-updating-frame))))) |
| 208 | :help "Insert another file into current buffer")) |
| 209 | (define-key menu-bar-file-menu [dired] |
| 210 | '(menu-item "Open Directory..." dired |
| 211 | :enable (or (not (display-multi-frame-p)) |
| 212 | (not (window-minibuffer-p |
| 213 | (frame-selected-window menu-updating-frame)))) |
| 214 | :help "Read a directory, operate on its files")) |
| 215 | (define-key menu-bar-file-menu [open-file] |
| 216 | '(menu-item "Open File..." find-file-existing |
| 217 | :enable (or (not (display-multi-frame-p)) |
| 218 | (not (window-minibuffer-p |
| 219 | (frame-selected-window menu-updating-frame)))) |
| 220 | :help "Read an existing file into an Emacs buffer")) |
| 221 | (define-key menu-bar-file-menu [new-file] |
| 222 | '(menu-item "Visit New File..." find-file |
| 223 | :enable (or (not (display-multi-frame-p)) |
| 224 | (not (window-minibuffer-p |
| 225 | (frame-selected-window menu-updating-frame)))) |
| 226 | :help "Read or create a file and edit it")) |
| 227 | |
| 228 | \f |
| 229 | ;; The "Edit" menu items |
| 230 | |
| 231 | ;; The "Edit->Search" submenu |
| 232 | (defvar menu-bar-last-search-type nil |
| 233 | "Type of last non-incremental search command called from the menu.") |
| 234 | |
| 235 | (defun nonincremental-repeat-search-forward () |
| 236 | "Search forward for the previous search string or regexp." |
| 237 | (interactive) |
| 238 | (cond |
| 239 | ((and (eq menu-bar-last-search-type 'string) |
| 240 | search-ring) |
| 241 | (search-forward (car search-ring))) |
| 242 | ((and (eq menu-bar-last-search-type 'regexp) |
| 243 | regexp-search-ring) |
| 244 | (re-search-forward (car regexp-search-ring))) |
| 245 | (t |
| 246 | (error "No previous search")))) |
| 247 | |
| 248 | (defun nonincremental-repeat-search-backward () |
| 249 | "Search backward for the previous search string or regexp." |
| 250 | (interactive) |
| 251 | (cond |
| 252 | ((and (eq menu-bar-last-search-type 'string) |
| 253 | search-ring) |
| 254 | (search-backward (car search-ring))) |
| 255 | ((and (eq menu-bar-last-search-type 'regexp) |
| 256 | regexp-search-ring) |
| 257 | (re-search-backward (car regexp-search-ring))) |
| 258 | (t |
| 259 | (error "No previous search")))) |
| 260 | |
| 261 | (defun nonincremental-search-forward (string) |
| 262 | "Read a string and search for it nonincrementally." |
| 263 | (interactive "sSearch for string: ") |
| 264 | (setq menu-bar-last-search-type 'string) |
| 265 | (if (equal string "") |
| 266 | (search-forward (car search-ring)) |
| 267 | (isearch-update-ring string nil) |
| 268 | (search-forward string))) |
| 269 | |
| 270 | (defun nonincremental-search-backward (string) |
| 271 | "Read a string and search backward for it nonincrementally." |
| 272 | (interactive "sSearch for string: ") |
| 273 | (setq menu-bar-last-search-type 'string) |
| 274 | (if (equal string "") |
| 275 | (search-backward (car search-ring)) |
| 276 | (isearch-update-ring string nil) |
| 277 | (search-backward string))) |
| 278 | |
| 279 | (defun nonincremental-re-search-forward (string) |
| 280 | "Read a regular expression and search for it nonincrementally." |
| 281 | (interactive "sSearch for regexp: ") |
| 282 | (setq menu-bar-last-search-type 'regexp) |
| 283 | (if (equal string "") |
| 284 | (re-search-forward (car regexp-search-ring)) |
| 285 | (isearch-update-ring string t) |
| 286 | (re-search-forward string))) |
| 287 | |
| 288 | (defun nonincremental-re-search-backward (string) |
| 289 | "Read a regular expression and search backward for it nonincrementally." |
| 290 | (interactive "sSearch for regexp: ") |
| 291 | (setq menu-bar-last-search-type 'regexp) |
| 292 | (if (equal string "") |
| 293 | (re-search-backward (car regexp-search-ring)) |
| 294 | (isearch-update-ring string t) |
| 295 | (re-search-backward string))) |
| 296 | |
| 297 | (defvar menu-bar-search-menu (make-sparse-keymap "Search")) |
| 298 | |
| 299 | ;; The Edit->Search->Incremental Search menu |
| 300 | (defvar menu-bar-i-search-menu |
| 301 | (make-sparse-keymap "Incremental Search")) |
| 302 | |
| 303 | (define-key menu-bar-i-search-menu [isearch-backward-regexp] |
| 304 | '(menu-item "Backward Regexp..." isearch-backward-regexp |
| 305 | :help "Search backwards for a regular expression as you type it")) |
| 306 | (define-key menu-bar-i-search-menu [isearch-forward-regexp] |
| 307 | '(menu-item "Forward Regexp..." isearch-forward-regexp |
| 308 | :help "Search forward for a regular expression as you type it")) |
| 309 | (define-key menu-bar-i-search-menu [isearch-backward] |
| 310 | '(menu-item "Backward String..." isearch-backward |
| 311 | :help "Search backwards for a string as you type it")) |
| 312 | (define-key menu-bar-i-search-menu [isearch-forward] |
| 313 | '(menu-item "Forward String..." isearch-forward |
| 314 | :help "Search forward for a string as you type it")) |
| 315 | |
| 316 | |
| 317 | (define-key menu-bar-search-menu [i-search] |
| 318 | (list 'menu-item "Incremental Search" menu-bar-i-search-menu |
| 319 | :help "Incremental Search finds partial matches while you type the search string.\nIt is most convenient from the keyboard. Try it!")) |
| 320 | (define-key menu-bar-search-menu [separator-tag-isearch] |
| 321 | '(menu-item "--")) |
| 322 | |
| 323 | (define-key menu-bar-search-menu [tags-continue] |
| 324 | '(menu-item "Continue Tags Search" tags-loop-continue |
| 325 | :help "Continue last tags search operation")) |
| 326 | (define-key menu-bar-search-menu [tags-srch] |
| 327 | '(menu-item "Search tagged files..." tags-search |
| 328 | :help "Search for a regexp in all tagged files")) |
| 329 | (define-key menu-bar-search-menu [separator-tag-search] |
| 330 | '(menu-item "--")) |
| 331 | |
| 332 | (define-key menu-bar-search-menu [repeat-search-back] |
| 333 | '(menu-item "Repeat Backwards" nonincremental-repeat-search-backward |
| 334 | :enable (or (and (eq menu-bar-last-search-type 'string) |
| 335 | search-ring) |
| 336 | (and (eq menu-bar-last-search-type 'regexp) |
| 337 | regexp-search-ring)) |
| 338 | :help "Repeat last search backwards")) |
| 339 | (define-key menu-bar-search-menu [repeat-search-fwd] |
| 340 | '(menu-item "Repeat Forward" nonincremental-repeat-search-forward |
| 341 | :enable (or (and (eq menu-bar-last-search-type 'string) |
| 342 | search-ring) |
| 343 | (and (eq menu-bar-last-search-type 'regexp) |
| 344 | regexp-search-ring)) |
| 345 | :help "Repeat last search forward")) |
| 346 | (define-key menu-bar-search-menu [separator-repeat-search] |
| 347 | '(menu-item "--")) |
| 348 | |
| 349 | (define-key menu-bar-search-menu [re-search-backward] |
| 350 | '(menu-item "Regexp Backwards..." nonincremental-re-search-backward |
| 351 | :help "Search backwards for a regular expression")) |
| 352 | (define-key menu-bar-search-menu [re-search-forward] |
| 353 | '(menu-item "Regexp Forward..." nonincremental-re-search-forward |
| 354 | :help "Search forward for a regular expression")) |
| 355 | |
| 356 | (define-key menu-bar-search-menu [search-backward] |
| 357 | '(menu-item "String Backwards..." nonincremental-search-backward |
| 358 | :help "Search backwards for a string")) |
| 359 | (define-key menu-bar-search-menu [search-forward] |
| 360 | '(menu-item "String Forward..." nonincremental-search-forward |
| 361 | :help "Search forward for a string")) |
| 362 | |
| 363 | ;; The Edit->Replace submenu |
| 364 | |
| 365 | (defvar menu-bar-replace-menu (make-sparse-keymap "Replace")) |
| 366 | |
| 367 | (define-key menu-bar-replace-menu [tags-repl-continue] |
| 368 | '(menu-item "Continue Replace" tags-loop-continue |
| 369 | :help "Continue last tags replace operation")) |
| 370 | (define-key menu-bar-replace-menu [tags-repl] |
| 371 | '(menu-item "Replace in tagged files..." tags-query-replace |
| 372 | :help "Interactively replace a regexp in all tagged files")) |
| 373 | (define-key menu-bar-replace-menu [separator-replace-tags] |
| 374 | '(menu-item "--")) |
| 375 | |
| 376 | (define-key menu-bar-replace-menu [query-replace-regexp] |
| 377 | '(menu-item "Replace Regexp..." query-replace-regexp |
| 378 | :enable (not buffer-read-only) |
| 379 | :help "Replace regular expression interactively, ask about each occurrence")) |
| 380 | (define-key menu-bar-replace-menu [query-replace] |
| 381 | '(menu-item "Replace String..." query-replace |
| 382 | :enable (not buffer-read-only) |
| 383 | :help "Replace string interactively, ask about each occurrence")) |
| 384 | |
| 385 | ;;; Assemble the top-level Edit menu items. |
| 386 | (define-key menu-bar-edit-menu [props] |
| 387 | '(menu-item "Text Properties" facemenu-menu |
| 388 | :help "Change properties of text in region")) |
| 389 | |
| 390 | (define-key menu-bar-edit-menu [fill] |
| 391 | '(menu-item "Fill" fill-region |
| 392 | :enable (and mark-active (not buffer-read-only)) |
| 393 | :help |
| 394 | "Fill text in region to fit between left and right margin")) |
| 395 | |
| 396 | (define-key menu-bar-edit-menu [separator-bookmark] |
| 397 | '(menu-item "--")) |
| 398 | |
| 399 | (define-key menu-bar-edit-menu [bookmark] |
| 400 | '(menu-item "Bookmarks" menu-bar-bookmark-map |
| 401 | :help "Record positions and jump between them")) |
| 402 | |
| 403 | (defvar menu-bar-goto-menu (make-sparse-keymap "Go To")) |
| 404 | |
| 405 | (define-key menu-bar-goto-menu [set-tags-name] |
| 406 | '(menu-item "Set Tags File Name..." visit-tags-table |
| 407 | :help "Tell Tags commands which tag table file to use")) |
| 408 | |
| 409 | (define-key menu-bar-goto-menu [separator-tag-file] |
| 410 | '(menu-item "--")) |
| 411 | |
| 412 | (define-key menu-bar-goto-menu [apropos-tags] |
| 413 | '(menu-item "Tags Apropos..." tags-apropos |
| 414 | :help "Find function/variables whose names match regexp")) |
| 415 | (define-key menu-bar-goto-menu [next-tag-otherw] |
| 416 | '(menu-item "Next Tag in Other Window" |
| 417 | menu-bar-next-tag-other-window |
| 418 | :enable (and (boundp 'tags-location-ring) |
| 419 | (not (ring-empty-p tags-location-ring))) |
| 420 | :help "Find next function/variable matching last tag name in another window")) |
| 421 | |
| 422 | (defun menu-bar-next-tag-other-window () |
| 423 | "Find the next definition of the tag already specified." |
| 424 | (interactive) |
| 425 | (find-tag-other-window nil t)) |
| 426 | |
| 427 | (defun menu-bar-next-tag () |
| 428 | "Find the next definition of the tag already specified." |
| 429 | (interactive) |
| 430 | (find-tag nil t)) |
| 431 | |
| 432 | (define-key menu-bar-goto-menu [next-tag] |
| 433 | '(menu-item "Find Next Tag" |
| 434 | menu-bar-next-tag |
| 435 | :enable (and (boundp 'tags-location-ring) |
| 436 | (not (ring-empty-p tags-location-ring))) |
| 437 | :help "Find next function/variable matching last tag name")) |
| 438 | (define-key menu-bar-goto-menu [find-tag-otherw] |
| 439 | '(menu-item "Find Tag in Other Window..." find-tag-other-window |
| 440 | :help "Find function/variable definition in another window")) |
| 441 | (define-key menu-bar-goto-menu [find-tag] |
| 442 | '(menu-item "Find Tag..." find-tag |
| 443 | :help "Find definition of function or variable")) |
| 444 | |
| 445 | (define-key menu-bar-goto-menu [separator-tags] |
| 446 | '(menu-item "--")) |
| 447 | |
| 448 | (define-key menu-bar-goto-menu [end-of-buf] |
| 449 | '(menu-item "Goto End of Buffer" end-of-buffer)) |
| 450 | (define-key menu-bar-goto-menu [beg-of-buf] |
| 451 | '(menu-item "Goto Beginning of Buffer" beginning-of-buffer)) |
| 452 | (define-key menu-bar-goto-menu [go-to-pos] |
| 453 | '(menu-item "Goto Buffer Position..." goto-char |
| 454 | :help "Read a number N and go to buffer position N")) |
| 455 | (define-key menu-bar-goto-menu [go-to-line] |
| 456 | '(menu-item "Goto Line..." goto-line |
| 457 | :help "Read a line number and go to that line")) |
| 458 | |
| 459 | (define-key menu-bar-edit-menu [goto] |
| 460 | (list 'menu-item "Go To" menu-bar-goto-menu)) |
| 461 | |
| 462 | (define-key menu-bar-edit-menu [replace] |
| 463 | (list 'menu-item "Replace" menu-bar-replace-menu)) |
| 464 | |
| 465 | (define-key menu-bar-edit-menu [search] |
| 466 | (list 'menu-item "Search" menu-bar-search-menu)) |
| 467 | |
| 468 | (define-key menu-bar-edit-menu [separator-search] |
| 469 | '(menu-item "--")) |
| 470 | |
| 471 | (define-key menu-bar-edit-menu [mark-whole-buffer] |
| 472 | '(menu-item "Select All" mark-whole-buffer |
| 473 | :help "Mark the whole buffer for a subsequent cut/copy.")) |
| 474 | (define-key menu-bar-edit-menu [clear] |
| 475 | '(menu-item "Clear" delete-region |
| 476 | :enable (and mark-active |
| 477 | (not buffer-read-only) |
| 478 | (not (mouse-region-match))) |
| 479 | :help |
| 480 | "Delete the text in region between mark and current position")) |
| 481 | (defvar yank-menu (cons "Select Yank" nil)) |
| 482 | (fset 'yank-menu (cons 'keymap yank-menu)) |
| 483 | (define-key menu-bar-edit-menu [select-paste] |
| 484 | '(menu-item "Select and Paste" yank-menu |
| 485 | :enable (and (cdr yank-menu) (not buffer-read-only)) |
| 486 | :help "Paste (yank) text cut or copied earlier")) |
| 487 | (define-key menu-bar-edit-menu [paste] |
| 488 | '(menu-item "Paste" yank |
| 489 | :enable (and |
| 490 | ;; Emacs compiled --without-x doesn't have |
| 491 | ;; x-selection-exists-p. |
| 492 | (fboundp 'x-selection-exists-p) |
| 493 | (x-selection-exists-p) (not buffer-read-only)) |
| 494 | :help "Paste (yank) text most recently cut/copied")) |
| 495 | (define-key menu-bar-edit-menu [copy] |
| 496 | '(menu-item "Copy" menu-bar-kill-ring-save |
| 497 | :enable mark-active |
| 498 | :help "Copy text in region between mark and current position" |
| 499 | :keys "\\[kill-ring-save]")) |
| 500 | (define-key menu-bar-edit-menu [cut] |
| 501 | '(menu-item "Cut" kill-region |
| 502 | :enable (and mark-active (not buffer-read-only)) |
| 503 | :help |
| 504 | "Cut (kill) text in region between mark and current position")) |
| 505 | (define-key menu-bar-edit-menu [undo] |
| 506 | '(menu-item "Undo" undo |
| 507 | :enable (and (not buffer-read-only) |
| 508 | (not (eq t buffer-undo-list)) |
| 509 | (if (eq last-command 'undo) |
| 510 | pending-undo-list |
| 511 | (consp buffer-undo-list))) |
| 512 | :help "Undo last operation")) |
| 513 | |
| 514 | |
| 515 | (defun menu-bar-kill-ring-save (beg end) |
| 516 | (interactive "r") |
| 517 | (if (mouse-region-match) |
| 518 | (message "Selecting a region with the mouse does `copy' automatically") |
| 519 | (kill-ring-save beg end))) |
| 520 | |
| 521 | ;; These are alternative definitions for the cut, paste and copy |
| 522 | ;; menu items. Use them if your system expects these to use the clipboard. |
| 523 | |
| 524 | (put 'clipboard-kill-region 'menu-enable 'mark-active) |
| 525 | (put 'clipboard-kill-ring-save 'menu-enable 'mark-active) |
| 526 | (put 'clipboard-yank 'menu-enable |
| 527 | '(or (and (fboundp 'x-selection-exists-p) (x-selection-exists-p)) |
| 528 | (x-selection-exists-p 'CLIPBOARD))) |
| 529 | |
| 530 | (defun clipboard-yank () |
| 531 | "Insert the clipboard contents, or the last stretch of killed text." |
| 532 | (interactive) |
| 533 | (let ((x-select-enable-clipboard t)) |
| 534 | (yank))) |
| 535 | |
| 536 | (defun clipboard-kill-ring-save (beg end) |
| 537 | "Copy region to kill ring, and save in the X clipboard." |
| 538 | (interactive "r") |
| 539 | (let ((x-select-enable-clipboard t)) |
| 540 | (kill-ring-save beg end))) |
| 541 | |
| 542 | (defun clipboard-kill-region (beg end) |
| 543 | "Kill the region, and save it in the X clipboard." |
| 544 | (interactive "r") |
| 545 | (let ((x-select-enable-clipboard t)) |
| 546 | (kill-region beg end))) |
| 547 | |
| 548 | (defun menu-bar-enable-clipboard () |
| 549 | "Make CUT, PASTE and COPY (keys and menu bar items) use the clipboard. |
| 550 | Do the same for the keys of the same name." |
| 551 | (interactive) |
| 552 | ;; We can't use constant list structure here because it becomes pure, |
| 553 | ;; and because it gets modified with cache data. |
| 554 | (define-key menu-bar-edit-menu [paste] |
| 555 | (cons "Paste" (cons "Paste text from clipboard" 'clipboard-yank))) |
| 556 | (define-key menu-bar-edit-menu [copy] |
| 557 | (cons "Copy" (cons "Copy text in region to the clipboard" |
| 558 | 'clipboard-kill-ring-save))) |
| 559 | (define-key menu-bar-edit-menu [cut] |
| 560 | (cons "Cut" (cons "Delete text in region and copy it to the clipboard" |
| 561 | 'clipboard-kill-region))) |
| 562 | |
| 563 | ;; These are Sun server keysyms for the Cut, Copy and Paste keys |
| 564 | ;; (also for XFree86 on Sun keyboard): |
| 565 | (define-key global-map [f20] 'clipboard-kill-region) |
| 566 | (define-key global-map [f16] 'clipboard-kill-ring-save) |
| 567 | (define-key global-map [f18] 'clipboard-yank) |
| 568 | ;; X11R6 versions: |
| 569 | (define-key global-map [cut] 'clipboard-kill-region) |
| 570 | (define-key global-map [copy] 'clipboard-kill-ring-save) |
| 571 | (define-key global-map [paste] 'clipboard-yank)) |
| 572 | \f |
| 573 | ;; The "Options" menu items |
| 574 | |
| 575 | (defvar menu-bar-custom-menu (make-sparse-keymap "Customize")) |
| 576 | |
| 577 | (define-key menu-bar-custom-menu [customize-apropos-groups] |
| 578 | '(menu-item "Groups Matching Regexp..." customize-apropos-groups |
| 579 | :help "Browse groups whose names match regexp")) |
| 580 | (define-key menu-bar-custom-menu [customize-apropos-faces] |
| 581 | '(menu-item "Faces Matching Regexp..." customize-apropos-faces |
| 582 | :help "Browse faces whose names match regexp")) |
| 583 | (define-key menu-bar-custom-menu [customize-apropos-options] |
| 584 | '(menu-item "Options Matching Regexp..." customize-apropos-options |
| 585 | :help "Browse options whose names match regexp")) |
| 586 | (define-key menu-bar-custom-menu [customize-apropos] |
| 587 | '(menu-item "Settings Matching Regexp..." customize-apropos |
| 588 | :help "Browse customizable settings whose names match regexp")) |
| 589 | (define-key menu-bar-custom-menu [separator-1] |
| 590 | '("--")) |
| 591 | (define-key menu-bar-custom-menu [customize-group] |
| 592 | '(menu-item "Specific Group..." customize-group |
| 593 | :help "Customize settings of specific group")) |
| 594 | (define-key menu-bar-custom-menu [customize-face] |
| 595 | '(menu-item "Specific Face..." customize-face |
| 596 | :help "Customize attributes of specific face")) |
| 597 | (define-key menu-bar-custom-menu [customize-option] |
| 598 | '(menu-item "Specific Option..." customize-option |
| 599 | :help "Customize value of specific option")) |
| 600 | (define-key menu-bar-custom-menu [separator-2] |
| 601 | '("--")) |
| 602 | (define-key menu-bar-custom-menu [customize-changed-options] |
| 603 | '(menu-item "New Options..." customize-changed-options |
| 604 | :help "Options added or changed in recent Emacs versions")) |
| 605 | (define-key menu-bar-custom-menu [customize-saved] |
| 606 | '(menu-item "Saved Options" customize-saved |
| 607 | :help "Customize previously saved options")) |
| 608 | (define-key menu-bar-custom-menu [separator-3] |
| 609 | '("--")) |
| 610 | (define-key menu-bar-custom-menu [customize-browse] |
| 611 | '(menu-item "Browse Customization Groups" customize-browse |
| 612 | :help "Browse all customization groups")) |
| 613 | (define-key menu-bar-custom-menu [customize] |
| 614 | '(menu-item "Top-level Customization Group" customize |
| 615 | :help "The master group called `Emacs'")) |
| 616 | |
| 617 | ;(defvar menu-bar-preferences-menu (make-sparse-keymap "Preferences")) |
| 618 | |
| 619 | (defmacro menu-bar-make-mm-toggle (fname doc help &optional props) |
| 620 | "Make a menu-item for a global minor mode toggle. |
| 621 | FNAME is the minor mode's name (variable and function). |
| 622 | DOC is the text to use for the menu entry. |
| 623 | HELP is the text to use for the tooltip. |
| 624 | PROPS are additional properties." |
| 625 | `'(menu-item ,doc ,fname |
| 626 | ,@props |
| 627 | :help ,help |
| 628 | :button (:toggle . (and (default-boundp ',fname) |
| 629 | (default-value ',fname))))) |
| 630 | |
| 631 | (defmacro menu-bar-make-toggle (name variable doc message help &rest body) |
| 632 | `(progn |
| 633 | (defun ,name (&optional interactively) |
| 634 | ,(concat "Toggle whether to " (downcase (substring help 0 1)) |
| 635 | (substring help 1) ". |
| 636 | In an interactive call, record this option as a candidate for saving |
| 637 | by \"Save Options\" in Custom buffers.") |
| 638 | (interactive "p") |
| 639 | (if ,(if body `(progn . ,body) |
| 640 | `(progn |
| 641 | (custom-load-symbol ',variable) |
| 642 | (let ((set (or (get ',variable 'custom-set) 'set-default)) |
| 643 | (get (or (get ',variable 'custom-get) 'default-value))) |
| 644 | (funcall set ',variable (not (funcall get ',variable)))))) |
| 645 | (message ,message "enabled") |
| 646 | (message ,message "disabled")) |
| 647 | ;; The function `customize-mark-as-set' must only be called when |
| 648 | ;; a variable is set interactively, as the purpose is to mark it as |
| 649 | ;; a candidate for "Save Options", and we do not want to save options |
| 650 | ;; the user have already set explicitly in his init file. |
| 651 | (if interactively (customize-mark-as-set ',variable))) |
| 652 | '(menu-item ,doc ,name |
| 653 | :help ,help |
| 654 | :button (:toggle . (and (default-boundp ',variable) |
| 655 | (default-value ',variable)))))) |
| 656 | |
| 657 | ;;; Assemble all the top-level items of the "Options" menu |
| 658 | (define-key menu-bar-options-menu [customize] |
| 659 | (list 'menu-item "Customize Emacs" menu-bar-custom-menu |
| 660 | :help "Full customization of every Emacs feature")) |
| 661 | |
| 662 | (defun menu-bar-options-save () |
| 663 | "Save current values of Options menu items using Custom." |
| 664 | (interactive) |
| 665 | (let ((need-save nil)) |
| 666 | ;; These are set with menu-bar-make-mm-toggle, which does not |
| 667 | ;; put on a customized-value property. |
| 668 | (dolist (elt '(line-number-mode column-number-mode size-indication-mode |
| 669 | cua-mode show-paren-mode transient-mark-mode |
| 670 | global-font-lock-mode blink-cursor-mode |
| 671 | display-time-mode display-battery-mode)) |
| 672 | (and (customize-mark-to-save elt) |
| 673 | (setq need-save t))) |
| 674 | ;; These are set with `customize-set-variable'. |
| 675 | (dolist (elt '(scroll-bar-mode |
| 676 | debug-on-quit debug-on-error |
| 677 | tooltip-mode menu-bar-mode tool-bar-mode |
| 678 | save-place uniquify-buffer-name-style fringe-mode |
| 679 | indicate-empty-lines indicate-buffer-boundaries |
| 680 | case-fold-search |
| 681 | current-language-environment default-input-method |
| 682 | ;; Saving `text-mode-hook' is somewhat questionable, |
| 683 | ;; as we might get more than we bargain for, if |
| 684 | ;; other code may has added hooks as well. |
| 685 | ;; Nonetheless, not saving it would like be confuse |
| 686 | ;; more often. |
| 687 | ;; -- Per Abrahamsen <abraham@dina.kvl.dk> 2002-02-11. |
| 688 | text-mode-hook)) |
| 689 | (and (get elt 'customized-value) |
| 690 | (customize-mark-to-save elt) |
| 691 | (setq need-save t))) |
| 692 | ;; Save if we changed anything. |
| 693 | (when need-save |
| 694 | (custom-save-all)))) |
| 695 | |
| 696 | (define-key menu-bar-options-menu [save] |
| 697 | '(menu-item "Save Options" menu-bar-options-save |
| 698 | :help "Save options set from the menu above")) |
| 699 | |
| 700 | (define-key menu-bar-options-menu [custom-separator] |
| 701 | '("--")) |
| 702 | |
| 703 | (define-key menu-bar-options-menu [mouse-set-font] |
| 704 | '(menu-item "Set Font/Fontset..." mouse-set-font |
| 705 | :visible (display-multi-font-p) |
| 706 | :help "Select a font from list of known fonts/fontsets")) |
| 707 | |
| 708 | ;; The "Show/Hide" submenu of menu "Options" |
| 709 | |
| 710 | (defvar menu-bar-showhide-menu (make-sparse-keymap "Show/Hide")) |
| 711 | |
| 712 | (define-key menu-bar-showhide-menu [column-number-mode] |
| 713 | (menu-bar-make-mm-toggle column-number-mode |
| 714 | "Column Numbers" |
| 715 | "Show the current column number in the mode line")) |
| 716 | |
| 717 | (define-key menu-bar-showhide-menu [line-number-mode] |
| 718 | (menu-bar-make-mm-toggle line-number-mode |
| 719 | "Line Numbers" |
| 720 | "Show the current line number in the mode line")) |
| 721 | |
| 722 | (define-key menu-bar-showhide-menu [size-indication-mode] |
| 723 | (menu-bar-make-mm-toggle size-indication-mode |
| 724 | "Size Indication" |
| 725 | "Show the size of the buffer in the mode line")) |
| 726 | |
| 727 | (define-key menu-bar-showhide-menu [linecolumn-separator] |
| 728 | '("--")) |
| 729 | |
| 730 | (define-key menu-bar-showhide-menu [showhide-battery] |
| 731 | (menu-bar-make-mm-toggle display-battery-mode |
| 732 | "Battery Status" |
| 733 | "Display battery status information in mode line")) |
| 734 | |
| 735 | (define-key menu-bar-showhide-menu [showhide-date-time] |
| 736 | (menu-bar-make-mm-toggle display-time-mode |
| 737 | "Time, Load and Mail" |
| 738 | "Display time, system load averages and \ |
| 739 | mail status in mode line")) |
| 740 | |
| 741 | (define-key menu-bar-showhide-menu [datetime-separator] |
| 742 | '("--")) |
| 743 | |
| 744 | (define-key menu-bar-showhide-menu [showhide-speedbar] |
| 745 | '(menu-item "Speedbar" speedbar-frame-mode |
| 746 | :help "Display a Speedbar quick-navigation frame" |
| 747 | :button (:toggle |
| 748 | . (and (boundp 'speedbar-frame) |
| 749 | (frame-live-p (symbol-value 'speedbar-frame)) |
| 750 | (frame-visible-p |
| 751 | (symbol-value 'speedbar-frame)))))) |
| 752 | |
| 753 | (defvar menu-bar-showhide-fringe-menu (make-sparse-keymap "Fringe")) |
| 754 | |
| 755 | (defvar menu-bar-showhide-fringe-ind-menu |
| 756 | (make-sparse-keymap "Buffer boundaries")) |
| 757 | |
| 758 | (defun menu-bar-showhide-fringe-ind-customize () |
| 759 | "Show customization buffer for `indicate-buffer-boundaries'." |
| 760 | (interactive) |
| 761 | (customize-variable 'indicate-buffer-boundaries)) |
| 762 | |
| 763 | (define-key menu-bar-showhide-fringe-ind-menu [customize] |
| 764 | '(menu-item "Other (Customize)" |
| 765 | menu-bar-showhide-fringe-ind-customize |
| 766 | :help "Additional choices available through Custom buffer" |
| 767 | :visible (display-graphic-p))) |
| 768 | |
| 769 | (defun menu-bar-showhide-fringe-ind-mixed () |
| 770 | "Display top and bottom indicators in opposite fringes, arrows in right." |
| 771 | (interactive) |
| 772 | (customize-set-variable 'indicate-buffer-boundaries |
| 773 | '((t . right) (top . left)))) |
| 774 | |
| 775 | (define-key menu-bar-showhide-fringe-ind-menu [mixed] |
| 776 | '(menu-item "Opposite, Arrows Right" menu-bar-showhide-fringe-ind-mixed |
| 777 | :help |
| 778 | "Show top/bottom indicators in opposite fringes, arrows in right" |
| 779 | :visible (display-graphic-p) |
| 780 | :button (:radio . (eq indicate-buffer-boundaries |
| 781 | '((t . right) (top . left)))))) |
| 782 | |
| 783 | (defun menu-bar-showhide-fringe-ind-box () |
| 784 | "Display top and bottom indicators in opposite fringes." |
| 785 | (interactive) |
| 786 | (customize-set-variable 'indicate-buffer-boundaries |
| 787 | '((top . left) (bottom . right)))) |
| 788 | |
| 789 | (define-key menu-bar-showhide-fringe-ind-menu [box] |
| 790 | '(menu-item "Opposite, No Arrows" menu-bar-showhide-fringe-ind-box |
| 791 | :help "Show top/bottom indicators in opposite fringes, no arrows" |
| 792 | :visible (display-graphic-p) |
| 793 | :button (:radio . (eq indicate-buffer-boundaries |
| 794 | '((top . left) (bottom . right)))))) |
| 795 | |
| 796 | (defun menu-bar-showhide-fringe-ind-right () |
| 797 | "Display buffer boundaries and arrows in the right fringe." |
| 798 | (interactive) |
| 799 | (customize-set-variable 'indicate-buffer-boundaries 'right)) |
| 800 | |
| 801 | (define-key menu-bar-showhide-fringe-ind-menu [right] |
| 802 | '(menu-item "In Right Fringe" menu-bar-showhide-fringe-ind-right |
| 803 | :help "Show buffer boundaries and arrows in right fringe" |
| 804 | :visible (display-graphic-p) |
| 805 | :button (:radio . (eq indicate-buffer-boundaries 'right)))) |
| 806 | |
| 807 | (defun menu-bar-showhide-fringe-ind-left () |
| 808 | "Display buffer boundaries and arrows in the left fringe." |
| 809 | (interactive) |
| 810 | (customize-set-variable 'indicate-buffer-boundaries 'left)) |
| 811 | |
| 812 | (define-key menu-bar-showhide-fringe-ind-menu [left] |
| 813 | '(menu-item "In Left Fringe" menu-bar-showhide-fringe-ind-left |
| 814 | :help "Show buffer boundaries and arrows in left fringe" |
| 815 | :visible (display-graphic-p) |
| 816 | :button (:radio . (eq indicate-buffer-boundaries 'left)))) |
| 817 | |
| 818 | (defun menu-bar-showhide-fringe-ind-none () |
| 819 | "Do not display any buffer boundary indicators." |
| 820 | (interactive) |
| 821 | (customize-set-variable 'indicate-buffer-boundaries nil)) |
| 822 | |
| 823 | (define-key menu-bar-showhide-fringe-ind-menu [none] |
| 824 | '(menu-item "No Indicators" menu-bar-showhide-fringe-ind-none |
| 825 | :help "Hide all buffer boundary indicators and arrows" |
| 826 | :visible (display-graphic-p) |
| 827 | :button (:radio . (eq indicate-buffer-boundaries nil)))) |
| 828 | |
| 829 | (define-key menu-bar-showhide-fringe-menu [showhide-fringe-ind] |
| 830 | (list 'menu-item "Buffer Boundaries" menu-bar-showhide-fringe-ind-menu |
| 831 | :visible `(display-graphic-p) |
| 832 | :help "Indicate buffer boundaries in fringe")) |
| 833 | |
| 834 | (define-key menu-bar-showhide-fringe-menu [indicate-empty-lines] |
| 835 | (menu-bar-make-toggle toggle-indicate-empty-lines indicate-empty-lines |
| 836 | "Empty Line Indicators" |
| 837 | "Indicating of empty lines %s" |
| 838 | "Indicate trailing empty lines in fringe")) |
| 839 | |
| 840 | (defun menu-bar-showhide-fringe-menu-customize () |
| 841 | "Show customization buffer for `fringe-mode'." |
| 842 | (interactive) |
| 843 | (customize-variable 'fringe-mode)) |
| 844 | |
| 845 | (define-key menu-bar-showhide-fringe-menu [customize] |
| 846 | '(menu-item "Customize Fringe" menu-bar-showhide-fringe-menu-customize |
| 847 | :help "Detailed customization of fringe" |
| 848 | :visible (display-graphic-p))) |
| 849 | |
| 850 | (defun menu-bar-showhide-fringe-menu-customize-reset () |
| 851 | "Reset the fringe mode: display fringes on both sides of a window." |
| 852 | (interactive) |
| 853 | (customize-set-variable 'fringe-mode nil)) |
| 854 | |
| 855 | (define-key menu-bar-showhide-fringe-menu [default] |
| 856 | '(menu-item "Default" menu-bar-showhide-fringe-menu-customize-reset |
| 857 | :help "Default width fringe on both left and right side" |
| 858 | :visible (display-graphic-p) |
| 859 | :button (:radio . (eq fringe-mode nil)))) |
| 860 | |
| 861 | (defun menu-bar-showhide-fringe-menu-customize-left () |
| 862 | "Display fringes only on the left of each window." |
| 863 | (interactive) |
| 864 | (require 'fringe) |
| 865 | (customize-set-variable 'fringe-mode '(nil . 0))) |
| 866 | |
| 867 | (define-key menu-bar-showhide-fringe-menu [left] |
| 868 | '(menu-item "On the Left" menu-bar-showhide-fringe-menu-customize-left |
| 869 | :help "Fringe only on the left side" |
| 870 | :visible (display-graphic-p) |
| 871 | :button (:radio . (equal fringe-mode '(nil . 0))))) |
| 872 | |
| 873 | (defun menu-bar-showhide-fringe-menu-customize-right () |
| 874 | "Display fringes only on the right of each window." |
| 875 | (interactive) |
| 876 | (require 'fringe) |
| 877 | (customize-set-variable 'fringe-mode '(0 . nil))) |
| 878 | |
| 879 | (define-key menu-bar-showhide-fringe-menu [right] |
| 880 | '(menu-item "On the Right" menu-bar-showhide-fringe-menu-customize-right |
| 881 | :help "Fringe only on the right side" |
| 882 | :visible (display-graphic-p) |
| 883 | :button (:radio . (equal fringe-mode '(0 . nil))))) |
| 884 | |
| 885 | (defun menu-bar-showhide-fringe-menu-customize-disable () |
| 886 | "Do not display window fringes." |
| 887 | (interactive) |
| 888 | (require 'fringe) |
| 889 | (customize-set-variable 'fringe-mode 0)) |
| 890 | |
| 891 | (define-key menu-bar-showhide-fringe-menu [none] |
| 892 | '(menu-item "None" menu-bar-showhide-fringe-menu-customize-disable |
| 893 | :help "Turn off fringe" |
| 894 | :visible (display-graphic-p) |
| 895 | :button (:radio . (eq fringe-mode 0)))) |
| 896 | |
| 897 | (define-key menu-bar-showhide-menu [showhide-fringe] |
| 898 | (list 'menu-item "Fringe" menu-bar-showhide-fringe-menu |
| 899 | :visible `(display-graphic-p) |
| 900 | :help "Select fringe mode")) |
| 901 | |
| 902 | (defvar menu-bar-showhide-scroll-bar-menu (make-sparse-keymap "Scroll-bar")) |
| 903 | |
| 904 | (define-key menu-bar-showhide-scroll-bar-menu [right] |
| 905 | '(menu-item "On the Right" |
| 906 | menu-bar-right-scroll-bar |
| 907 | :help "Scroll-bar on the right side" |
| 908 | :visible (display-graphic-p) |
| 909 | :button (:radio . (eq (cdr (assq 'vertical-scroll-bars |
| 910 | (frame-parameters))) 'right)))) |
| 911 | (defun menu-bar-right-scroll-bar () |
| 912 | "Display scroll bars on the right of each window." |
| 913 | (interactive) |
| 914 | (customize-set-variable 'scroll-bar-mode 'right)) |
| 915 | |
| 916 | (define-key menu-bar-showhide-scroll-bar-menu [left] |
| 917 | '(menu-item "On the Left" |
| 918 | menu-bar-left-scroll-bar |
| 919 | :help "Scroll-bar on the left side" |
| 920 | :visible (display-graphic-p) |
| 921 | :button (:radio . (eq (cdr (assq 'vertical-scroll-bars |
| 922 | (frame-parameters))) 'left)))) |
| 923 | |
| 924 | (defun menu-bar-left-scroll-bar () |
| 925 | "Display scroll bars on the left of each window." |
| 926 | (interactive) |
| 927 | (customize-set-variable 'scroll-bar-mode 'left)) |
| 928 | |
| 929 | (define-key menu-bar-showhide-scroll-bar-menu [none] |
| 930 | '(menu-item "None" |
| 931 | menu-bar-no-scroll-bar |
| 932 | :help "Turn off scroll-bar" |
| 933 | :visible (display-graphic-p) |
| 934 | :button (:radio . (eq (cdr (assq 'vertical-scroll-bars |
| 935 | (frame-parameters))) nil)))) |
| 936 | |
| 937 | (defun menu-bar-no-scroll-bar () |
| 938 | "Turn off scroll bars." |
| 939 | (interactive) |
| 940 | (customize-set-variable 'scroll-bar-mode nil)) |
| 941 | |
| 942 | (define-key menu-bar-showhide-menu [showhide-scroll-bar] |
| 943 | (list 'menu-item "Scroll-bar" menu-bar-showhide-scroll-bar-menu |
| 944 | :visible `(display-graphic-p) |
| 945 | :help "Select scroll-bar mode")) |
| 946 | |
| 947 | (define-key menu-bar-showhide-menu [showhide-tooltip-mode] |
| 948 | (list 'menu-item "Tooltips" 'tooltip-mode |
| 949 | :help "Toggle tooltips on/off" |
| 950 | :visible `(and (display-graphic-p) (fboundp 'x-show-tip)) |
| 951 | :button `(:toggle . tooltip-mode))) |
| 952 | |
| 953 | (define-key menu-bar-showhide-menu [menu-bar-mode] |
| 954 | '(menu-item "Menu-bar" menu-bar-mode |
| 955 | :help "Toggle menu-bar on/off" |
| 956 | :button (:toggle . menu-bar-mode))) |
| 957 | |
| 958 | (define-key menu-bar-showhide-menu [showhide-tool-bar] |
| 959 | (list 'menu-item "Tool-bar" 'tool-bar-mode |
| 960 | :help "Turn tool-bar on/off" |
| 961 | :visible `(display-graphic-p) |
| 962 | :button `(:toggle . tool-bar-mode))) |
| 963 | |
| 964 | (define-key menu-bar-options-menu [showhide] |
| 965 | (list 'menu-item "Show/Hide" menu-bar-showhide-menu |
| 966 | :help "Toggle on/off various display features")) |
| 967 | |
| 968 | (define-key menu-bar-options-menu [showhide-separator] |
| 969 | '("--")) |
| 970 | |
| 971 | (define-key menu-bar-options-menu [mule] |
| 972 | ;; It is better not to use backquote here, |
| 973 | ;; because that makes a bootstrapping problem |
| 974 | ;; if you need to recompile all the Lisp files using interpreted code. |
| 975 | (list 'menu-item "Mule (Multilingual Environment)" mule-menu-keymap |
| 976 | ;; Most of the MULE menu actually does make sense in unibyte mode, |
| 977 | ;; e.g. language selection. |
| 978 | ;;; ':visible 'default-enable-multibyte-characters |
| 979 | ':help "Default language, encodings, input method")) |
| 980 | ;(setq menu-bar-final-items (cons 'mule menu-bar-final-items)) |
| 981 | ;(define-key menu-bar-options-menu [preferences] |
| 982 | ; (list 'menu-item "Preferences" menu-bar-preferences-menu |
| 983 | ; :help "Toggle important global options")) |
| 984 | |
| 985 | (define-key menu-bar-options-menu [mule-separator] |
| 986 | '("--")) |
| 987 | |
| 988 | (define-key menu-bar-options-menu [debug-on-quit] |
| 989 | (menu-bar-make-toggle toggle-debug-on-quit debug-on-quit |
| 990 | "Enter Debugger on Quit/C-g" "Debug on Quit %s" |
| 991 | "Enter Lisp debugger when C-g is pressed")) |
| 992 | (define-key menu-bar-options-menu [debug-on-error] |
| 993 | (menu-bar-make-toggle toggle-debug-on-error debug-on-error |
| 994 | "Enter Debugger on Error" "Debug on Error %s" |
| 995 | "Enter Lisp debugger when an error is signaled")) |
| 996 | (define-key menu-bar-options-menu [debugger-separator] |
| 997 | '("--")) |
| 998 | |
| 999 | (define-key menu-bar-options-menu [blink-cursor-mode] |
| 1000 | (menu-bar-make-mm-toggle blink-cursor-mode |
| 1001 | "Blinking Cursor" |
| 1002 | "Whether the cursor blinks (Blink Cursor mode)")) |
| 1003 | (define-key menu-bar-options-menu [cursor-separator] |
| 1004 | '("--")) |
| 1005 | |
| 1006 | (define-key menu-bar-options-menu [save-place] |
| 1007 | (menu-bar-make-toggle toggle-save-place-globally save-place |
| 1008 | "Save Place in Files between Sessions" |
| 1009 | "Saving place in files %s" |
| 1010 | "Visit files of previous session when restarting Emacs" |
| 1011 | (require 'saveplace) |
| 1012 | ;; Do it by name, to avoid a free-variable |
| 1013 | ;; warning during byte compilation. |
| 1014 | (set-default |
| 1015 | 'save-place (not (symbol-value 'save-place))))) |
| 1016 | |
| 1017 | (define-key menu-bar-options-menu [uniquify] |
| 1018 | (menu-bar-make-toggle toggle-uniquify-buffer-names uniquify-buffer-name-style |
| 1019 | "Use Directory Names in Buffer Names" |
| 1020 | "Directory name in buffer names (uniquify) %s" |
| 1021 | "Uniquify buffer names by adding parent directory names" |
| 1022 | (require 'uniquify) |
| 1023 | (setq uniquify-buffer-name-style |
| 1024 | (if (not uniquify-buffer-name-style) |
| 1025 | 'forward)))) |
| 1026 | |
| 1027 | (define-key menu-bar-options-menu [edit-options-separator] |
| 1028 | '("--")) |
| 1029 | (define-key menu-bar-options-menu [cua-mode] |
| 1030 | (menu-bar-make-mm-toggle cua-mode |
| 1031 | "C-x/C-c/C-v Cut and Paste (CUA)" |
| 1032 | "Use C-z/C-x/C-c/C-v keys for undo/cut/copy/paste")) |
| 1033 | |
| 1034 | (define-key menu-bar-options-menu [case-fold-search] |
| 1035 | (menu-bar-make-toggle toggle-case-fold-search case-fold-search |
| 1036 | "Case-Insensitive Search" |
| 1037 | "Case-Insensitive Search %s" |
| 1038 | "Ignore letter-case in search")) |
| 1039 | |
| 1040 | (defun menu-bar-text-mode-auto-fill () |
| 1041 | (interactive) |
| 1042 | (toggle-text-mode-auto-fill) |
| 1043 | ;; This is somewhat questionable, as `text-mode-hook' |
| 1044 | ;; might have changed outside customize. |
| 1045 | ;; -- Per Abrahamsen <abraham@dina.kvl.dk> 2002-02-11. |
| 1046 | (customize-mark-as-set 'text-mode-hook)) |
| 1047 | |
| 1048 | (define-key menu-bar-options-menu [auto-fill-mode] |
| 1049 | '(menu-item "Word Wrap in Text Modes" |
| 1050 | menu-bar-text-mode-auto-fill |
| 1051 | :help "Automatically fill text between left and right margins (Auto Fill)" |
| 1052 | :button (:toggle . (if (listp text-mode-hook) |
| 1053 | (member 'turn-on-auto-fill text-mode-hook) |
| 1054 | (eq 'turn-on-auto-fill text-mode-hook))))) |
| 1055 | (define-key menu-bar-options-menu [truncate-lines] |
| 1056 | '(menu-item "Truncate Long Lines in this Buffer" |
| 1057 | toggle-truncate-lines |
| 1058 | :help "Truncate long lines on the screen" |
| 1059 | :button (:toggle . truncate-lines) |
| 1060 | :enable (or (not (display-multi-frame-p)) |
| 1061 | (and (frame-live-p menu-updating-frame) |
| 1062 | (frame-visible-p menu-updating-frame))))) |
| 1063 | |
| 1064 | (define-key menu-bar-options-menu [highlight-separator] |
| 1065 | '("--")) |
| 1066 | (define-key menu-bar-options-menu [highlight-paren-mode] |
| 1067 | (menu-bar-make-mm-toggle show-paren-mode |
| 1068 | "Paren Match Highlighting" |
| 1069 | "Highlight matching/mismatched parentheses at cursor (Show Paren mode)")) |
| 1070 | (define-key menu-bar-options-menu [transient-mark-mode] |
| 1071 | (menu-bar-make-mm-toggle transient-mark-mode |
| 1072 | "Active Region Highlighting" |
| 1073 | "Make text in active region stand out in color (Transient Mark mode)" |
| 1074 | (:enable (not cua-mode)))) |
| 1075 | (define-key menu-bar-options-menu [toggle-global-lazy-font-lock-mode] |
| 1076 | (menu-bar-make-mm-toggle global-font-lock-mode |
| 1077 | "Syntax Highlighting" |
| 1078 | "Colorize text based on language syntax (Global Font Lock mode)")) |
| 1079 | |
| 1080 | \f |
| 1081 | ;; The "Tools" menu items |
| 1082 | |
| 1083 | (defun send-mail-item-name () |
| 1084 | (let* ((known-send-mail-commands '((sendmail-user-agent . "sendmail") |
| 1085 | (mh-e-user-agent . "MH") |
| 1086 | (message-user-agent . "Gnus Message") |
| 1087 | (gnus-user-agent . "Gnus"))) |
| 1088 | (name (assq mail-user-agent known-send-mail-commands))) |
| 1089 | (if name |
| 1090 | (setq name (cdr name)) |
| 1091 | (setq name (symbol-name mail-user-agent)) |
| 1092 | (if (string-match "\\(.+\\)-user-agent" name) |
| 1093 | (setq name (match-string 1 name)))) |
| 1094 | name)) |
| 1095 | |
| 1096 | (defun read-mail-item-name () |
| 1097 | (let* ((known-rmail-commands '((rmail . "RMAIL") |
| 1098 | (mh-rmail . "MH") |
| 1099 | (gnus . "Gnus"))) |
| 1100 | (known (assq read-mail-command known-rmail-commands))) |
| 1101 | (if known (cdr known) (symbol-name read-mail-command)))) |
| 1102 | |
| 1103 | (defvar menu-bar-games-menu (make-sparse-keymap "Games")) |
| 1104 | |
| 1105 | (define-key menu-bar-tools-menu [games] |
| 1106 | (list 'menu-item "Games" menu-bar-games-menu)) |
| 1107 | |
| 1108 | (define-key menu-bar-tools-menu [separator-games] |
| 1109 | '("--")) |
| 1110 | |
| 1111 | (define-key menu-bar-games-menu [zone] |
| 1112 | '(menu-item "Zone Out" zone |
| 1113 | :help "Play tricks with Emacs display when Emacs is idle")) |
| 1114 | (define-key menu-bar-games-menu [yow] |
| 1115 | '(menu-item "Random Quotation" yow |
| 1116 | :help "Display a random Zippy quotation")) |
| 1117 | (define-key menu-bar-games-menu [tetris] |
| 1118 | '(menu-item "Tetris" tetris)) |
| 1119 | (define-key menu-bar-games-menu [solitaire] |
| 1120 | '(menu-item "Solitaire" solitaire)) |
| 1121 | (define-key menu-bar-games-menu [snake] |
| 1122 | '(menu-item "Snake" snake |
| 1123 | :help "Move snake around avoiding collisions")) |
| 1124 | (define-key menu-bar-games-menu [mult] |
| 1125 | '(menu-item "Multiplication Puzzle" mpuz |
| 1126 | :help "Exercise brain with multiplication")) |
| 1127 | (define-key menu-bar-games-menu [life] |
| 1128 | '(menu-item "Life" life |
| 1129 | :help "Watch how John Conway's cellular automaton evolves")) |
| 1130 | (define-key menu-bar-games-menu [hanoi] |
| 1131 | '(menu-item "Towers of Hanoi" hanoi |
| 1132 | :help "Watch Towers-of-Hanoi puzzle solved by Emacs")) |
| 1133 | (define-key menu-bar-games-menu [gomoku] |
| 1134 | '(menu-item "Gomoku" gomoku |
| 1135 | :help "Mark 5 contiguous squares (like tic-tac-toe)")) |
| 1136 | (define-key menu-bar-games-menu [black-box] |
| 1137 | '(menu-item "Blackbox" blackbox |
| 1138 | :help "Find balls in a black box by shooting rays")) |
| 1139 | (define-key menu-bar-games-menu [adventure] |
| 1140 | '(menu-item "Adventure" dunnet |
| 1141 | :help "Dunnet, a text Adventure game for Emacs")) |
| 1142 | (define-key menu-bar-games-menu [5x5] |
| 1143 | '(menu-item "5x5" 5x5 |
| 1144 | :help "Fill in all the squares on a 5x5 board")) |
| 1145 | |
| 1146 | (define-key menu-bar-tools-menu [simple-calculator] |
| 1147 | '(menu-item "Simple Calculator" calculator |
| 1148 | :help "Invoke the Emacs built-in quick calculator")) |
| 1149 | (define-key menu-bar-tools-menu [calc] |
| 1150 | '(menu-item "Programmable Calculator" calc |
| 1151 | :help "Invoke the Emacs built-in full scientific calculator")) |
| 1152 | (define-key menu-bar-tools-menu [calendar] |
| 1153 | '(menu-item "Display Calendar" calendar)) |
| 1154 | |
| 1155 | (define-key menu-bar-tools-menu [separator-net] |
| 1156 | '("--")) |
| 1157 | |
| 1158 | (define-key menu-bar-tools-menu [directory-search] |
| 1159 | '(menu-item "Directory Search" eudc-tools-menu |
| 1160 | :help "Query directory servers via LDAP, CCSO PH/QI or BBDB")) |
| 1161 | (define-key menu-bar-tools-menu [compose-mail] |
| 1162 | (list |
| 1163 | 'menu-item `(format "Send Mail (with %s)" (send-mail-item-name)) |
| 1164 | 'compose-mail |
| 1165 | :visible `(and mail-user-agent (not (eq mail-user-agent 'ignore))) |
| 1166 | :help "Send a mail message")) |
| 1167 | (define-key menu-bar-tools-menu [rmail] |
| 1168 | (list |
| 1169 | 'menu-item `(format "Read Mail (with %s)" (read-mail-item-name)) |
| 1170 | 'menu-bar-read-mail |
| 1171 | :visible `(and read-mail-command (not (eq read-mail-command 'ignore))) |
| 1172 | :help "Read your mail and reply to it")) |
| 1173 | |
| 1174 | (defun menu-bar-read-mail () |
| 1175 | "Read mail using `read-mail-command'." |
| 1176 | (interactive) |
| 1177 | (call-interactively read-mail-command)) |
| 1178 | |
| 1179 | (define-key menu-bar-tools-menu [gnus] |
| 1180 | '(menu-item "Read Net News (Gnus)" gnus |
| 1181 | :help "Read network news groups")) |
| 1182 | |
| 1183 | (define-key menu-bar-tools-menu [separator-vc] |
| 1184 | '("--")) |
| 1185 | |
| 1186 | (defvar vc-menu-map (make-sparse-keymap "Version Control")) |
| 1187 | (define-key menu-bar-tools-menu [pcl-cvs] |
| 1188 | '(menu-item "PCL-CVS" cvs-global-menu |
| 1189 | :help "Module-level interface to CVS")) |
| 1190 | (define-key menu-bar-tools-menu [vc] |
| 1191 | (list 'menu-item "Version Control" vc-menu-map |
| 1192 | :help "Interface to RCS, CVS, SCCS")) |
| 1193 | |
| 1194 | (define-key menu-bar-tools-menu [separator-compare] |
| 1195 | '("--")) |
| 1196 | |
| 1197 | (define-key menu-bar-tools-menu [ediff-misc] |
| 1198 | '(menu-item "Ediff Miscellanea" menu-bar-ediff-misc-menu |
| 1199 | :help "Ediff manual, customization, sessions, etc.")) |
| 1200 | (define-key menu-bar-tools-menu [epatch] |
| 1201 | '(menu-item "Apply Patch" menu-bar-epatch-menu)) |
| 1202 | (define-key menu-bar-tools-menu [ediff-merge] |
| 1203 | '(menu-item "Merge" menu-bar-ediff-merge-menu |
| 1204 | :help "Merge different revisions of files/directories")) |
| 1205 | (define-key menu-bar-tools-menu [compare] |
| 1206 | '(menu-item "Compare (Ediff)" menu-bar-ediff-menu |
| 1207 | :help "Display differences between files/directories")) |
| 1208 | |
| 1209 | |
| 1210 | (define-key menu-bar-tools-menu [separator-spell] |
| 1211 | '("--")) |
| 1212 | |
| 1213 | (define-key menu-bar-tools-menu [spell] |
| 1214 | '(menu-item "Spell Checking" ispell-menu-map)) |
| 1215 | |
| 1216 | (define-key menu-bar-tools-menu [separator-prog] |
| 1217 | '("--")) |
| 1218 | |
| 1219 | (define-key menu-bar-tools-menu [gdb] |
| 1220 | '(menu-item "Debugger (GDB)..." gdb |
| 1221 | :help "Debug a program from within Emacs with GDB")) |
| 1222 | (define-key menu-bar-tools-menu [shell-on-region] |
| 1223 | '(menu-item "Shell Command on Region..." shell-command-on-region |
| 1224 | :enable mark-active |
| 1225 | :help "Pass marked region to a shell command")) |
| 1226 | (define-key menu-bar-tools-menu [shell] |
| 1227 | '(menu-item "Shell Command..." shell-command |
| 1228 | :help "Invoke a shell command and catch its output")) |
| 1229 | (define-key menu-bar-tools-menu [compile] |
| 1230 | '(menu-item "Compile..." compile |
| 1231 | :help "Invoke compiler or Make, view compilation errors")) |
| 1232 | (define-key menu-bar-tools-menu [grep] |
| 1233 | '(menu-item "Search Files (with grep)..." grep |
| 1234 | :help "Search files for strings or regexps (with grep)")) |
| 1235 | |
| 1236 | \f |
| 1237 | ;; The "Help" menu items |
| 1238 | |
| 1239 | (defvar menu-bar-describe-menu (make-sparse-keymap "Describe")) |
| 1240 | |
| 1241 | (define-key menu-bar-describe-menu [mule-diag] |
| 1242 | '(menu-item "Show All of Mule Status" mule-diag |
| 1243 | :visible default-enable-multibyte-characters |
| 1244 | :help "Display multilingual environment settings")) |
| 1245 | (define-key menu-bar-describe-menu [describe-coding-system-briefly] |
| 1246 | '(menu-item "Describe Coding System (Briefly)..." |
| 1247 | describe-current-coding-system-briefly |
| 1248 | :visible default-enable-multibyte-characters)) |
| 1249 | (define-key menu-bar-describe-menu [describe-coding-system] |
| 1250 | '(menu-item "Describe Coding System..." describe-coding-system |
| 1251 | :visible default-enable-multibyte-characters)) |
| 1252 | (define-key menu-bar-describe-menu [describe-input-method] |
| 1253 | '(menu-item "Describe Input Method..." describe-input-method |
| 1254 | :visible default-enable-multibyte-characters |
| 1255 | :help "Keyboard layout for specific input method")) |
| 1256 | (define-key menu-bar-describe-menu [describe-language-environment] |
| 1257 | (list 'menu-item "Describe Language Environment" |
| 1258 | describe-language-environment-map |
| 1259 | :help "Show multilingual settings for a specific language")) |
| 1260 | |
| 1261 | (define-key menu-bar-describe-menu [separator-desc-mule] |
| 1262 | '("--")) |
| 1263 | |
| 1264 | (define-key menu-bar-describe-menu [list-keybindings] |
| 1265 | '(menu-item "List Key Bindings" describe-bindings |
| 1266 | :help "Display a list of all current keybindings")) |
| 1267 | (define-key menu-bar-describe-menu [describe-current-display-table] |
| 1268 | '(menu-item "Describe Display Table" describe-current-display-table |
| 1269 | :help "Describe the current display table")) |
| 1270 | (define-key menu-bar-describe-menu [describe-face] |
| 1271 | '(menu-item "Describe Face..." describe-face |
| 1272 | :help "Display the properties of a face")) |
| 1273 | (define-key menu-bar-describe-menu [describe-variable] |
| 1274 | '(menu-item "Describe Variable..." describe-variable |
| 1275 | :help "Display documentation of variable/option")) |
| 1276 | (define-key menu-bar-describe-menu [describe-function] |
| 1277 | '(menu-item "Describe Function..." describe-function |
| 1278 | :help "Display documentation of function/command")) |
| 1279 | (define-key menu-bar-describe-menu [describe-key-1] |
| 1280 | '(menu-item "Describe Key or Mouse Operation..." describe-key |
| 1281 | ;; Users typically don't identify keys and menu items... |
| 1282 | :help "Display documentation of command bound to a \ |
| 1283 | key, a click, or a menu-item")) |
| 1284 | (define-key menu-bar-describe-menu [describe-mode] |
| 1285 | '(menu-item "Describe Buffer Modes" describe-mode |
| 1286 | :help "Describe this buffer's major and minor mode")) |
| 1287 | |
| 1288 | (defvar menu-bar-apropos-menu (make-sparse-keymap "Apropos")) |
| 1289 | (defun menu-bar-read-lispref () |
| 1290 | "Display the Emacs Lisp Reference manual in Info mode." |
| 1291 | (interactive) |
| 1292 | (info "elisp")) |
| 1293 | |
| 1294 | (defun menu-bar-read-lispintro () |
| 1295 | "Display the Introduction to Emacs Lisp Programming in Info mode." |
| 1296 | (interactive) |
| 1297 | (info "eintr")) |
| 1298 | |
| 1299 | (defun search-emacs-glossary () |
| 1300 | "Display the Glossary node of the Emacs manual in Info mode." |
| 1301 | (interactive) |
| 1302 | (info "(emacs)Glossary")) |
| 1303 | |
| 1304 | (defun emacs-index-search (topic) |
| 1305 | "Look up TOPIC in the indices of the Emacs User Manual." |
| 1306 | (interactive "sSubject to look up: ") |
| 1307 | (info "emacs") |
| 1308 | (Info-index topic)) |
| 1309 | |
| 1310 | (defun elisp-index-search (topic) |
| 1311 | "Look up TOPIC in the indices of the Emacs Lisp Reference Manual." |
| 1312 | (interactive "sSubject to look up: ") |
| 1313 | (info "elisp") |
| 1314 | (Info-index topic)) |
| 1315 | |
| 1316 | (define-key menu-bar-apropos-menu [apropos-documentation] |
| 1317 | '(menu-item "Search Documentation Strings..." apropos-documentation |
| 1318 | :help |
| 1319 | "Find functions and variables whose doc strings match a regexp")) |
| 1320 | (define-key menu-bar-apropos-menu [apropos] |
| 1321 | '(menu-item "Find Any Object by Name..." apropos |
| 1322 | :help "Find symbols of any kind whose names match a regexp")) |
| 1323 | (define-key menu-bar-apropos-menu [apropos-value] |
| 1324 | '(menu-item "Find Options by Value..." apropos-value |
| 1325 | :help "Find variables whose values match a regexp")) |
| 1326 | (define-key menu-bar-apropos-menu [apropos-variables] |
| 1327 | '(menu-item "Find Options by Name..." apropos-variable |
| 1328 | :help "Find variables whose names match a regexp")) |
| 1329 | (define-key menu-bar-apropos-menu [apropos-commands] |
| 1330 | '(menu-item "Find Commands by Name..." apropos-command |
| 1331 | :help "Find commands whose names match a regexp")) |
| 1332 | (define-key menu-bar-apropos-menu [sep1] |
| 1333 | '("--")) |
| 1334 | (define-key menu-bar-apropos-menu [elisp-index-search] |
| 1335 | '(menu-item "Look Up Subject in ELisp Manual..." elisp-index-search |
| 1336 | :help "Find description of a subject in Emacs Lisp manual")) |
| 1337 | (define-key menu-bar-apropos-menu [emacs-index-search] |
| 1338 | '(menu-item "Look Up Subject in User Manual..." emacs-index-search |
| 1339 | :help "Find description of a subject in Emacs User manual")) |
| 1340 | (define-key menu-bar-apropos-menu [emacs-glossary] |
| 1341 | '(menu-item "Emacs Terminology" search-emacs-glossary |
| 1342 | :help "Display the Glossary section of the Emacs manual")) |
| 1343 | |
| 1344 | (defvar menu-bar-manuals-menu (make-sparse-keymap "More Manuals")) |
| 1345 | |
| 1346 | (define-key menu-bar-manuals-menu [man] |
| 1347 | '(menu-item "Read Man Page..." manual-entry |
| 1348 | :help "Man-page docs for external commands and libraries")) |
| 1349 | (define-key menu-bar-manuals-menu [sep2] |
| 1350 | '("--")) |
| 1351 | (define-key menu-bar-manuals-menu [order-emacs-manuals] |
| 1352 | '(menu-item "Ordering Manuals" view-order-manuals |
| 1353 | :help "How to order manuals from the Free Software Foundation")) |
| 1354 | (define-key menu-bar-manuals-menu [info] |
| 1355 | '(menu-item "All Other Manuals (Info)" Info-directory |
| 1356 | :help "Read any of the installed manuals")) |
| 1357 | (define-key menu-bar-manuals-menu [info-elisp] |
| 1358 | '(menu-item "Emacs Lisp Reference" menu-bar-read-lispref |
| 1359 | :help "Read the Emacs Lisp Reference manual")) |
| 1360 | (define-key menu-bar-manuals-menu [info-elintro] |
| 1361 | '(menu-item "Introduction to Emacs Lisp" menu-bar-read-lispintro |
| 1362 | :help "Read the Introduction to Emacs Lisp Programming")) |
| 1363 | (define-key menu-bar-manuals-menu [sep3] |
| 1364 | '("--")) |
| 1365 | (define-key menu-bar-manuals-menu [command] |
| 1366 | '(menu-item "Find Command in Manual..." Info-goto-emacs-command-node |
| 1367 | :help "Display manual section that describes a command")) |
| 1368 | (define-key menu-bar-manuals-menu [key] |
| 1369 | '(menu-item "Find Key in Manual..." Info-goto-emacs-key-command-node |
| 1370 | :help "Display manual section that describes a key")) |
| 1371 | |
| 1372 | (define-key menu-bar-help-menu [eliza] |
| 1373 | '(menu-item "Emacs Psychiatrist" doctor |
| 1374 | :help "Our doctor will help you feel better")) |
| 1375 | (define-key menu-bar-help-menu [sep4] |
| 1376 | '("--")) |
| 1377 | (define-key menu-bar-help-menu [describe-no-warranty] |
| 1378 | '(menu-item "(Non)Warranty" describe-no-warranty |
| 1379 | :help "Explain that Emacs has NO WARRANTY")) |
| 1380 | (define-key menu-bar-help-menu [describe-copying] |
| 1381 | '(menu-item "Copying Conditions" describe-copying |
| 1382 | :help "Show the Emacs license (GPL)")) |
| 1383 | (define-key menu-bar-help-menu [describe-distribution] |
| 1384 | '(menu-item "Getting New Versions" describe-distribution |
| 1385 | :help "How to get latest versions of Emacs")) |
| 1386 | (define-key menu-bar-help-menu [more] |
| 1387 | '(menu-item "Find Extra Packages" |
| 1388 | menu-bar-help-extra-packages |
| 1389 | :help "Where to find some extra packages and possible updates")) |
| 1390 | (defun menu-bar-help-extra-packages () |
| 1391 | "Display help about some additional packages available for Emacs." |
| 1392 | (interactive) |
| 1393 | (let (enable-local-variables) |
| 1394 | (view-file (expand-file-name "MORE.STUFF" |
| 1395 | data-directory)) |
| 1396 | (goto-address))) |
| 1397 | (define-key menu-bar-help-menu [about] |
| 1398 | '(menu-item "About Emacs" display-splash-screen |
| 1399 | :help "Display version number, copyright info, and basic help")) |
| 1400 | (define-key menu-bar-help-menu [sep2] |
| 1401 | '("--")) |
| 1402 | (define-key menu-bar-help-menu [finder-by-keyword] |
| 1403 | '(menu-item "Find Emacs Packages" finder-by-keyword |
| 1404 | :help "Find packages and features by keyword")) |
| 1405 | (define-key menu-bar-help-menu [manuals] |
| 1406 | (list 'menu-item "More Manuals" menu-bar-manuals-menu |
| 1407 | :help "Search and browse on-line manuals")) |
| 1408 | (define-key menu-bar-help-menu [emacs-manual] |
| 1409 | '(menu-item "Read the Emacs Manual" info-emacs-manual |
| 1410 | :help "Full documentation of Emacs features")) |
| 1411 | (define-key menu-bar-help-menu [describe] |
| 1412 | (list 'menu-item "Describe" menu-bar-describe-menu |
| 1413 | :help "Describe commands, variables, keys")) |
| 1414 | (define-key menu-bar-help-menu [apropos] |
| 1415 | (list 'menu-item "Search Documentation" menu-bar-apropos-menu |
| 1416 | :help "Look up terms, find commands, options, etc. (Apropos)")) |
| 1417 | (define-key menu-bar-help-menu [sep1] |
| 1418 | '("--")) |
| 1419 | (define-key menu-bar-help-menu [report-emacs-bug] |
| 1420 | '(menu-item "Send Bug Report..." report-emacs-bug |
| 1421 | :help "Send e-mail to Emacs maintainers")) |
| 1422 | (define-key menu-bar-help-menu [emacs-problems] |
| 1423 | '(menu-item "Emacs Known Problems" view-emacs-problems)) |
| 1424 | (define-key menu-bar-help-menu [emacs-news] |
| 1425 | '(menu-item "Emacs News" view-emacs-news |
| 1426 | :help "New features of this version")) |
| 1427 | (define-key menu-bar-help-menu [emacs-faq] |
| 1428 | '(menu-item "Emacs FAQ" view-emacs-FAQ)) |
| 1429 | |
| 1430 | (defun help-with-tutorial-spec-language () |
| 1431 | "Use the Emacs tutorial, specifying which language you want." |
| 1432 | (interactive) |
| 1433 | (help-with-tutorial t)) |
| 1434 | |
| 1435 | (define-key menu-bar-help-menu [emacs-tutorial-language-specific] |
| 1436 | '(menu-item "Emacs Tutorial (choose language)..." |
| 1437 | help-with-tutorial-spec-language |
| 1438 | :help "Learn how to use Emacs (choose a language)")) |
| 1439 | (define-key menu-bar-help-menu [emacs-tutorial] |
| 1440 | '(menu-item "Emacs Tutorial" help-with-tutorial |
| 1441 | :help "Learn how to use Emacs")) |
| 1442 | |
| 1443 | (defun kill-this-buffer () ; for the menubar |
| 1444 | "Kill the current buffer." |
| 1445 | (interactive) |
| 1446 | (kill-buffer (current-buffer))) |
| 1447 | |
| 1448 | (defun kill-this-buffer-enabled-p () |
| 1449 | (let ((count 0) |
| 1450 | (buffers (buffer-list))) |
| 1451 | (while buffers |
| 1452 | (or (string-match "^ " (buffer-name (car buffers))) |
| 1453 | (setq count (1+ count))) |
| 1454 | (setq buffers (cdr buffers))) |
| 1455 | (and (not (window-minibuffer-p (frame-selected-window menu-updating-frame))) |
| 1456 | (> count 1)))) |
| 1457 | |
| 1458 | (put 'dired 'menu-enable |
| 1459 | '(not (window-minibuffer-p (frame-selected-window menu-updating-frame)))) |
| 1460 | |
| 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)) |
| 1465 | (count 0)) |
| 1466 | (while frames |
| 1467 | (if (frame-visible-p (car frames)) |
| 1468 | (setq count (1+ count))) |
| 1469 | (setq frames (cdr frames))) |
| 1470 | (> count 1))) |
| 1471 | |
| 1472 | (defcustom yank-menu-length 20 |
| 1473 | "*Maximum length to display in the yank-menu." |
| 1474 | :type 'integer |
| 1475 | :group 'mouse) |
| 1476 | |
| 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) |
| 1480 | string |
| 1481 | (concat |
| 1482 | (substring string 0 (/ yank-menu-length 2)) |
| 1483 | "..." |
| 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)))) |
| 1493 | (progn |
| 1494 | (setcar front string) |
| 1495 | (setcar (cdr front) menu-string)) |
| 1496 | (setcdr yank-menu |
| 1497 | (cons |
| 1498 | (cons string (cons menu-string 'menu-bar-select-yank)) |
| 1499 | (cdr yank-menu))))) |
| 1500 | (if (> (length (cdr yank-menu)) kill-ring-max) |
| 1501 | (setcdr (nthcdr kill-ring-max yank-menu) nil))) |
| 1502 | |
| 1503 | (put 'menu-bar-select-yank 'apropos-inhibit t) |
| 1504 | (defun menu-bar-select-yank () |
| 1505 | (interactive "*") |
| 1506 | (push-mark (point)) |
| 1507 | (insert last-command-event)) |
| 1508 | |
| 1509 | \f |
| 1510 | (defcustom buffers-menu-show-directories 'unless-uniquify |
| 1511 | "If non-nil, show directories in the Buffers menu for buffers that have them. |
| 1512 | The special value `unless-uniquify' means that directories will be shown |
| 1513 | unless `uniquify-buffer-name-style' is non-nil (in which case, buffer |
| 1514 | names should include enough of a buffer's directory to distinguish it |
| 1515 | from other buffers). |
| 1516 | |
| 1517 | Setting this variable directly does not take effect until next time the |
| 1518 | Buffers menu is regenerated." |
| 1519 | :set (lambda (symbol value) |
| 1520 | (set symbol value) |
| 1521 | (menu-bar-update-buffers t)) |
| 1522 | :initialize 'custom-initialize-default |
| 1523 | :type '(choice (const :tag "Never" nil) |
| 1524 | (const :tag "Unless uniquify is enabled" unless-uniquify) |
| 1525 | (const :tag "Always" t)) |
| 1526 | :group 'menu) |
| 1527 | |
| 1528 | (defcustom buffers-menu-show-status t |
| 1529 | "If non-nil, show modified/read-only status of buffers in the Buffers menu. |
| 1530 | Setting this variable directly does not take effect until next time the |
| 1531 | Buffers menu is regenerated." |
| 1532 | :set (lambda (symbol value) |
| 1533 | (set symbol value) |
| 1534 | (menu-bar-update-buffers t)) |
| 1535 | :initialize 'custom-initialize-default |
| 1536 | :type 'boolean |
| 1537 | :group 'menu) |
| 1538 | |
| 1539 | (defvar list-buffers-directory nil) |
| 1540 | |
| 1541 | (defvar menu-bar-update-buffers-maxbuf) |
| 1542 | |
| 1543 | (defun menu-bar-select-buffer () |
| 1544 | (interactive) |
| 1545 | (switch-to-buffer last-command-event)) |
| 1546 | |
| 1547 | (defun menu-bar-select-frame () |
| 1548 | (interactive) |
| 1549 | (let (frame) |
| 1550 | (dolist (f (frame-list)) |
| 1551 | (when (equal last-command-event (frame-parameter f 'name)) |
| 1552 | (setq frame f))) |
| 1553 | ;; FRAME can be nil when user specifies the selected frame. |
| 1554 | (setq frame (or frame (selected-frame))) |
| 1555 | (make-frame-visible frame) |
| 1556 | (raise-frame frame) |
| 1557 | (select-frame frame))) |
| 1558 | |
| 1559 | (defun menu-bar-update-buffers-1 (elt) |
| 1560 | (let* ((buf (car elt)) |
| 1561 | (file |
| 1562 | (and (if (eq buffers-menu-show-directories 'unless-uniquify) |
| 1563 | (or (not (boundp 'uniquify-buffer-name-style)) |
| 1564 | (null uniquify-buffer-name-style)) |
| 1565 | buffers-menu-show-directories) |
| 1566 | (or (buffer-file-name buf) |
| 1567 | (buffer-local-value 'list-buffers-directory buf))))) |
| 1568 | (when file |
| 1569 | (setq file (file-name-directory file))) |
| 1570 | (when (and file (> (length file) 20)) |
| 1571 | (setq file (concat "..." (substring file -17)))) |
| 1572 | (cons (if buffers-menu-show-status |
| 1573 | (let ((mod (if (buffer-modified-p buf) "*" "")) |
| 1574 | (ro (if (buffer-local-value 'buffer-read-only buf) "%" ""))) |
| 1575 | (if file |
| 1576 | (format "%s %s%s -- %s" (cdr elt) mod ro file) |
| 1577 | (format "%s %s%s" (cdr elt) mod ro))) |
| 1578 | (if file |
| 1579 | (format "%s -- %s" (cdr elt) file) |
| 1580 | (cdr elt))) |
| 1581 | buf))) |
| 1582 | |
| 1583 | ;; Used to cache the menu entries for commands in the Buffers menu |
| 1584 | (defvar menu-bar-buffers-menu-command-entries nil) |
| 1585 | |
| 1586 | (defun menu-bar-update-buffers (&optional force) |
| 1587 | ;; If user discards the Buffers item, play along. |
| 1588 | (and (lookup-key (current-global-map) [menu-bar buffer]) |
| 1589 | (or force (frame-or-buffer-changed-p)) |
| 1590 | (let ((buffers (buffer-list)) |
| 1591 | (frames (frame-list)) |
| 1592 | buffers-menu frames-menu) |
| 1593 | ;; If requested, list only the N most recently selected buffers. |
| 1594 | (if (and (integerp buffers-menu-max-size) |
| 1595 | (> buffers-menu-max-size 1)) |
| 1596 | (if (> (length buffers) buffers-menu-max-size) |
| 1597 | (setcdr (nthcdr buffers-menu-max-size buffers) nil))) |
| 1598 | |
| 1599 | ;; Make the menu of buffers proper. |
| 1600 | (setq buffers-menu |
| 1601 | (let* ((buffer-list |
| 1602 | (mapcar 'list buffers)) |
| 1603 | (menu-bar-update-buffers-maxbuf 0) |
| 1604 | alist) |
| 1605 | ;; Put into each element of buffer-list |
| 1606 | ;; the name for actual display, |
| 1607 | ;; perhaps truncated in the middle. |
| 1608 | (dolist (buf buffer-list) |
| 1609 | (let ((name (buffer-name (car buf)))) |
| 1610 | (setcdr buf |
| 1611 | (if (> (length name) 27) |
| 1612 | (concat (substring name 0 12) |
| 1613 | "..." |
| 1614 | (substring name -12)) |
| 1615 | name)))) |
| 1616 | ;; Compute the maximum length of any name. |
| 1617 | (dolist (buf buffer-list) |
| 1618 | (unless (eq ?\ (aref (cdr buf) 0)) |
| 1619 | (setq menu-bar-update-buffers-maxbuf |
| 1620 | (max menu-bar-update-buffers-maxbuf |
| 1621 | (length (cdr buf)))))) |
| 1622 | ;; Set ALIST to an alist of the form |
| 1623 | ;; ITEM-STRING . BUFFER |
| 1624 | (dolist (buf buffer-list) |
| 1625 | (unless (eq ?\ (aref (cdr buf) 0)) |
| 1626 | (push (menu-bar-update-buffers-1 buf) alist))) |
| 1627 | ;; Now make the actual list of items, and add |
| 1628 | ;; some miscellaneous buffer commands to the end. |
| 1629 | (mapcar (lambda (pair) |
| 1630 | ;; This is somewhat risque, to use |
| 1631 | ;; the buffer name itself as the event |
| 1632 | ;; type to define, but it works. |
| 1633 | ;; It would not work to use the buffer |
| 1634 | ;; since a buffer as an event has its |
| 1635 | ;; own meaning. |
| 1636 | (nconc (list (buffer-name (cdr pair)) |
| 1637 | (car pair) |
| 1638 | (cons nil nil)) |
| 1639 | 'menu-bar-select-buffer)) |
| 1640 | (nreverse alist)))) |
| 1641 | |
| 1642 | ;; Make a Frames menu if we have more than one frame. |
| 1643 | (when (cdr frames) |
| 1644 | (let ((frames-menu |
| 1645 | (cons 'keymap |
| 1646 | (cons "Select Frame" |
| 1647 | (mapcar |
| 1648 | (lambda (frame) |
| 1649 | (nconc |
| 1650 | (list (frame-parameter frame 'name) |
| 1651 | (frame-parameter frame 'name) |
| 1652 | (cons nil nil)) |
| 1653 | 'menu-bar-select-frame)) |
| 1654 | frames))))) |
| 1655 | ;; Put it after the normal buffers |
| 1656 | (setq buffers-menu |
| 1657 | (nconc buffers-menu |
| 1658 | `((frames-separator "--") |
| 1659 | (frames menu-item "Frames" ,frames-menu)))))) |
| 1660 | |
| 1661 | ;; Add in some normal commands at the end of the menu. We use |
| 1662 | ;; the copy cached in `menu-bar-buffers-menu-command-entries' |
| 1663 | ;; if it's been set already. Note that we can't use constant |
| 1664 | ;; lists for the menu-entries, because the low-level menu-code |
| 1665 | ;; modifies them. |
| 1666 | (unless menu-bar-buffers-menu-command-entries |
| 1667 | (setq menu-bar-buffers-menu-command-entries |
| 1668 | (list '(command-separator "--") |
| 1669 | (list 'next-buffer |
| 1670 | 'menu-item |
| 1671 | "Next Buffer" |
| 1672 | 'next-buffer |
| 1673 | :help "Switch to the \"next\" buffer in a cyclic order") |
| 1674 | (list 'prev-buffer |
| 1675 | 'menu-item |
| 1676 | "Previous Buffer" |
| 1677 | 'prev-buffer |
| 1678 | :help "Switch to the \"previous\" buffer in a cyclic order") |
| 1679 | (list 'select-named-buffer |
| 1680 | 'menu-item |
| 1681 | "Select Named Buffer..." |
| 1682 | 'switch-to-buffer |
| 1683 | :help "Prompt for a buffer name, and select that buffer in the current window") |
| 1684 | (list 'list-all-buffers |
| 1685 | 'menu-item |
| 1686 | "List All Buffers" |
| 1687 | 'list-buffers |
| 1688 | :help "Pop up a window listing all emacs buffers" |
| 1689 | )))) |
| 1690 | (setq buffers-menu |
| 1691 | (nconc buffers-menu menu-bar-buffers-menu-command-entries)) |
| 1692 | |
| 1693 | (setq buffers-menu (cons 'keymap (cons "Select Buffer" buffers-menu))) |
| 1694 | (define-key (current-global-map) [menu-bar buffer] |
| 1695 | ;; Call copy-sequence so the string is not pure. |
| 1696 | (cons (copy-sequence "Buffers") buffers-menu))))) |
| 1697 | |
| 1698 | (add-hook 'menu-bar-update-hook 'menu-bar-update-buffers) |
| 1699 | |
| 1700 | (menu-bar-update-buffers) |
| 1701 | |
| 1702 | ;; this version is too slow |
| 1703 | ;;(defun format-buffers-menu-line (buffer) |
| 1704 | ;; "Returns a string to represent the given buffer in the Buffer menu. |
| 1705 | ;;nil means the buffer shouldn't be listed. You can redefine this." |
| 1706 | ;; (if (string-match "\\` " (buffer-name buffer)) |
| 1707 | ;; nil |
| 1708 | ;; (save-excursion |
| 1709 | ;; (set-buffer buffer) |
| 1710 | ;; (let ((size (buffer-size))) |
| 1711 | ;; (format "%s%s %-19s %6s %-15s %s" |
| 1712 | ;; (if (buffer-modified-p) "*" " ") |
| 1713 | ;; (if buffer-read-only "%" " ") |
| 1714 | ;; (buffer-name) |
| 1715 | ;; size |
| 1716 | ;; mode-name |
| 1717 | ;; (or (buffer-file-name) "")))))) |
| 1718 | \f |
| 1719 | ;;; Set up a menu bar menu for the minibuffer. |
| 1720 | |
| 1721 | (dolist (map (list minibuffer-local-map |
| 1722 | ;; This shouldn't be necessary, but there's a funny |
| 1723 | ;; bug in keymap.c that I don't understand yet. -stef |
| 1724 | minibuffer-local-completion-map)) |
| 1725 | (define-key map [menu-bar minibuf] |
| 1726 | (cons "Minibuf" (make-sparse-keymap "Minibuf")))) |
| 1727 | |
| 1728 | (let ((map minibuffer-local-completion-map)) |
| 1729 | (define-key map [menu-bar minibuf ?\?] |
| 1730 | (list 'menu-item "List Completions" 'minibuffer-completion-help |
| 1731 | :help "Display all possible completions")) |
| 1732 | (define-key map [menu-bar minibuf space] |
| 1733 | (list 'menu-item "Complete Word" 'minibuffer-complete-word |
| 1734 | :help "Complete at most one word")) |
| 1735 | (define-key map [menu-bar minibuf tab] |
| 1736 | (list 'menu-item "Complete" 'minibuffer-complete |
| 1737 | :help "Complete as far as possible"))) |
| 1738 | |
| 1739 | (let ((map minibuffer-local-map)) |
| 1740 | (define-key map [menu-bar minibuf quit] |
| 1741 | (list 'menu-item "Quit" 'keyboard-escape-quit |
| 1742 | :help "Abort input and exit minibuffer")) |
| 1743 | (define-key map [menu-bar minibuf return] |
| 1744 | (list 'menu-item "Enter" 'exit-minibuffer |
| 1745 | :help "Terminate input and exit minibuffer"))) |
| 1746 | \f |
| 1747 | ;;;###autoload |
| 1748 | ;; This comment is taken from toolbar/tool-bar.el near |
| 1749 | ;; (put 'tool-bar-mode ...) |
| 1750 | ;; We want to pretend the menu bar by standard is on, as this will make |
| 1751 | ;; customize consider disabling the menu bar a customization, and save |
| 1752 | ;; that. We could do this for real by setting :init-value below, but |
| 1753 | ;; that would overwrite disabling the tool bar from X resources. |
| 1754 | (put 'menu-bar-mode 'standard-value '(t)) |
| 1755 | |
| 1756 | ;;;###autoload |
| 1757 | (define-minor-mode menu-bar-mode |
| 1758 | "Toggle display of a menu bar on each frame. |
| 1759 | This command applies to all frames that exist and frames to be |
| 1760 | created in the future. |
| 1761 | With a numeric argument, if the argument is positive, |
| 1762 | turn on menu bars; otherwise, turn off menu bars." |
| 1763 | :init-value nil |
| 1764 | :global t |
| 1765 | :group 'frames |
| 1766 | ;; Make menu-bar-mode and default-frame-alist consistent. |
| 1767 | (let ((lines (if menu-bar-mode 1 0))) |
| 1768 | ;; Alter existing frames... |
| 1769 | (mapc (lambda (frame) |
| 1770 | (modify-frame-parameters frame |
| 1771 | (list (cons 'menu-bar-lines lines)))) |
| 1772 | (frame-list)) |
| 1773 | ;; ...and future ones. |
| 1774 | (let ((elt (assq 'menu-bar-lines default-frame-alist))) |
| 1775 | (if elt |
| 1776 | (setcdr elt lines) |
| 1777 | (add-to-list 'default-frame-alist (cons 'menu-bar-lines lines))))) |
| 1778 | |
| 1779 | ;; Make the message appear when Emacs is idle. We can not call message |
| 1780 | ;; directly. The minor-mode message "Menu-bar mode disabled" comes |
| 1781 | ;; after this function returns, overwriting any message we do here. |
| 1782 | (when (and (interactive-p) (not menu-bar-mode)) |
| 1783 | (run-with-idle-timer 0 nil 'message |
| 1784 | "Menu-bar mode disabled. Use M-x menu-bar-mode to make the menu bar appear.")) |
| 1785 | menu-bar-mode) |
| 1786 | |
| 1787 | (provide 'menu-bar) |
| 1788 | |
| 1789 | ;;; arch-tag: 6e6a3c22-4ec4-4d3d-8190-583f8ef94ced |
| 1790 | ;;; menu-bar.el ends here |