;;; menu-bar.el --- define a default menu bar
;; Copyright (C) 1993, 1994, 1995, 2000, 2001, 2002, 2003, 2004,
-;; 2005 Free Software Foundation, Inc.
+;; 2005, 2006 Free Software Foundation, Inc.
;; Author: RMS
;; Maintainer: FSF
(define-key menu-bar-file-menu [separator-save]
'(menu-item "--"))
+(defun menu-find-file-existing ()
+ "Edit the existing file FILENAME."
+ (interactive)
+ (let* ((mustmatch (not (and (fboundp 'x-uses-old-gtk-dialog)
+ (x-uses-old-gtk-dialog))))
+ (filename (car (find-file-read-args "Find file: " mustmatch))))
+ (if mustmatch
+ (find-file-existing filename)
+ (find-file filename))))
+
+
(define-key menu-bar-file-menu [kill-buffer]
'(menu-item "Close" kill-this-buffer
:enable (kill-this-buffer-enabled-p)
:enable (menu-bar-non-minibuffer-window-p)
:help "Read a directory, to operate on its files"))
(define-key menu-bar-file-menu [open-file]
- '(menu-item "Open File..." find-file-existing
+ '(menu-item "Open File..." menu-find-file-existing
:enable (menu-bar-non-minibuffer-window-p)
:help "Read an existing file into an Emacs buffer"))
(define-key menu-bar-file-menu [new-file]
(define-key menu-bar-search-menu [i-search]
- (list 'menu-item "Incremental Search" menu-bar-i-search-menu
- :help "Incremental Search finds partial matches while you type the search string.\nIt is most convenient from the keyboard. Try it!"))
+ (list 'menu-item "Incremental Search" menu-bar-i-search-menu))
(define-key menu-bar-search-menu [separator-tag-isearch]
'(menu-item "--"))
;;; 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"))
+ '(menu-item "Text Properties" facemenu-menu))
(define-key menu-bar-edit-menu [fill]
'(menu-item "Fill" fill-region
'(menu-item "--"))
(define-key menu-bar-edit-menu [bookmark]
- '(menu-item "Bookmarks" menu-bar-bookmark-map
- :help "Record positions and jump between them"))
+ '(menu-item "Bookmarks" menu-bar-bookmark-map))
(defvar menu-bar-goto-menu (make-sparse-keymap "Go To"))
(fset 'yank-menu (cons 'keymap yank-menu))
(define-key menu-bar-edit-menu [select-paste]
'(menu-item "Select and Paste" yank-menu
- :enable (and (cdr yank-menu) (not buffer-read-only))
- :help "Paste (yank) text cut or copied earlier"))
+ :enable (and (cdr yank-menu) (not buffer-read-only))))
(define-key menu-bar-edit-menu [paste]
'(menu-item "Paste" yank
:enable (and
:enable (and (not buffer-read-only)
(not (eq t buffer-undo-list))
(if (eq last-command 'undo)
- pending-undo-list
+ (listp pending-undo-list)
(consp buffer-undo-list)))
:help "Undo last operation"))
;;; 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"))
+ (list 'menu-item "Customize Emacs" menu-bar-custom-menu))
(defun menu-bar-options-save ()
"Save current values of Options menu items using Custom."
:visible (display-graphic-p)
:button (:radio . (eq fringe-mode nil))))
-(defun menu-bar-showhide-fringe-menu-customize-left ()
- "Display fringes only on the left of each window."
- (interactive)
- (require 'fringe)
- (customize-set-variable 'fringe-mode '(nil . 0)))
-
-(define-key menu-bar-showhide-fringe-menu [left]
- '(menu-item "On the Left" menu-bar-showhide-fringe-menu-customize-left
- :help "Fringe only on the left side"
- :visible (display-graphic-p)
- :button (:radio . (equal fringe-mode '(nil . 0)))))
-
(defun menu-bar-showhide-fringe-menu-customize-right ()
"Display fringes only on the right of each window."
(interactive)
:visible (display-graphic-p)
:button (:radio . (equal fringe-mode '(0 . nil)))))
+(defun menu-bar-showhide-fringe-menu-customize-left ()
+ "Display fringes only on the left of each window."
+ (interactive)
+ (require 'fringe)
+ (customize-set-variable 'fringe-mode '(nil . 0)))
+
+(define-key menu-bar-showhide-fringe-menu [left]
+ '(menu-item "On the Left" menu-bar-showhide-fringe-menu-customize-left
+ :help "Fringe only on the left side"
+ :visible (display-graphic-p)
+ :button (:radio . (equal fringe-mode '(nil . 0)))))
+
(defun menu-bar-showhide-fringe-menu-customize-disable ()
"Do not display window fringes."
(interactive)
(define-key menu-bar-showhide-menu [showhide-fringe]
(list 'menu-item "Fringe" menu-bar-showhide-fringe-menu
- :visible `(display-graphic-p)
- :help "Select fringe mode"))
+ :visible `(display-graphic-p)))
(defvar menu-bar-showhide-scroll-bar-menu (make-sparse-keymap "Scroll-bar"))
(define-key menu-bar-showhide-menu [showhide-scroll-bar]
(list 'menu-item "Scroll-bar" menu-bar-showhide-scroll-bar-menu
- :visible `(display-graphic-p)
- :help "Select scroll-bar mode"))
+ :visible `(display-graphic-p)))
(define-key menu-bar-showhide-menu [showhide-tooltip-mode]
(list 'menu-item "Tooltips" 'tooltip-mode
:button `(:toggle . tool-bar-mode)))
(define-key menu-bar-options-menu [showhide]
- (list 'menu-item "Show/Hide" menu-bar-showhide-menu
- :help "Toggle on/off various display features"))
+ (list 'menu-item "Show/Hide" menu-bar-showhide-menu))
(define-key menu-bar-options-menu [showhide-separator]
'("--"))
;; Most of the MULE menu actually does make sense in unibyte mode,
;; e.g. language selection.
;;; ':visible 'default-enable-multibyte-characters
- ':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
'(menu-item "Programmable Calculator" calc
:help "Invoke the Emacs built-in full scientific calculator"))
(define-key menu-bar-tools-menu [calendar]
- '(menu-item "Display Calendar" calendar))
+ '(menu-item "Calendar" calendar))
(define-key menu-bar-tools-menu [separator-net]
'("--"))
(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"))
+ '(menu-item "Directory Search" eudc-tools-menu))
(define-key menu-bar-tools-menu [compose-mail]
(list
'menu-item `(format "Send Mail (with %s)" (send-mail-item-name))
(defvar vc-menu-map (make-sparse-keymap "Version Control"))
(define-key menu-bar-tools-menu [pcl-cvs]
- '(menu-item "PCL-CVS" cvs-global-menu
- :help "Module-level interface to CVS"))
+ '(menu-item "PCL-CVS" cvs-global-menu))
(define-key menu-bar-tools-menu [vc]
- (list 'menu-item "Version Control" vc-menu-map
- :help "Interface to RCS, CVS, SCCS"))
+ (list 'menu-item "Version Control" vc-menu-map))
(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."))
+ '(menu-item "Ediff Miscellanea" menu-bar-ediff-misc-menu))
(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"))
+ '(menu-item "Merge" menu-bar-ediff-merge-menu))
(define-key menu-bar-tools-menu [compare]
- '(menu-item "Compare (Ediff)" menu-bar-ediff-menu
- :help "Display differences between files/directories"))
-
+ '(menu-item "Compare (Ediff)" menu-bar-ediff-menu))
(define-key menu-bar-tools-menu [separator-spell]
'("--"))
:help "Keyboard layout for specific input method"))
(define-key menu-bar-describe-menu [describe-language-environment]
(list 'menu-item "Describe Language Environment"
- describe-language-environment-map
- :help "Show multilingual settings for a specific language"))
+ describe-language-environment-map))
(define-key menu-bar-describe-menu [separator-desc-mule]
'("--"))
(define-key menu-bar-describe-menu [list-keybindings]
'(menu-item "List Key Bindings" describe-bindings
- :help "Display a list of all current keybindings"))
+ :help "Display all current keybindings (keyboard shortcuts)"))
(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"))
:help "Find commands whose names match a regexp"))
(define-key menu-bar-apropos-menu [sep1]
'("--"))
+(define-key menu-bar-apropos-menu [emacs-command-node]
+ '(menu-item "Look Up Command in User Manual..." Info-goto-emacs-command-node
+ :help "Display manual section that describes a command"))
+(define-key menu-bar-apropos-menu [emacs-key-command-node]
+ '(menu-item "Look Up Key in User Manual..." Info-goto-emacs-key-command-node
+ :help "Display manual section that describes a key"))
(define-key menu-bar-apropos-menu [elisp-index-search]
'(menu-item "Look Up Subject in ELisp Manual..." elisp-index-search
:help "Find description of a subject in Emacs Lisp manual"))
(define-key menu-bar-manuals-menu [order-emacs-manuals]
'(menu-item "Ordering Manuals" view-order-manuals
:help "How to order manuals from the Free Software Foundation"))
+(define-key menu-bar-manuals-menu [info-apropos]
+ '(menu-item "Lookup Subject in all manuals..." info-apropos
+ :help "Find description of a subject in all installed manuals"))
(define-key menu-bar-manuals-menu [info]
'(menu-item "All Other Manuals (Info)" Info-directory
:help "Read any of the installed manuals"))
(define-key menu-bar-manuals-menu [info-elintro]
'(menu-item "Introduction to Emacs Lisp" menu-bar-read-lispintro
:help "Read the Introduction to Emacs Lisp Programming"))
-(define-key menu-bar-manuals-menu [sep3]
- '("--"))
-(define-key menu-bar-manuals-menu [command]
- '(menu-item "Find Command in Manual..." Info-goto-emacs-command-node
- :help "Display manual section that describes a command"))
-(define-key menu-bar-manuals-menu [key]
- '(menu-item "Find Key in Manual..." Info-goto-emacs-key-command-node
- :help "Display manual section that describes a key"))
(define-key menu-bar-help-menu [eliza]
'(menu-item "Emacs Psychotherapist" doctor
'(menu-item "Find Emacs Packages" finder-by-keyword
:help "Find packages and features by keyword"))
(define-key menu-bar-help-menu [manuals]
- (list 'menu-item "More Manuals" menu-bar-manuals-menu
- :help "Search and browse on-line manuals"))
+ (list 'menu-item "More Manuals" menu-bar-manuals-menu))
(define-key menu-bar-help-menu [emacs-manual]
'(menu-item "Read the Emacs Manual" info-emacs-manual
:help "Full documentation of Emacs features"))
(define-key menu-bar-help-menu [describe]
- (list 'menu-item "Describe" menu-bar-describe-menu
- :help "Describe commands, variables, keys"))
+ (list 'menu-item "Describe" menu-bar-describe-menu))
(define-key menu-bar-help-menu [apropos]
- (list 'menu-item "Search Documentation" menu-bar-apropos-menu
- :help "Look up terms, find commands, options, etc. (Apropos)"))
+ (list 'menu-item "Search Documentation" menu-bar-apropos-menu))
(define-key menu-bar-help-menu [sep1]
'("--"))
(define-key menu-bar-help-menu [report-emacs-bug]
(defun menu-bar-menu-frame-live-and-visible-p ()
"Return non-nil if the menu frame is alive and visible.
The menu frame is the frame for which we are updating the menu."
- (let ((menu-frame (if (display-multi-frame-p) menu-updating-frame
- (selected-frame))))
+ (let ((menu-frame (or menu-updating-frame (selected-frame))))
(and (frame-live-p menu-frame)
(frame-visible-p menu-frame))))
See the documentation of `menu-bar-menu-frame-live-and-visible-p'
for the definition of the menu frame."
- (let ((menu-frame (if (display-multi-frame-p) menu-updating-frame
- (selected-frame))))
+ (let ((menu-frame (or menu-updating-frame (selected-frame))))
(not (window-minibuffer-p (frame-selected-window menu-frame)))))
-(defun kill-this-buffer () ; for the menubar
+(defun kill-this-buffer () ; for the menu bar
"Kill the current buffer."
(interactive)
(kill-buffer (current-buffer)))
(put 'menu-bar-select-yank 'apropos-inhibit t)
(defun menu-bar-select-yank ()
+ "Insert the stretch of previously-killed text selected from menu.
+The menu shows all the killed text sequences stored in `kill-ring'."
(interactive "*")
(push-mark (point))
(insert last-command-event))
"Next Buffer"
'next-buffer
:help "Switch to the \"next\" buffer in a cyclic order")
- (list 'prev-buffer
+ (list 'previous-buffer
'menu-item
"Previous Buffer"
- 'prev-buffer
+ 'previous-buffer
:help "Switch to the \"previous\" buffer in a cyclic order")
(list 'select-named-buffer
'menu-item