2001-07-15 16:15:35 +00:00
|
|
|
|
;;; menu-bar.el --- define a default menu bar
|
1993-04-08 16:17:43 +00:00
|
|
|
|
|
2002-01-27 11:17:39 +00:00
|
|
|
|
;; Copyright (C) 1993, 1994, 1995, 2000, 2001, 2002 Free Software Foundation, Inc.
|
1996-01-14 07:34:30 +00:00
|
|
|
|
|
1993-04-08 16:17:43 +00:00
|
|
|
|
;; Author: RMS
|
1997-05-27 15:32:03 +00:00
|
|
|
|
;; Maintainer: FSF
|
2000-09-07 13:51:59 +00:00
|
|
|
|
;; Keywords: internal, mouse
|
1993-04-08 16:17:43 +00:00
|
|
|
|
|
1993-04-08 07:10:13 +00:00
|
|
|
|
;; This file is part of GNU Emacs.
|
|
|
|
|
|
|
|
|
|
;; GNU Emacs is free software; you can redistribute it and/or modify
|
|
|
|
|
;; it under the terms of the GNU General Public License as published by
|
|
|
|
|
;; the Free Software Foundation; either version 2, or (at your option)
|
|
|
|
|
;; any later version.
|
|
|
|
|
|
|
|
|
|
;; GNU Emacs is distributed in the hope that it will be useful,
|
|
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
;; GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
1996-01-14 07:34:30 +00:00
|
|
|
|
;; along with GNU Emacs; see the file COPYING. If not, write to the
|
|
|
|
|
;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
|
;; Boston, MA 02111-1307, USA.
|
1993-04-08 07:10:13 +00:00
|
|
|
|
|
1995-07-17 22:51:17 +00:00
|
|
|
|
;; Avishai Yacobi suggested some menu rearrangements.
|
|
|
|
|
|
2001-07-15 16:15:35 +00:00
|
|
|
|
;;; Commentary:
|
|
|
|
|
|
1996-01-14 07:34:30 +00:00
|
|
|
|
;;; Code:
|
|
|
|
|
|
1995-12-26 19:11:18 +00:00
|
|
|
|
;;; User options:
|
|
|
|
|
|
1997-05-05 15:06:25 +00:00
|
|
|
|
(defcustom buffers-menu-max-size 10
|
1995-12-26 19:11:18 +00:00
|
|
|
|
"*Maximum number of entries which may appear on the Buffers menu.
|
|
|
|
|
If this is 10, then only the ten most-recently-selected buffers are shown.
|
|
|
|
|
If this is nil, then all buffers are shown.
|
1997-05-05 15:06:25 +00:00
|
|
|
|
A large number or nil slows down menu responsiveness."
|
|
|
|
|
:type '(choice integer
|
|
|
|
|
(const :tag "All" nil))
|
|
|
|
|
:group 'mouse)
|
1995-12-26 19:11:18 +00:00
|
|
|
|
|
1993-09-06 22:48:00 +00:00
|
|
|
|
;; Don't clobber an existing menu-bar keymap, to preserve any menu-bar key
|
|
|
|
|
;; definitions made in loaddefs.el.
|
|
|
|
|
(or (lookup-key global-map [menu-bar])
|
|
|
|
|
(define-key global-map [menu-bar] (make-sparse-keymap "menu-bar")))
|
1993-06-05 19:13:03 +00:00
|
|
|
|
(defvar menu-bar-help-menu (make-sparse-keymap "Help"))
|
1995-03-19 21:11:13 +00:00
|
|
|
|
|
|
|
|
|
;; Force Help item to come last, after the major mode's own items.
|
1995-06-13 03:29:47 +00:00
|
|
|
|
;; The symbol used to be called `help', but that gets confused with the
|
|
|
|
|
;; help key.
|
|
|
|
|
(setq menu-bar-final-items '(help-menu))
|
1995-03-19 21:11:13 +00:00
|
|
|
|
|
1995-06-13 03:29:47 +00:00
|
|
|
|
(define-key global-map [menu-bar help-menu] (cons "Help" menu-bar-help-menu))
|
1995-03-19 21:11:13 +00:00
|
|
|
|
(defvar menu-bar-tools-menu (make-sparse-keymap "Tools"))
|
|
|
|
|
(define-key global-map [menu-bar tools] (cons "Tools" menu-bar-tools-menu))
|
2000-02-17 11:08:09 +00:00
|
|
|
|
;; This definition is just to show what this looks like.
|
|
|
|
|
;; It gets overridden below when menu-bar-update-buffers is called.
|
|
|
|
|
(define-key global-map [menu-bar buffer]
|
|
|
|
|
(cons "Buffers" (make-sparse-keymap "Buffers")))
|
|
|
|
|
(defvar menu-bar-options-menu (make-sparse-keymap "Options"))
|
|
|
|
|
(define-key global-map [menu-bar options]
|
|
|
|
|
(cons "Options" menu-bar-options-menu))
|
|
|
|
|
(defvar menu-bar-edit-menu (make-sparse-keymap "Edit"))
|
|
|
|
|
(define-key global-map [menu-bar edit] (cons "Edit" menu-bar-edit-menu))
|
|
|
|
|
(defvar menu-bar-files-menu (make-sparse-keymap "File"))
|
|
|
|
|
(define-key global-map [menu-bar files] (cons "File" menu-bar-files-menu))
|
1995-04-08 05:01:03 +00:00
|
|
|
|
|
|
|
|
|
;; This alias is for compatibility with 19.28 and before.
|
|
|
|
|
(defvar menu-bar-file-menu menu-bar-files-menu)
|
2002-04-23 14:33:02 +00:00
|
|
|
|
|
|
|
|
|
;; This is referenced by some code below; it is defined in uniquify.el
|
|
|
|
|
(defvar uniquify-buffer-name-style)
|
|
|
|
|
|
1994-06-22 20:37:41 +00:00
|
|
|
|
|
2000-02-17 11:08:09 +00:00
|
|
|
|
;; The "File" menu items
|
1995-03-19 21:11:13 +00:00
|
|
|
|
(define-key menu-bar-files-menu [exit-emacs]
|
2000-02-17 11:08:09 +00:00
|
|
|
|
'(menu-item "Exit Emacs" save-buffers-kill-emacs
|
|
|
|
|
:help "Save unsaved buffers, then exit"))
|
1995-03-19 21:11:13 +00:00
|
|
|
|
|
|
|
|
|
(define-key menu-bar-files-menu [separator-exit]
|
|
|
|
|
'("--"))
|
|
|
|
|
|
2000-02-17 11:08:09 +00:00
|
|
|
|
;; Don't use delete-frame as event name because that is a special
|
|
|
|
|
;; event.
|
|
|
|
|
(define-key menu-bar-files-menu [delete-this-frame]
|
|
|
|
|
'(menu-item "Delete Frame" delete-frame
|
|
|
|
|
:visible (fboundp 'delete-frame)
|
|
|
|
|
:enable (delete-frame-enabled-p)
|
|
|
|
|
:help "Delete currently selected frame"))
|
|
|
|
|
(define-key menu-bar-files-menu [make-frame-on-display]
|
|
|
|
|
'(menu-item "New Frame on Display..." make-frame-on-display
|
|
|
|
|
:visible (fboundp 'make-frame-on-display)
|
|
|
|
|
:help "Open a new frame on another display"))
|
|
|
|
|
(define-key menu-bar-files-menu [make-frame]
|
|
|
|
|
'(menu-item "New Frame" make-frame-command
|
|
|
|
|
:visible (fboundp 'make-frame-command)
|
|
|
|
|
:help "Open a new frame"))
|
|
|
|
|
|
1995-03-19 21:11:13 +00:00
|
|
|
|
(define-key menu-bar-files-menu [one-window]
|
2000-02-17 11:08:09 +00:00
|
|
|
|
'(menu-item "Unsplit Windows" delete-other-windows
|
|
|
|
|
:enable (not (one-window-p t nil))
|
|
|
|
|
:help "Make selected window fill its frame"))
|
1995-03-19 21:11:13 +00:00
|
|
|
|
|
|
|
|
|
(define-key menu-bar-files-menu [split-window]
|
2000-02-17 11:08:09 +00:00
|
|
|
|
'(menu-item "Split Window" split-window-vertically
|
|
|
|
|
:help "Split selected window in two"))
|
|
|
|
|
|
|
|
|
|
(define-key menu-bar-files-menu [separator-window]
|
|
|
|
|
'(menu-item "--"))
|
|
|
|
|
|
|
|
|
|
(define-key menu-bar-files-menu [ps-print-region]
|
2001-01-29 14:59:34 +00:00
|
|
|
|
'(menu-item "Postscript Print Region (B+W)" ps-print-region
|
|
|
|
|
:enable mark-active
|
|
|
|
|
:help "Pretty-print marked region in black and white to PostScript printer"))
|
|
|
|
|
(define-key menu-bar-files-menu [ps-print-buffer]
|
|
|
|
|
'(menu-item "Postscript Print Buffer (B+W)" ps-print-buffer
|
|
|
|
|
:help "Pretty-print current buffer in black and white to PostScript printer"))
|
|
|
|
|
(define-key menu-bar-files-menu [ps-print-region-faces]
|
2000-02-17 11:08:09 +00:00
|
|
|
|
'(menu-item "Postscript Print Region" ps-print-region-with-faces
|
|
|
|
|
:enable mark-active
|
|
|
|
|
:help "Pretty-print marked region to PostScript printer"))
|
2001-01-29 14:59:34 +00:00
|
|
|
|
(define-key menu-bar-files-menu [ps-print-buffer-faces]
|
2000-02-17 11:08:09 +00:00
|
|
|
|
'(menu-item "Postscript Print Buffer" ps-print-buffer-with-faces
|
|
|
|
|
:help "Pretty-print current buffer to PostScript printer"))
|
|
|
|
|
(define-key menu-bar-files-menu [print-region]
|
|
|
|
|
'(menu-item "Print Region" print-region
|
|
|
|
|
:enable mark-active
|
|
|
|
|
:help "Print region between mark and current position"))
|
|
|
|
|
(define-key menu-bar-files-menu [print-buffer]
|
|
|
|
|
'(menu-item "Print Buffer" print-buffer
|
|
|
|
|
:help "Print current buffer with page headings"))
|
|
|
|
|
|
|
|
|
|
(define-key menu-bar-files-menu [separator-print]
|
|
|
|
|
'(menu-item "--"))
|
1994-06-22 20:37:41 +00:00
|
|
|
|
|
1998-01-24 02:23:15 +00:00
|
|
|
|
(define-key menu-bar-files-menu [recover-session]
|
2000-02-17 11:08:09 +00:00
|
|
|
|
'(menu-item "Recover Crashed Session..." recover-session
|
|
|
|
|
:enable (and auto-save-list-file-prefix
|
2000-07-24 00:28:27 +00:00
|
|
|
|
(file-directory-p
|
|
|
|
|
(file-name-directory auto-save-list-file-prefix))
|
|
|
|
|
(directory-files
|
2000-02-17 11:08:09 +00:00
|
|
|
|
(file-name-directory auto-save-list-file-prefix)
|
|
|
|
|
nil
|
|
|
|
|
(concat "\\`"
|
|
|
|
|
(regexp-quote
|
|
|
|
|
(file-name-nondirectory
|
|
|
|
|
auto-save-list-file-prefix)))
|
|
|
|
|
t))
|
|
|
|
|
:help "Recover edits from a crashed session"))
|
1995-03-19 21:11:13 +00:00
|
|
|
|
(define-key menu-bar-files-menu [revert-buffer]
|
2000-02-17 11:08:09 +00:00
|
|
|
|
'(menu-item "Revert Buffer" revert-buffer
|
|
|
|
|
:enable (or revert-buffer-function
|
|
|
|
|
revert-buffer-insert-file-contents-function
|
|
|
|
|
(and (buffer-file-name)
|
|
|
|
|
(or (buffer-modified-p)
|
|
|
|
|
(not (verify-visited-file-modtime
|
|
|
|
|
(current-buffer))))))
|
|
|
|
|
:help "Re-read current buffer from its file"))
|
1995-03-19 21:11:13 +00:00
|
|
|
|
(define-key menu-bar-files-menu [write-file]
|
2000-02-17 11:08:09 +00:00
|
|
|
|
'(menu-item "Save Buffer As..." write-file
|
|
|
|
|
:enable (not (window-minibuffer-p
|
|
|
|
|
(frame-selected-window menu-updating-frame)))
|
|
|
|
|
:help "Write current buffer to another file"))
|
|
|
|
|
(define-key menu-bar-files-menu [save-buffer]
|
|
|
|
|
'(menu-item "Save (current buffer)" save-buffer
|
|
|
|
|
:enable (and (buffer-modified-p)
|
2000-09-15 20:28:56 +00:00
|
|
|
|
(buffer-file-name)
|
2000-02-17 11:08:09 +00:00
|
|
|
|
(not (window-minibuffer-p
|
|
|
|
|
(frame-selected-window menu-updating-frame))))
|
|
|
|
|
:help "Save current buffer to its file"))
|
|
|
|
|
|
|
|
|
|
(define-key menu-bar-files-menu [separator-save]
|
|
|
|
|
'(menu-item "--"))
|
|
|
|
|
|
|
|
|
|
(define-key menu-bar-files-menu [kill-buffer]
|
|
|
|
|
'(menu-item "Close (current buffer)" kill-this-buffer
|
|
|
|
|
:enable (kill-this-buffer-enabled-p)
|
2000-10-26 21:51:22 +00:00
|
|
|
|
:help "Discard current buffer"))
|
2000-02-17 11:08:09 +00:00
|
|
|
|
(define-key menu-bar-files-menu [insert-file]
|
|
|
|
|
'(menu-item "Insert File..." insert-file
|
|
|
|
|
:enable (not (window-minibuffer-p
|
|
|
|
|
(frame-selected-window menu-updating-frame)))
|
|
|
|
|
:help "Insert another file into current buffer"))
|
|
|
|
|
(define-key menu-bar-files-menu [dired]
|
|
|
|
|
'(menu-item "Open Directory..." dired
|
|
|
|
|
:help "Read a directory, operate on its files"))
|
|
|
|
|
(define-key menu-bar-files-menu [open-file]
|
|
|
|
|
'(menu-item "Open File..." find-file
|
|
|
|
|
:enable (not (window-minibuffer-p
|
|
|
|
|
(frame-selected-window menu-updating-frame)))
|
|
|
|
|
:help "Read a file into an Emacs buffer"))
|
|
|
|
|
|
1994-06-22 20:37:41 +00:00
|
|
|
|
|
2000-02-17 11:08:09 +00:00
|
|
|
|
;; The "Edit" menu items
|
1995-03-19 21:11:13 +00:00
|
|
|
|
(defun nonincremental-search-forward (string)
|
|
|
|
|
"Read a string and search for it nonincrementally."
|
|
|
|
|
(interactive "sSearch for string: ")
|
|
|
|
|
(if (equal string "")
|
|
|
|
|
(search-forward (car search-ring))
|
|
|
|
|
(isearch-update-ring string nil)
|
|
|
|
|
(search-forward string)))
|
|
|
|
|
|
|
|
|
|
(defun nonincremental-search-backward (string)
|
|
|
|
|
"Read a string and search backward for it nonincrementally."
|
|
|
|
|
(interactive "sSearch for string: ")
|
|
|
|
|
(if (equal string "")
|
|
|
|
|
(search-backward (car search-ring))
|
|
|
|
|
(isearch-update-ring string nil)
|
|
|
|
|
(search-backward string)))
|
|
|
|
|
|
|
|
|
|
(defun nonincremental-re-search-forward (string)
|
|
|
|
|
"Read a regular expression and search for it nonincrementally."
|
|
|
|
|
(interactive "sSearch for regexp: ")
|
|
|
|
|
(if (equal string "")
|
|
|
|
|
(re-search-forward (car regexp-search-ring))
|
|
|
|
|
(isearch-update-ring string t)
|
|
|
|
|
(re-search-forward string)))
|
|
|
|
|
|
|
|
|
|
(defun nonincremental-re-search-backward (string)
|
|
|
|
|
"Read a regular expression and search backward for it nonincrementally."
|
|
|
|
|
(interactive "sSearch for regexp: ")
|
|
|
|
|
(if (equal string "")
|
|
|
|
|
(re-search-backward (car regexp-search-ring))
|
|
|
|
|
(isearch-update-ring string t)
|
|
|
|
|
(re-search-backward string)))
|
|
|
|
|
|
1995-04-24 15:26:19 +00:00
|
|
|
|
(defun nonincremental-repeat-search-forward ()
|
1995-03-19 21:11:13 +00:00
|
|
|
|
"Search forward for the previous search string."
|
|
|
|
|
(interactive)
|
1997-06-28 03:15:16 +00:00
|
|
|
|
(if (null search-ring)
|
|
|
|
|
(error "No previous search"))
|
1995-03-19 21:11:13 +00:00
|
|
|
|
(search-forward (car search-ring)))
|
|
|
|
|
|
1995-04-24 15:26:19 +00:00
|
|
|
|
(defun nonincremental-repeat-search-backward ()
|
1995-03-19 21:11:13 +00:00
|
|
|
|
"Search backward for the previous search string."
|
|
|
|
|
(interactive)
|
1997-06-28 03:15:16 +00:00
|
|
|
|
(if (null search-ring)
|
|
|
|
|
(error "No previous search"))
|
1995-03-19 21:11:13 +00:00
|
|
|
|
(search-backward (car search-ring)))
|
|
|
|
|
|
1995-04-24 15:26:19 +00:00
|
|
|
|
(defun nonincremental-repeat-re-search-forward ()
|
1995-03-19 21:11:13 +00:00
|
|
|
|
"Search forward for the previous regular expression."
|
|
|
|
|
(interactive)
|
1997-06-28 03:17:03 +00:00
|
|
|
|
(if (null regexp-search-ring)
|
1997-06-28 03:15:16 +00:00
|
|
|
|
(error "No previous search"))
|
1995-03-19 21:11:13 +00:00
|
|
|
|
(re-search-forward (car regexp-search-ring)))
|
|
|
|
|
|
1995-04-24 15:26:19 +00:00
|
|
|
|
(defun nonincremental-repeat-re-search-backward ()
|
1995-03-19 21:11:13 +00:00
|
|
|
|
"Search backward for the previous regular expression."
|
|
|
|
|
(interactive)
|
1997-06-28 03:17:03 +00:00
|
|
|
|
(if (null regexp-search-ring)
|
1997-06-28 03:15:16 +00:00
|
|
|
|
(error "No previous search"))
|
1995-03-19 21:11:13 +00:00
|
|
|
|
(re-search-backward (car regexp-search-ring)))
|
|
|
|
|
|
2000-02-17 11:08:09 +00:00
|
|
|
|
(defvar menu-bar-search-menu (make-sparse-keymap "Search"))
|
|
|
|
|
(defvar menu-bar-adv-search-menu
|
|
|
|
|
(make-sparse-keymap "Advanced Search/Replace"))
|
|
|
|
|
|
|
|
|
|
(define-key menu-bar-adv-search-menu [tags-continue]
|
|
|
|
|
'(menu-item "Continue Tags Search/Replace" tags-loop-continue
|
|
|
|
|
:help "Continue last tags search/replace operation"))
|
|
|
|
|
(define-key menu-bar-adv-search-menu [tags-repl]
|
|
|
|
|
'(menu-item "Replace in all tagged files" tags-query-replace
|
|
|
|
|
:help "Interactively replace a regexp in all tagged files"))
|
|
|
|
|
(define-key menu-bar-adv-search-menu [tags-srch]
|
|
|
|
|
'(menu-item "Search in all tagged files" tags-search
|
|
|
|
|
:help "Search for a regexp in all tagged files"))
|
|
|
|
|
|
|
|
|
|
(define-key menu-bar-adv-search-menu [separator-tag-search]
|
|
|
|
|
'(menu-item "--"))
|
|
|
|
|
|
|
|
|
|
(define-key menu-bar-adv-search-menu [query-replace-regexp]
|
|
|
|
|
'(menu-item "Replace Regexp..." query-replace-regexp
|
|
|
|
|
:enable (not buffer-read-only)
|
|
|
|
|
:help "Replace regular expression, ask about each occurrence"))
|
|
|
|
|
(define-key menu-bar-adv-search-menu [repeat-regexp-back]
|
|
|
|
|
'(menu-item "Repeat Regexp Backwards"
|
|
|
|
|
nonincremental-repeat-re-search-backward
|
|
|
|
|
:enable regexp-search-ring
|
|
|
|
|
:help "Repeat last regular expression search backwards"))
|
|
|
|
|
(define-key menu-bar-adv-search-menu [repeat-regexp-fwd]
|
|
|
|
|
'(menu-item "Repeat Regexp" nonincremental-repeat-re-search-forward
|
|
|
|
|
:enable regexp-search-ring
|
|
|
|
|
:help "Repeat last regular expression search forward"))
|
|
|
|
|
(define-key menu-bar-adv-search-menu [re-search-backward]
|
|
|
|
|
'(menu-item "Search Regexp Backwards..." nonincremental-re-search-backward
|
|
|
|
|
:help "Search backwards for a regular expression"))
|
|
|
|
|
(define-key menu-bar-adv-search-menu [re-search-forward]
|
|
|
|
|
'(menu-item "Search Regexp..." nonincremental-re-search-forward
|
|
|
|
|
:help "Search forward for a regular expression"))
|
2002-04-11 13:41:49 +00:00
|
|
|
|
(define-key menu-bar-adv-search-menu [separator-tag-isearch]
|
|
|
|
|
'(menu-item "--"))
|
|
|
|
|
(define-key menu-bar-adv-search-menu [isearch-backward]
|
|
|
|
|
'(menu-item "Incremental Search Backwards..." isearch-backward
|
2002-04-24 17:17:10 +00:00
|
|
|
|
:help "Search backwards for a string as you type it"))
|
2002-04-11 13:41:49 +00:00
|
|
|
|
(define-key menu-bar-adv-search-menu [isearch-forward]
|
|
|
|
|
'(menu-item "Incremental Search..." isearch-forward
|
2002-04-24 17:17:10 +00:00
|
|
|
|
:help "Search forward for a string as you type it"))
|
2000-02-17 11:08:09 +00:00
|
|
|
|
(define-key menu-bar-search-menu [re-search]
|
|
|
|
|
(list 'menu-item "Advanced Search/Replace" menu-bar-adv-search-menu
|
|
|
|
|
:help "Regexp and Tags search and replace"))
|
1995-03-19 21:11:13 +00:00
|
|
|
|
|
2000-02-17 11:08:09 +00:00
|
|
|
|
(define-key menu-bar-search-menu [query-replace]
|
|
|
|
|
'(menu-item "Replace..." query-replace
|
|
|
|
|
:enable (not buffer-read-only)
|
|
|
|
|
:help "Replace string interactively, ask about each occurrence"))
|
1996-01-24 23:29:01 +00:00
|
|
|
|
(define-key menu-bar-search-menu [repeat-search-back]
|
2000-02-17 11:08:09 +00:00
|
|
|
|
'(menu-item "Repeat Backwards" nonincremental-repeat-search-backward
|
|
|
|
|
:enable search-ring
|
|
|
|
|
:help "Repeat last search backwards"))
|
1996-01-24 23:29:01 +00:00
|
|
|
|
(define-key menu-bar-search-menu [repeat-search-fwd]
|
2000-02-17 11:08:09 +00:00
|
|
|
|
'(menu-item "Repeat Search" nonincremental-repeat-search-forward
|
|
|
|
|
:enable search-ring
|
|
|
|
|
:help "Repeat last search forward"))
|
1996-01-24 23:29:01 +00:00
|
|
|
|
(define-key menu-bar-search-menu [search-backward]
|
2000-02-17 11:08:09 +00:00
|
|
|
|
'(menu-item "Search Backwards..." nonincremental-search-backward
|
|
|
|
|
:help "Search backwards for a string"))
|
1996-01-24 23:29:01 +00:00
|
|
|
|
(define-key menu-bar-search-menu [search-forward]
|
2000-02-17 11:08:09 +00:00
|
|
|
|
'(menu-item "Search..." nonincremental-search-forward
|
|
|
|
|
:help "Search forward for a string"))
|
1994-06-22 20:37:41 +00:00
|
|
|
|
|
2000-02-17 11:08:09 +00:00
|
|
|
|
;;; 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"))
|
1994-09-15 22:16:49 +00:00
|
|
|
|
|
2001-09-04 08:10:29 +00:00
|
|
|
|
(define-key menu-bar-edit-menu [fill]
|
|
|
|
|
'(menu-item "Fill" fill-region
|
|
|
|
|
:enable (and mark-active (not buffer-read-only))
|
|
|
|
|
:help
|
|
|
|
|
"Fill text in region to fit between left and right margin"))
|
|
|
|
|
|
|
|
|
|
(define-key menu-bar-edit-menu [separator-bookmark]
|
2000-02-17 11:08:09 +00:00
|
|
|
|
'(menu-item "--"))
|
|
|
|
|
|
|
|
|
|
(define-key menu-bar-edit-menu [bookmark]
|
|
|
|
|
'(menu-item "Bookmarks" menu-bar-bookmark-map
|
|
|
|
|
:help "Record positions and jump between them"))
|
|
|
|
|
|
|
|
|
|
(defvar menu-bar-goto-menu (make-sparse-keymap "Go To"))
|
|
|
|
|
|
|
|
|
|
(define-key menu-bar-goto-menu [set-tags-name]
|
|
|
|
|
'(menu-item "Set Tags File Name" visit-tags-table
|
|
|
|
|
:help "Tell Tags commands which tag table file to use"))
|
|
|
|
|
|
|
|
|
|
(define-key menu-bar-goto-menu [separator-tag-file]
|
|
|
|
|
'(menu-item "--"))
|
|
|
|
|
|
|
|
|
|
(define-key menu-bar-goto-menu [apropos-tags]
|
|
|
|
|
'(menu-item "Tags Apropos" tags-apropos
|
|
|
|
|
:help "Find function/variables whose names match regexp"))
|
|
|
|
|
(define-key menu-bar-goto-menu [next-tag-otherw]
|
|
|
|
|
'(menu-item "Next Tag in Other Window"
|
2002-04-23 15:16:54 +00:00
|
|
|
|
(lambda () (interactive) (find-tag-other-window nil t))
|
2000-02-20 12:22:14 +00:00
|
|
|
|
:enable (and (boundp 'tags-location-ring)
|
|
|
|
|
(not (ring-empty-p tags-location-ring)))
|
2000-02-17 11:08:09 +00:00
|
|
|
|
:help "Find next function/variable matching last tag name in another window"))
|
|
|
|
|
(define-key menu-bar-goto-menu [next-tag]
|
|
|
|
|
'(menu-item "Find Next Tag"
|
2002-04-23 15:16:54 +00:00
|
|
|
|
(lambda () (interactive) (find-tag nil t))
|
2000-02-20 12:22:14 +00:00
|
|
|
|
:enable (and (boundp 'tags-location-ring)
|
|
|
|
|
(not (ring-empty-p tags-location-ring)))
|
2000-02-17 11:08:09 +00:00
|
|
|
|
:help "Find next function/variable matching last tag name"))
|
|
|
|
|
(define-key menu-bar-goto-menu [find-tag-otherw]
|
|
|
|
|
'(menu-item "Find Tag in Other Window..." find-tag-other-window
|
|
|
|
|
:help "Find function/variable definition in another window"))
|
|
|
|
|
(define-key menu-bar-goto-menu [find-tag]
|
|
|
|
|
'(menu-item "Find Tag..." find-tag
|
|
|
|
|
:help "Find definition of function or variable"))
|
|
|
|
|
|
|
|
|
|
(define-key menu-bar-goto-menu [separator-tags]
|
|
|
|
|
'(menu-item "--"))
|
|
|
|
|
|
|
|
|
|
(define-key menu-bar-goto-menu [end-of-buf]
|
|
|
|
|
'(menu-item "Goto End of Buffer" end-of-buffer))
|
|
|
|
|
(define-key menu-bar-goto-menu [beg-of-buf]
|
|
|
|
|
'(menu-item "Goto Beginning of Buffer" beginning-of-buffer))
|
|
|
|
|
(define-key menu-bar-goto-menu [go-to-pos]
|
|
|
|
|
'(menu-item "Goto Buffer Position..." goto-char
|
|
|
|
|
:help "Read a number N and go to buffer position N"))
|
|
|
|
|
(define-key menu-bar-goto-menu [go-to-line]
|
|
|
|
|
'(menu-item "Goto Line..." goto-line
|
|
|
|
|
:help "Read a line number and go to that line"))
|
|
|
|
|
|
|
|
|
|
(define-key menu-bar-edit-menu [goto]
|
|
|
|
|
(list 'menu-item "Go To" menu-bar-goto-menu))
|
|
|
|
|
|
|
|
|
|
(define-key menu-bar-edit-menu [search]
|
|
|
|
|
(list 'menu-item "Search" menu-bar-search-menu))
|
|
|
|
|
|
2001-09-04 08:10:29 +00:00
|
|
|
|
(define-key menu-bar-edit-menu [separator-search]
|
|
|
|
|
'(menu-item "--"))
|
|
|
|
|
|
2000-06-28 04:48:17 +00:00
|
|
|
|
(define-key menu-bar-edit-menu [mark-whole-buffer]
|
|
|
|
|
'(menu-item "Select All" mark-whole-buffer
|
|
|
|
|
:help "Mark the whole buffer for a subsequent cut/copy."))
|
2000-02-17 11:08:09 +00:00
|
|
|
|
(define-key menu-bar-edit-menu [clear]
|
|
|
|
|
'(menu-item "Clear" delete-region
|
|
|
|
|
:enable (and mark-active
|
|
|
|
|
(not buffer-read-only)
|
|
|
|
|
(not (mouse-region-match)))
|
|
|
|
|
:help
|
2000-10-26 21:51:22 +00:00
|
|
|
|
"Delete the text in region between mark and current position"))
|
1994-09-15 22:16:49 +00:00
|
|
|
|
(defvar yank-menu (cons "Select Yank" nil))
|
|
|
|
|
(fset 'yank-menu (cons 'keymap yank-menu))
|
2000-02-17 11:08:09 +00:00
|
|
|
|
(define-key menu-bar-edit-menu [select-paste]
|
|
|
|
|
'(menu-item "Select and Paste" yank-menu
|
|
|
|
|
:enable (and (cdr yank-menu) (not buffer-read-only))
|
2001-09-02 13:19:33 +00:00
|
|
|
|
:help "Paste (yank) text cut or copied earlier"))
|
2000-02-17 11:08:09 +00:00
|
|
|
|
(define-key menu-bar-edit-menu [paste]
|
|
|
|
|
'(menu-item "Paste" yank
|
2001-11-11 14:02:54 +00:00
|
|
|
|
:enable (and
|
|
|
|
|
;; Emacs compiled --without-x doesn't have
|
|
|
|
|
;; x-selection-exists-p.
|
|
|
|
|
(fboundp 'x-selection-exists-p)
|
|
|
|
|
(x-selection-exists-p) (not buffer-read-only))
|
2001-09-02 13:19:33 +00:00
|
|
|
|
:help "Paste (yank) text most recently cut/copied"))
|
2000-02-17 11:08:09 +00:00
|
|
|
|
(define-key menu-bar-edit-menu [copy]
|
|
|
|
|
'(menu-item "Copy" menu-bar-kill-ring-save
|
|
|
|
|
:enable mark-active
|
2001-11-15 20:34:35 +00:00
|
|
|
|
:help "Copy text in region between mark and current position"
|
|
|
|
|
:keys "\\[kill-ring-save]"))
|
2000-02-17 11:08:09 +00:00
|
|
|
|
(define-key menu-bar-edit-menu [cut]
|
|
|
|
|
'(menu-item "Cut" kill-region
|
|
|
|
|
:enable (and mark-active (not buffer-read-only))
|
2000-10-26 21:51:22 +00:00
|
|
|
|
:help
|
|
|
|
|
"Cut (kill) text in region between mark and current position"))
|
2000-02-17 11:08:09 +00:00
|
|
|
|
(define-key menu-bar-edit-menu [undo]
|
|
|
|
|
'(menu-item "Undo" undo
|
|
|
|
|
:enable (and (not buffer-read-only)
|
|
|
|
|
(not (eq t buffer-undo-list))
|
|
|
|
|
(if (eq last-command 'undo)
|
|
|
|
|
pending-undo-list
|
|
|
|
|
(consp buffer-undo-list)))
|
|
|
|
|
:help "Undo last operation"))
|
|
|
|
|
|
1993-05-17 04:45:03 +00:00
|
|
|
|
|
1995-02-12 04:54:34 +00:00
|
|
|
|
(defun menu-bar-kill-ring-save (beg end)
|
|
|
|
|
(interactive "r")
|
|
|
|
|
(if (mouse-region-match)
|
1998-07-02 06:52:52 +00:00
|
|
|
|
(message "Selecting a region with the mouse does `copy' automatically")
|
1995-02-12 04:54:34 +00:00
|
|
|
|
(kill-ring-save beg end)))
|
|
|
|
|
|
1993-07-12 20:29:28 +00:00
|
|
|
|
(autoload 'ispell-menu-map "ispell" nil t 'keymap)
|
|
|
|
|
|
1994-04-06 04:54:35 +00:00
|
|
|
|
;; These are alternative definitions for the cut, paste and copy
|
1995-02-12 04:54:34 +00:00
|
|
|
|
;; menu items. Use them if your system expects these to use the clipboard.
|
1994-04-06 04:54:35 +00:00
|
|
|
|
|
|
|
|
|
(put 'clipboard-kill-region 'menu-enable 'mark-active)
|
|
|
|
|
(put 'clipboard-kill-ring-save 'menu-enable 'mark-active)
|
|
|
|
|
(put 'clipboard-yank 'menu-enable
|
2001-11-11 14:02:54 +00:00
|
|
|
|
'(or (and (fboundp 'x-selection-exists-p) (x-selection-exists-p))
|
|
|
|
|
(x-selection-exists-p 'CLIPBOARD)))
|
1994-04-06 04:54:35 +00:00
|
|
|
|
|
|
|
|
|
(defun clipboard-yank ()
|
1999-01-03 02:05:10 +00:00
|
|
|
|
"Insert the clipboard contents, or the last stretch of killed text."
|
1994-04-06 04:54:35 +00:00
|
|
|
|
(interactive)
|
|
|
|
|
(let ((x-select-enable-clipboard t))
|
|
|
|
|
(yank)))
|
|
|
|
|
|
|
|
|
|
(defun clipboard-kill-ring-save (beg end)
|
|
|
|
|
"Copy region to kill ring, and save in the X clipboard."
|
|
|
|
|
(interactive "r")
|
|
|
|
|
(let ((x-select-enable-clipboard t))
|
|
|
|
|
(kill-ring-save beg end)))
|
|
|
|
|
|
|
|
|
|
(defun clipboard-kill-region (beg end)
|
|
|
|
|
"Kill the region, and save it in the X clipboard."
|
|
|
|
|
(interactive "r")
|
|
|
|
|
(let ((x-select-enable-clipboard t))
|
|
|
|
|
(kill-region beg end)))
|
|
|
|
|
|
|
|
|
|
(defun menu-bar-enable-clipboard ()
|
1994-07-31 03:01:00 +00:00
|
|
|
|
"Make CUT, PASTE and COPY (keys and menu bar items) use the clipboard.
|
|
|
|
|
Do the same for the keys of the same name."
|
1994-04-06 04:54:35 +00:00
|
|
|
|
(interactive)
|
1994-04-18 21:33:57 +00:00
|
|
|
|
;; We can't use constant list structure here because it becomes pure,
|
|
|
|
|
;; and because it gets modified with cache data.
|
|
|
|
|
(define-key menu-bar-edit-menu [paste]
|
2000-02-17 11:08:09 +00:00
|
|
|
|
(cons "Paste" (cons "Paste text from clipboard" 'clipboard-yank)))
|
1994-04-18 21:33:57 +00:00
|
|
|
|
(define-key menu-bar-edit-menu [copy]
|
2000-02-17 11:08:09 +00:00
|
|
|
|
(cons "Copy" (cons "Copy text in region to the clipboard"
|
|
|
|
|
'clipboard-kill-ring-save)))
|
1994-04-18 21:33:57 +00:00
|
|
|
|
(define-key menu-bar-edit-menu [cut]
|
2000-02-17 11:08:09 +00:00
|
|
|
|
(cons "Cut" (cons "Delete text in region and copy it to the clipboard"
|
|
|
|
|
'clipboard-kill-region)))
|
1994-07-31 03:01:00 +00:00
|
|
|
|
|
|
|
|
|
(define-key global-map [f20] 'clipboard-kill-region)
|
|
|
|
|
(define-key global-map [f16] 'clipboard-kill-ring-save)
|
|
|
|
|
(define-key global-map [f18] 'clipboard-yank)
|
|
|
|
|
;; X11R6 versions
|
|
|
|
|
(define-key global-map [cut] 'clipboard-kill-region)
|
|
|
|
|
(define-key global-map [copy] 'clipboard-kill-ring-save)
|
|
|
|
|
(define-key global-map [paste] 'clipboard-yank))
|
1994-04-06 04:54:35 +00:00
|
|
|
|
|
2000-02-17 11:08:09 +00:00
|
|
|
|
;; The "Options" menu items
|
1997-04-08 22:20:30 +00:00
|
|
|
|
|
|
|
|
|
(defvar menu-bar-custom-menu (make-sparse-keymap "Customize"))
|
|
|
|
|
|
1997-07-09 19:03:09 +00:00
|
|
|
|
(define-key menu-bar-custom-menu [customize-apropos-groups]
|
2000-02-17 11:08:09 +00:00
|
|
|
|
'(menu-item "Groups Matching Regexp..." customize-apropos-groups
|
|
|
|
|
:help "Browse groups whose names match regexp"))
|
1997-07-09 19:03:09 +00:00
|
|
|
|
(define-key menu-bar-custom-menu [customize-apropos-faces]
|
2000-02-17 11:08:09 +00:00
|
|
|
|
'(menu-item "Faces Matching Regexp..." customize-apropos-faces
|
|
|
|
|
:help "Browse faces whose names match regexp"))
|
1997-07-09 19:03:09 +00:00
|
|
|
|
(define-key menu-bar-custom-menu [customize-apropos-options]
|
2000-02-17 11:08:09 +00:00
|
|
|
|
'(menu-item "Options Matching Regexp..." customize-apropos-options
|
|
|
|
|
:help "Browse options whose names match regexp"))
|
1997-04-08 22:20:30 +00:00
|
|
|
|
(define-key menu-bar-custom-menu [customize-apropos]
|
2000-02-17 11:08:09 +00:00
|
|
|
|
'(menu-item "Settings Matching Regexp..." customize-apropos
|
|
|
|
|
:help "Browse customizable settings whose names match regexp"))
|
2002-04-30 20:39:00 +00:00
|
|
|
|
(define-key menu-bar-custom-menu [separator-1]
|
1997-07-09 19:03:09 +00:00
|
|
|
|
'("--"))
|
1997-05-01 22:21:19 +00:00
|
|
|
|
(define-key menu-bar-custom-menu [customize-group]
|
2000-02-17 11:08:09 +00:00
|
|
|
|
'(menu-item "Specific Group..." customize-group
|
|
|
|
|
:help "Customize settings of specific group"))
|
1997-04-08 22:20:30 +00:00
|
|
|
|
(define-key menu-bar-custom-menu [customize-face]
|
2000-02-17 11:08:09 +00:00
|
|
|
|
'(menu-item "Specific Face..." customize-face
|
|
|
|
|
:help "Customize attributes of specific face"))
|
1997-07-09 19:03:09 +00:00
|
|
|
|
(define-key menu-bar-custom-menu [customize-option]
|
2000-02-17 11:08:09 +00:00
|
|
|
|
'(menu-item "Specific Option..." customize-option
|
2002-04-30 20:39:00 +00:00
|
|
|
|
:help "Customize value of specific option"))
|
|
|
|
|
(define-key menu-bar-custom-menu [separator-2]
|
|
|
|
|
'("--"))
|
1998-05-03 00:53:50 +00:00
|
|
|
|
(define-key menu-bar-custom-menu [customize-changed-options]
|
2002-04-30 20:39:00 +00:00
|
|
|
|
'(menu-item "New Options..." customize-changed-options
|
|
|
|
|
:help "Options added or changed in recent Emacs versions"))
|
|
|
|
|
(define-key menu-bar-custom-menu [customize-saved]
|
|
|
|
|
'(menu-item "Saved Options" customize-saved
|
|
|
|
|
:help "Customize previously saved options"))
|
1997-07-09 19:03:09 +00:00
|
|
|
|
(define-key menu-bar-custom-menu [separator-3]
|
|
|
|
|
'("--"))
|
1997-07-04 13:25:17 +00:00
|
|
|
|
(define-key menu-bar-custom-menu [customize-browse]
|
2000-02-17 11:08:09 +00:00
|
|
|
|
'(menu-item "Browse Customization Groups" customize-browse
|
|
|
|
|
:help "Browse all customization groups"))
|
1997-07-09 19:03:09 +00:00
|
|
|
|
(define-key menu-bar-custom-menu [customize]
|
2000-02-17 11:08:09 +00:00
|
|
|
|
'(menu-item "Top-level Customization Group" customize
|
|
|
|
|
:help "The master group called `Emacs'"))
|
1997-04-08 22:20:30 +00:00
|
|
|
|
|
2000-02-17 11:08:09 +00:00
|
|
|
|
;(defvar menu-bar-preferences-menu (make-sparse-keymap "Preferences"))
|
1997-08-29 02:12:38 +00:00
|
|
|
|
|
2002-05-01 22:01:16 +00:00
|
|
|
|
(defmacro menu-bar-make-toggle (name variable doc message help &optional props &rest body)
|
1997-08-29 02:12:38 +00:00
|
|
|
|
`(progn
|
|
|
|
|
(defun ,name ()
|
2001-06-22 20:06:07 +00:00
|
|
|
|
,(concat "Toggle whether to " (downcase (substring help 0 1))
|
|
|
|
|
(substring help 1) ".")
|
1997-08-29 02:12:38 +00:00
|
|
|
|
(interactive)
|
|
|
|
|
(if ,(if body `(progn . ,body)
|
2002-04-11 13:41:49 +00:00
|
|
|
|
`(progn
|
2002-02-11 16:47:55 +00:00
|
|
|
|
(custom-load-symbol ',variable)
|
|
|
|
|
(let ((set (or (get ',variable 'custom-set) 'set-default))
|
|
|
|
|
(get (or (get ',variable 'custom-get) 'default-value)))
|
|
|
|
|
(funcall set ',variable (not (funcall get ',variable))))))
|
|
|
|
|
(message ,message "enabled")
|
2000-04-12 18:26:04 +00:00
|
|
|
|
(message ,message "disabled")))
|
2002-02-11 16:47:55 +00:00
|
|
|
|
;; The function `customize-mark-as-set' must only be called when
|
|
|
|
|
;; a variable is set interactively, as the purpose is to mark it
|
|
|
|
|
;; as a candidate for "Save Options", and we do not want to save
|
|
|
|
|
;; options the user have already set explicitly in his init
|
|
|
|
|
;; file. Unfortunately, he could very likely call the function
|
|
|
|
|
;; defined above there. So we put `customize-mark-as-set' in a
|
2002-04-11 13:41:49 +00:00
|
|
|
|
;; lambda expression.
|
2002-02-11 16:47:55 +00:00
|
|
|
|
;; -- Per Abrahamsen <abraham@dina.kvl.dk> 2002-02-11.
|
|
|
|
|
'(menu-item ,doc (lambda ()
|
|
|
|
|
(interactive)
|
|
|
|
|
(,name)
|
|
|
|
|
(customize-mark-as-set ',variable))
|
2002-05-01 22:01:16 +00:00
|
|
|
|
,@(if props props)
|
2000-02-17 11:08:09 +00:00
|
|
|
|
:help ,help
|
2002-02-11 16:47:55 +00:00
|
|
|
|
:button (:toggle . (and (default-boundp ',variable)
|
|
|
|
|
(default-value ',variable))))))
|
2000-02-17 11:08:09 +00:00
|
|
|
|
|
|
|
|
|
;;; 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"))
|
2000-06-19 14:55:15 +00:00
|
|
|
|
|
|
|
|
|
(defun menu-bar-options-save ()
|
|
|
|
|
"Save current values of Options menu items using Custom."
|
|
|
|
|
(interactive)
|
2002-02-07 17:32:18 +00:00
|
|
|
|
(let ((need-save nil))
|
2002-02-11 16:47:55 +00:00
|
|
|
|
;; These are set with `customize-set-variable'.
|
|
|
|
|
(dolist (elt '(line-number-mode column-number-mode scroll-bar-mode
|
|
|
|
|
debug-on-quit debug-on-error menu-bar-mode tool-bar-mode
|
2002-05-24 09:52:21 +00:00
|
|
|
|
save-place uniquify-buffer-name-style fringe-mode
|
2002-05-01 22:01:16 +00:00
|
|
|
|
case-fold-search cua-mode show-paren-mode
|
2002-02-07 17:32:18 +00:00
|
|
|
|
transient-mark-mode global-font-lock-mode
|
2002-02-11 16:47:55 +00:00
|
|
|
|
display-time-mode auto-compression-mode
|
2002-02-12 09:49:46 +00:00
|
|
|
|
current-language-environment default-input-method
|
2002-02-11 16:47:55 +00:00
|
|
|
|
;; Saving `text-mode-hook' is somewhat questionable,
|
|
|
|
|
;; as we might get more than we bargain for, if
|
|
|
|
|
;; other code may has added hooks as well.
|
|
|
|
|
;; Nonetheless, not saving it would like be confuse
|
|
|
|
|
;; more often.
|
|
|
|
|
;; -- Per Abrahamsen <abraham@dina.kvl.dk> 2002-02-11.
|
|
|
|
|
text-mode-hook))
|
|
|
|
|
(and (get elt 'customized-value)
|
|
|
|
|
(customize-mark-to-save elt)
|
|
|
|
|
(setq need-save t)))
|
2002-02-07 17:32:18 +00:00
|
|
|
|
;; Save if we changed anything.
|
|
|
|
|
(when need-save
|
|
|
|
|
(custom-save-all))))
|
2000-06-19 14:55:15 +00:00
|
|
|
|
|
|
|
|
|
(define-key menu-bar-options-menu [save]
|
2000-06-19 15:36:47 +00:00
|
|
|
|
'(menu-item "Save Options" menu-bar-options-save
|
2000-06-19 14:55:15 +00:00
|
|
|
|
:help "Save options set from the menu above"))
|
|
|
|
|
|
|
|
|
|
(define-key menu-bar-options-menu [custom-separator]
|
|
|
|
|
'("--"))
|
|
|
|
|
|
2002-01-29 14:19:21 +00:00
|
|
|
|
;; The "Show/Hide" submenu of menu "Options"
|
|
|
|
|
|
|
|
|
|
(defvar menu-bar-showhide-menu (make-sparse-keymap "Show/Hide"))
|
2002-02-03 11:28:28 +00:00
|
|
|
|
|
2002-02-09 13:56:42 +00:00
|
|
|
|
(define-key menu-bar-showhide-menu [column-number-mode]
|
2002-02-10 17:28:41 +00:00
|
|
|
|
(menu-bar-make-toggle toggle-column-number-mode column-number-mode
|
2002-05-10 09:42:49 +00:00
|
|
|
|
"Show Column Numbers" "Column number mode %s"
|
|
|
|
|
"Show the current column number in the mode line"))
|
2002-02-09 13:56:42 +00:00
|
|
|
|
|
|
|
|
|
(define-key menu-bar-showhide-menu [line-number-mode]
|
2002-02-10 17:28:41 +00:00
|
|
|
|
(menu-bar-make-toggle toggle-line-number-mode line-number-mode
|
2002-05-10 09:42:49 +00:00
|
|
|
|
"Show Line Numbers" "Line number mode %s"
|
|
|
|
|
"Show the current line number in the mode line"))
|
2002-02-09 13:56:42 +00:00
|
|
|
|
|
|
|
|
|
(define-key menu-bar-showhide-menu [linecolumn-separator]
|
|
|
|
|
'("--"))
|
|
|
|
|
|
2002-02-03 11:28:28 +00:00
|
|
|
|
(defun showhide-date-time ()
|
|
|
|
|
"Toggle whether to show date and time in the mode-line."
|
|
|
|
|
(interactive)
|
|
|
|
|
(if (display-time-mode)
|
|
|
|
|
(message "Display-time mode enabled.")
|
|
|
|
|
(message "Display-time mode disabled.")))
|
|
|
|
|
|
|
|
|
|
(define-key menu-bar-showhide-menu [showhide-date-time]
|
2002-04-11 13:41:49 +00:00
|
|
|
|
'(menu-item "Date and Time" (lambda ()
|
2002-02-11 16:47:55 +00:00
|
|
|
|
(interactive)
|
|
|
|
|
(showhide-date-time)
|
|
|
|
|
(customize-mark-as-set 'display-time-mode))
|
2002-05-10 09:42:49 +00:00
|
|
|
|
:help "Display date and time in the mode line"
|
2002-02-03 11:28:28 +00:00
|
|
|
|
:button (:toggle . display-time-mode)))
|
|
|
|
|
|
|
|
|
|
(define-key menu-bar-showhide-menu [datetime-separator]
|
|
|
|
|
'("--"))
|
|
|
|
|
|
2002-02-17 12:15:17 +00:00
|
|
|
|
(define-key menu-bar-showhide-menu [showhide-speedbar]
|
|
|
|
|
'(menu-item "Speedbar" speedbar-frame-mode
|
2002-05-10 09:42:49 +00:00
|
|
|
|
:help "Display a Speedbar quick-navigation frame"
|
2002-02-17 12:15:17 +00:00
|
|
|
|
:button (:toggle
|
|
|
|
|
. (and (boundp 'speedbar-frame)
|
|
|
|
|
(frame-live-p (symbol-value 'speedbar-frame))
|
2002-04-11 13:41:49 +00:00
|
|
|
|
(frame-visible-p
|
2002-02-17 12:15:17 +00:00
|
|
|
|
(symbol-value 'speedbar-frame))))))
|
|
|
|
|
|
2002-05-30 17:13:22 +00:00
|
|
|
|
(defvar menu-bar-showhide-fringe-menu (make-sparse-keymap "Fringe"))
|
2002-05-24 09:52:21 +00:00
|
|
|
|
|
|
|
|
|
(defun menu-bar-showhide-fringe-menu-customize ()
|
|
|
|
|
"Show customization buffer for `fringe-mode'."
|
|
|
|
|
(interactive)
|
|
|
|
|
(customize-variable 'fringe-mode))
|
|
|
|
|
|
|
|
|
|
(define-key menu-bar-showhide-fringe-menu [customize]
|
|
|
|
|
'(menu-item "Customize" menu-bar-showhide-fringe-menu-customize
|
|
|
|
|
:help "Detailed customization of fringe"
|
|
|
|
|
:visible (display-graphic-p)))
|
|
|
|
|
|
|
|
|
|
(defun menu-bar-showhide-fringe-menu-customize-reset ()
|
|
|
|
|
"Reset the default fringe mode."
|
|
|
|
|
(interactive)
|
|
|
|
|
(customize-set-variable 'fringe-mode nil))
|
|
|
|
|
|
|
|
|
|
(define-key menu-bar-showhide-fringe-menu [default]
|
|
|
|
|
'(menu-item "Default" menu-bar-showhide-fringe-menu-customize-reset
|
|
|
|
|
:help "Default width fringe on both left and right side"
|
|
|
|
|
:visible (display-graphic-p)
|
2002-06-12 13:55:59 +00:00
|
|
|
|
:button (:radio . (or (not (boundp 'fringe-mode))
|
|
|
|
|
(eq fringe-mode nil)))))
|
2002-05-24 09:52:21 +00:00
|
|
|
|
|
|
|
|
|
(defun menu-bar-showhide-fringe-menu-customize-left ()
|
|
|
|
|
"Make fringes appear only on the left."
|
|
|
|
|
(interactive)
|
2002-05-25 05:15:07 +00:00
|
|
|
|
(require 'fringe)
|
|
|
|
|
(customize-set-variable 'fringe-mode '(nil . 0)))
|
2002-05-24 09:52:21 +00:00
|
|
|
|
|
|
|
|
|
(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)
|
2002-06-12 13:55:59 +00:00
|
|
|
|
:button (:radio . (and (boundp 'fringe-mode)
|
|
|
|
|
(equal fringe-mode '(nil . 0))))))
|
2002-05-24 09:52:21 +00:00
|
|
|
|
|
|
|
|
|
(defun menu-bar-showhide-fringe-menu-customize-right ()
|
|
|
|
|
"Make fringes appear only on the right."
|
|
|
|
|
(interactive)
|
2002-05-25 05:15:07 +00:00
|
|
|
|
(require 'fringe)
|
|
|
|
|
(customize-set-variable 'fringe-mode '(0 . nil)))
|
2002-05-24 09:52:21 +00:00
|
|
|
|
|
|
|
|
|
(define-key menu-bar-showhide-fringe-menu [right]
|
|
|
|
|
'(menu-item "On the Right" menu-bar-showhide-fringe-menu-customize-right
|
|
|
|
|
:help "Fringe only on the right side"
|
|
|
|
|
:visible (display-graphic-p)
|
2002-06-12 13:55:59 +00:00
|
|
|
|
:button (:radio . (and (boundp 'fringe-mode)
|
|
|
|
|
(equal fringe-mode '(0 . nil))))))
|
2002-05-24 09:52:21 +00:00
|
|
|
|
|
|
|
|
|
(defun menu-bar-showhide-fringe-menu-customize-disable ()
|
|
|
|
|
"Make fringes disappear."
|
|
|
|
|
(interactive)
|
2002-05-25 05:15:07 +00:00
|
|
|
|
(require 'fringe)
|
|
|
|
|
(customize-set-variable 'fringe-mode 0))
|
2002-05-24 09:52:21 +00:00
|
|
|
|
|
|
|
|
|
(define-key menu-bar-showhide-fringe-menu [none]
|
|
|
|
|
'(menu-item "None" menu-bar-showhide-fringe-menu-customize-disable
|
|
|
|
|
:help "Turn off fringe"
|
|
|
|
|
:visible (display-graphic-p)
|
2002-06-12 13:55:59 +00:00
|
|
|
|
:button (:radio . (and (boundp 'fringe-mode)
|
|
|
|
|
(eq fringe-mode 0)))))
|
2002-05-24 09:52:21 +00:00
|
|
|
|
|
|
|
|
|
(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"))
|
|
|
|
|
|
2002-01-29 14:19:21 +00:00
|
|
|
|
(defvar menu-bar-showhide-scroll-bar-menu (make-sparse-keymap "Scroll-bar"))
|
|
|
|
|
|
|
|
|
|
(define-key menu-bar-showhide-scroll-bar-menu [right]
|
2002-04-11 13:41:49 +00:00
|
|
|
|
'(menu-item "On the Right"
|
2002-02-11 16:47:55 +00:00
|
|
|
|
(lambda ()
|
|
|
|
|
(interactive)
|
|
|
|
|
(customize-set-variable 'scroll-bar-mode 'right))
|
2002-01-29 14:19:21 +00:00
|
|
|
|
:help "Scroll-bar on the right side"
|
2002-05-10 09:42:49 +00:00
|
|
|
|
:visible (display-graphic-p)
|
2002-02-11 16:47:55 +00:00
|
|
|
|
:button (:radio . (eq (cdr (assq 'vertical-scroll-bars
|
|
|
|
|
(frame-parameters))) 'right))))
|
2002-01-29 14:19:21 +00:00
|
|
|
|
|
|
|
|
|
(define-key menu-bar-showhide-scroll-bar-menu [left]
|
2002-04-11 13:41:49 +00:00
|
|
|
|
'(menu-item "On the Left"
|
2002-02-11 16:47:55 +00:00
|
|
|
|
(lambda ()
|
|
|
|
|
(interactive)
|
|
|
|
|
(customize-set-variable 'scroll-bar-mode 'left))
|
2002-01-29 14:19:21 +00:00
|
|
|
|
:help "Scroll-bar on the left side"
|
2002-05-10 09:42:49 +00:00
|
|
|
|
:visible (display-graphic-p)
|
2002-02-11 16:47:55 +00:00
|
|
|
|
:button (:radio . (eq (cdr (assq 'vertical-scroll-bars
|
|
|
|
|
(frame-parameters))) 'left))))
|
2002-01-29 14:19:21 +00:00
|
|
|
|
|
|
|
|
|
(define-key menu-bar-showhide-scroll-bar-menu [none]
|
2002-04-11 13:41:49 +00:00
|
|
|
|
'(menu-item "None"
|
2002-02-11 16:47:55 +00:00
|
|
|
|
(lambda ()
|
|
|
|
|
(interactive)
|
|
|
|
|
(customize-set-variable 'scroll-bar-mode nil))
|
2002-01-29 14:19:21 +00:00
|
|
|
|
:help "Turn off scroll-bar"
|
2002-05-10 09:42:49 +00:00
|
|
|
|
:visible (display-graphic-p)
|
2002-02-11 16:47:55 +00:00
|
|
|
|
:button (:radio . (eq (cdr (assq 'vertical-scroll-bars
|
|
|
|
|
(frame-parameters))) nil))))
|
2002-01-29 14:19:21 +00:00
|
|
|
|
|
|
|
|
|
(define-key menu-bar-showhide-menu [showhide-scroll-bar]
|
2002-04-11 13:41:49 +00:00
|
|
|
|
(list 'menu-item "Scroll-bar" menu-bar-showhide-scroll-bar-menu
|
2002-05-10 09:42:49 +00:00
|
|
|
|
:visible `(display-graphic-p)
|
2002-01-29 14:19:21 +00:00
|
|
|
|
:help "Select scroll-bar mode"))
|
|
|
|
|
|
|
|
|
|
(defun showhide-menu-bar ()
|
|
|
|
|
"Toggle whether to turn menu-bar on/off."
|
|
|
|
|
(interactive)
|
|
|
|
|
(menu-bar-mode)
|
|
|
|
|
(if menu-bar-mode
|
|
|
|
|
(message "Menu-bar mode enabled.")
|
2002-05-10 09:42:49 +00:00
|
|
|
|
(message "Menu-bar mode disabled. Use M-x menu-bar-mode to make the menu bar appear."))
|
|
|
|
|
(customize-mark-as-set 'menu-bar-mode))
|
2002-01-29 14:19:21 +00:00
|
|
|
|
|
|
|
|
|
(define-key menu-bar-showhide-menu [showhide-menu-bar]
|
2002-05-10 09:42:49 +00:00
|
|
|
|
'(menu-item "Menu-bar" showhide-menu-bar
|
2002-01-29 14:19:21 +00:00
|
|
|
|
:help "Toggle menu-bar on/off"
|
|
|
|
|
:button (:toggle . menu-bar-mode)))
|
|
|
|
|
|
2002-05-10 09:42:49 +00:00
|
|
|
|
(defun showhide-toolbar ()
|
2002-01-29 14:19:21 +00:00
|
|
|
|
"Toggle whether to turn tool-bar on/off."
|
|
|
|
|
(interactive)
|
|
|
|
|
(if (tool-bar-mode)
|
|
|
|
|
(message "Tool-bar mode enabled.")
|
2002-05-10 09:42:49 +00:00
|
|
|
|
(message "Tool-bar mode disabled."))
|
|
|
|
|
(customize-mark-as-set 'tool-bar-mode))
|
2002-01-29 14:19:21 +00:00
|
|
|
|
|
|
|
|
|
(define-key menu-bar-showhide-menu [showhide-tool-bar]
|
2002-05-10 09:42:49 +00:00
|
|
|
|
(list 'menu-item "Tool-bar" 'showhide-toolbar
|
|
|
|
|
:help "Turn tool-bar on/off"
|
|
|
|
|
:visible `(display-graphic-p)
|
|
|
|
|
:button `(:toggle . tool-bar-mode)))
|
2002-01-29 14:19:21 +00:00
|
|
|
|
|
|
|
|
|
(define-key menu-bar-options-menu [showhide]
|
|
|
|
|
(list 'menu-item "Show/Hide" menu-bar-showhide-menu
|
|
|
|
|
:help "Toggle on/off various display features"))
|
|
|
|
|
|
|
|
|
|
(define-key menu-bar-options-menu [showhide-separator]
|
|
|
|
|
'("--"))
|
|
|
|
|
|
2000-02-17 11:08:09 +00:00
|
|
|
|
(define-key menu-bar-options-menu [mule]
|
|
|
|
|
;; It is better not to use backquote here,
|
|
|
|
|
;; because that makes a bootstrapping problem
|
|
|
|
|
;; if you need to recompile all the Lisp files using interpreted code.
|
|
|
|
|
(list 'menu-item "Mule (Multilingual Environment)" mule-menu-keymap
|
2000-04-12 18:26:04 +00:00
|
|
|
|
;; Most of the MULE menu actually does make sense in unibyte mode,
|
|
|
|
|
;; e.g. language selection.
|
|
|
|
|
;;; ':visible 'default-enable-multibyte-characters
|
2000-02-17 11:08:09 +00:00
|
|
|
|
':help "Default language, encodings, input method"))
|
|
|
|
|
;(setq menu-bar-final-items (cons 'mule menu-bar-final-items))
|
|
|
|
|
;(define-key menu-bar-options-menu [preferences]
|
|
|
|
|
; (list 'menu-item "Preferences" menu-bar-preferences-menu
|
|
|
|
|
; :help "Toggle important global options"))
|
|
|
|
|
|
|
|
|
|
(define-key menu-bar-options-menu [mule-separator]
|
2000-04-12 18:26:04 +00:00
|
|
|
|
'("--"))
|
1997-08-29 02:12:38 +00:00
|
|
|
|
|
|
|
|
|
(define-key menu-bar-options-menu [debug-on-quit]
|
|
|
|
|
(menu-bar-make-toggle toggle-debug-on-quit debug-on-quit
|
2001-06-22 20:06:07 +00:00
|
|
|
|
"Enter Debugger on Quit/C-g" "Debug on Quit %s"
|
2000-02-17 11:08:09 +00:00
|
|
|
|
"Enter Lisp debugger when C-g is pressed"))
|
1997-08-29 02:12:38 +00:00
|
|
|
|
(define-key menu-bar-options-menu [debug-on-error]
|
|
|
|
|
(menu-bar-make-toggle toggle-debug-on-error debug-on-error
|
2001-06-22 20:06:07 +00:00
|
|
|
|
"Enter Debugger on Error" "Debug on Error %s"
|
|
|
|
|
"Enter Lisp debugger when an error is signaled"))
|
2000-02-17 11:08:09 +00:00
|
|
|
|
(define-key menu-bar-options-menu [debugger-separator]
|
1997-08-29 02:12:38 +00:00
|
|
|
|
'("--"))
|
2000-02-17 11:08:09 +00:00
|
|
|
|
(define-key menu-bar-options-menu [toggle-auto-compression]
|
|
|
|
|
'(menu-item "Automatic File De/compression"
|
2002-02-11 16:47:55 +00:00
|
|
|
|
(lambda ()
|
|
|
|
|
(interactive)
|
|
|
|
|
(auto-compression-mode)
|
|
|
|
|
(customize-mark-as-set 'auto-compression-mode))
|
|
|
|
|
:help "Transparently decompress compressed files"
|
|
|
|
|
:button (:toggle . (rassq 'jka-compr-handler
|
|
|
|
|
file-name-handler-alist))))
|
1997-08-29 02:12:38 +00:00
|
|
|
|
(define-key menu-bar-options-menu [save-place]
|
|
|
|
|
(menu-bar-make-toggle toggle-save-place-globally save-place
|
1998-03-28 05:43:01 +00:00
|
|
|
|
"Save Place in Files between Sessions"
|
1997-08-29 02:12:38 +00:00
|
|
|
|
"Saving place in files %s"
|
2002-02-11 16:47:55 +00:00
|
|
|
|
"Save Emacs state for next session"))
|
|
|
|
|
|
1997-08-29 02:12:38 +00:00
|
|
|
|
(define-key menu-bar-options-menu [uniquify]
|
|
|
|
|
(menu-bar-make-toggle toggle-uniquify-buffer-names uniquify-buffer-name-style
|
1998-03-28 05:43:01 +00:00
|
|
|
|
"Use Directory Names in Buffer Names"
|
1997-08-29 02:12:38 +00:00
|
|
|
|
"Directory name in buffer names (uniquify) %s"
|
2001-06-22 20:06:07 +00:00
|
|
|
|
"Uniquify buffer names by adding parent directory names"
|
2002-05-01 22:01:16 +00:00
|
|
|
|
() ; no props
|
1997-08-29 02:12:38 +00:00
|
|
|
|
(require 'uniquify)
|
|
|
|
|
(setq uniquify-buffer-name-style
|
|
|
|
|
(if (not uniquify-buffer-name-style)
|
|
|
|
|
'forward))))
|
2002-02-11 16:47:55 +00:00
|
|
|
|
|
2000-02-17 11:08:09 +00:00
|
|
|
|
(define-key menu-bar-options-menu [edit-options-separator]
|
|
|
|
|
'("--"))
|
2002-05-01 22:01:16 +00:00
|
|
|
|
(define-key menu-bar-options-menu [cua-mode]
|
|
|
|
|
'(menu-item "CUA-style cut and paste"
|
|
|
|
|
(lambda ()
|
|
|
|
|
(interactive)
|
|
|
|
|
(cua-mode nil)
|
|
|
|
|
(customize-mark-as-set 'cua-mode)
|
|
|
|
|
(message "CUA-style cut and paste %s"
|
|
|
|
|
(if cua-mode "enabled" "disabled")))
|
|
|
|
|
:help "Use C-z/C-x/C-c/C-v keys for undo/cut/copy/paste"
|
|
|
|
|
:button (:toggle . cua-mode)))
|
1998-05-24 01:00:03 +00:00
|
|
|
|
(define-key menu-bar-options-menu [case-fold-search]
|
|
|
|
|
(menu-bar-make-toggle toggle-case-fold-search case-fold-search
|
2000-02-17 11:08:09 +00:00
|
|
|
|
"Case-Insensitive Search"
|
|
|
|
|
"Case-Insensitive Search %s"
|
2001-06-22 20:06:07 +00:00
|
|
|
|
"Ignore letter-case in search"))
|
2000-02-17 11:08:09 +00:00
|
|
|
|
(define-key menu-bar-options-menu [auto-fill-mode]
|
2002-06-30 21:29:39 +00:00
|
|
|
|
'(menu-item "Word Wrap in Text Modes"
|
2002-02-11 16:47:55 +00:00
|
|
|
|
(lambda ()
|
|
|
|
|
(interactive)
|
|
|
|
|
(toggle-text-mode-auto-fill)
|
|
|
|
|
;; This is somewhat questionable, as `text-mode-hook'
|
2002-04-11 13:41:49 +00:00
|
|
|
|
;; might have changed outside customize.
|
2002-02-11 16:47:55 +00:00
|
|
|
|
;; -- Per Abrahamsen <abraham@dina.kvl.dk> 2002-02-11.
|
|
|
|
|
(customize-mark-as-set 'text-mode-hook))
|
2002-06-30 21:29:39 +00:00
|
|
|
|
:help "Automatically fill text between left and right margins (Auto Fill)"
|
2002-03-18 09:06:35 +00:00
|
|
|
|
:button (:toggle . (if (listp text-mode-hook)
|
|
|
|
|
(member 'turn-on-auto-fill text-mode-hook)
|
|
|
|
|
(eq 'turn-on-auto-fill text-mode-hook)))))
|
1998-10-21 20:24:41 +00:00
|
|
|
|
(define-key menu-bar-options-menu [truncate-lines]
|
2002-02-12 16:37:11 +00:00
|
|
|
|
'(menu-item "Truncate Long Lines in this Buffer"
|
|
|
|
|
(lambda ()
|
|
|
|
|
(interactive)
|
|
|
|
|
(setq truncate-lines (not truncate-lines))
|
|
|
|
|
(set-buffer-modified-p (buffer-modified-p))
|
2002-04-11 13:41:49 +00:00
|
|
|
|
(message "Truncate long lines %s"
|
2002-02-12 16:37:11 +00:00
|
|
|
|
(if truncate-lines "enabled" "disabled")))
|
|
|
|
|
:help "Truncate long lines on the screen"
|
|
|
|
|
:button (:toggle . truncate-lines)))
|
|
|
|
|
|
2000-02-17 11:08:09 +00:00
|
|
|
|
(define-key menu-bar-options-menu [highlight-separator]
|
|
|
|
|
'("--"))
|
|
|
|
|
(define-key menu-bar-options-menu [highlight-paren-mode]
|
|
|
|
|
(menu-bar-make-toggle toggle-highlight-paren-mode show-paren-mode
|
2002-06-30 21:29:39 +00:00
|
|
|
|
"Paren Match Highlighting"
|
2000-02-17 11:08:09 +00:00
|
|
|
|
"Show Paren mode %s"
|
2002-06-30 21:29:39 +00:00
|
|
|
|
"Highlight matching/mismatched parentheses at cursor (Show Paren mode)"))
|
1997-08-29 02:12:38 +00:00
|
|
|
|
(define-key menu-bar-options-menu [transient-mark-mode]
|
|
|
|
|
(menu-bar-make-toggle toggle-transient-mark-mode transient-mark-mode
|
2002-06-30 21:29:39 +00:00
|
|
|
|
"Active Region Highlighting"
|
2000-02-17 11:08:09 +00:00
|
|
|
|
"Transient Mark mode %s"
|
2002-06-30 21:29:39 +00:00
|
|
|
|
"Make text in active region stand out in color (Transient Mark mode)"
|
2002-05-01 22:01:16 +00:00
|
|
|
|
(:enable (not cua-mode))))
|
1997-09-07 04:43:10 +00:00
|
|
|
|
(define-key menu-bar-options-menu [toggle-global-lazy-font-lock-mode]
|
1998-03-28 05:43:01 +00:00
|
|
|
|
(menu-bar-make-toggle toggle-global-lazy-font-lock-mode global-font-lock-mode
|
2002-06-30 21:29:39 +00:00
|
|
|
|
"Syntax Highlighting"
|
2001-08-29 15:15:41 +00:00
|
|
|
|
"Global Font Lock mode %s"
|
2002-06-30 21:29:39 +00:00
|
|
|
|
"Colorize text based on language syntax (Global Font Lock mode)"))
|
2000-02-17 11:08:09 +00:00
|
|
|
|
|
1997-11-24 04:59:24 +00:00
|
|
|
|
|
2000-02-17 11:08:09 +00:00
|
|
|
|
;; The "Tools" menu items
|
|
|
|
|
|
2000-10-09 10:28:16 +00:00
|
|
|
|
(defun send-mail-item-name ()
|
|
|
|
|
(let* ((known-send-mail-commands '((sendmail-user-agent . "sendmail")
|
|
|
|
|
(mh-e-user-agent . "MH")
|
|
|
|
|
(message-user-agent . "Gnus Message")
|
|
|
|
|
(gnus-user-agent . "Gnus")))
|
|
|
|
|
(name (assq mail-user-agent known-send-mail-commands)))
|
|
|
|
|
(if name
|
|
|
|
|
(setq name (cdr name))
|
|
|
|
|
(setq name (symbol-name mail-user-agent))
|
|
|
|
|
(if (string-match "\\(.+\\)-user-agent" name)
|
|
|
|
|
(setq name (match-string 1 name))))
|
|
|
|
|
name))
|
|
|
|
|
|
2000-09-07 17:14:55 +00:00
|
|
|
|
(defun read-mail-item-name ()
|
|
|
|
|
(let* ((known-rmail-commands '((rmail . "RMAIL")
|
|
|
|
|
(mh-rmail . "MH")
|
|
|
|
|
(gnus . "Gnus")))
|
|
|
|
|
(known (assq read-mail-command known-rmail-commands)))
|
|
|
|
|
(if known (cdr known) (symbol-name read-mail-command))))
|
|
|
|
|
|
2000-02-17 11:08:09 +00:00
|
|
|
|
(defvar menu-bar-games-menu (make-sparse-keymap "Games"))
|
|
|
|
|
|
|
|
|
|
(define-key menu-bar-tools-menu [games]
|
|
|
|
|
(list 'menu-item "Games" menu-bar-games-menu))
|
|
|
|
|
|
|
|
|
|
(define-key menu-bar-tools-menu [separator-games]
|
|
|
|
|
'("--"))
|
|
|
|
|
|
2000-08-04 08:34:51 +00:00
|
|
|
|
(define-key menu-bar-games-menu [zone]
|
|
|
|
|
'(menu-item "Zone Out" zone
|
|
|
|
|
:help "Play tricks with Emacs display when Emacs is idle"))
|
2000-02-17 11:08:09 +00:00
|
|
|
|
(define-key menu-bar-games-menu [yow]
|
|
|
|
|
'(menu-item "Random Quotation" yow
|
|
|
|
|
:help "Display a random Zippy quotation"))
|
|
|
|
|
(define-key menu-bar-games-menu [tetris]
|
|
|
|
|
'(menu-item "Tetris" tetris))
|
|
|
|
|
(define-key menu-bar-games-menu [solitaire]
|
|
|
|
|
'(menu-item "Solitaire" solitaire))
|
|
|
|
|
(define-key menu-bar-games-menu [snake]
|
|
|
|
|
'(menu-item "Snake" snake
|
|
|
|
|
:help "Move snake around avoiding collisions"))
|
|
|
|
|
(define-key menu-bar-games-menu [mult]
|
|
|
|
|
'(menu-item "Multiplication Puzzle" mpuz
|
|
|
|
|
:help "Excercise brain with multiplication"))
|
|
|
|
|
(define-key menu-bar-games-menu [life]
|
|
|
|
|
'(menu-item "Life" life
|
|
|
|
|
:help "Watch how John Conway's cellular automaton evolves"))
|
|
|
|
|
(define-key menu-bar-games-menu [hanoi]
|
|
|
|
|
'(menu-item "Towers of Hanoi" hanoi
|
|
|
|
|
:help "Watch Towers-of-Hanoi puzzle solved by Emacs"))
|
|
|
|
|
(define-key menu-bar-games-menu [gomoku]
|
|
|
|
|
'(menu-item "Gomoku" gomoku
|
|
|
|
|
:help "Mark 5 contiguous squares (like tic-tac-toe)"))
|
|
|
|
|
(define-key menu-bar-games-menu [black-box]
|
|
|
|
|
'(menu-item "Blackbox" blackbox
|
|
|
|
|
:help "Find balls in a black box by shooting rays"))
|
|
|
|
|
(define-key menu-bar-games-menu [adventure]
|
|
|
|
|
'(menu-item "Adventure" dunnet
|
|
|
|
|
:help "Dunnet, a text Adventure game for Emacs"))
|
|
|
|
|
(define-key menu-bar-games-menu [5x5]
|
|
|
|
|
'(menu-item "5x5" 5x5
|
|
|
|
|
:help "Fill in all the squares on a 5x5 board"))
|
|
|
|
|
|
2002-05-16 19:32:32 +00:00
|
|
|
|
(define-key menu-bar-tools-menu [simple-calculator]
|
|
|
|
|
'(menu-item "Simple Calculator" calculator
|
|
|
|
|
:help "Invoke the Emacs built-in quick calculator"))
|
|
|
|
|
(define-key menu-bar-tools-menu [calc]
|
|
|
|
|
'(menu-item "Programmable Calculator" calc
|
|
|
|
|
:help "Invoke the Emacs built-in full scientific calculator"))
|
2000-04-12 18:26:04 +00:00
|
|
|
|
(define-key menu-bar-tools-menu [calendar]
|
2000-02-17 11:08:09 +00:00
|
|
|
|
'(menu-item "Display Calendar" calendar))
|
2002-02-15 13:59:05 +00:00
|
|
|
|
|
|
|
|
|
(define-key menu-bar-tools-menu [separator-net]
|
|
|
|
|
'("--"))
|
|
|
|
|
|
2000-02-17 11:08:09 +00:00
|
|
|
|
(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"))
|
2000-04-12 18:26:04 +00:00
|
|
|
|
(define-key menu-bar-tools-menu [compose-mail]
|
2000-10-09 10:28:16 +00:00
|
|
|
|
(list
|
|
|
|
|
'menu-item `(format "Send Mail (with %s)" (send-mail-item-name))
|
|
|
|
|
'compose-mail
|
|
|
|
|
:visible `(and mail-user-agent (not (eq mail-user-agent 'ignore)))
|
|
|
|
|
:help "Send a mail message"))
|
2000-04-12 18:26:04 +00:00
|
|
|
|
(define-key menu-bar-tools-menu [rmail]
|
2000-09-07 17:14:55 +00:00
|
|
|
|
(list
|
|
|
|
|
'menu-item `(format "Read Mail (with %s)" (read-mail-item-name))
|
|
|
|
|
(lambda ()
|
|
|
|
|
(interactive)
|
|
|
|
|
(call-interactively read-mail-command))
|
2000-10-09 10:28:16 +00:00
|
|
|
|
:visible `(and read-mail-command (not (eq read-mail-command 'ignore)))
|
2000-09-07 17:14:55 +00:00
|
|
|
|
:help "Read your mail and reply to it"))
|
2000-02-17 11:08:09 +00:00
|
|
|
|
(define-key menu-bar-tools-menu [gnus]
|
2000-09-07 17:14:55 +00:00
|
|
|
|
'(menu-item "Read Net News (Gnus)" gnus
|
2000-02-17 11:08:09 +00:00
|
|
|
|
:help "Read network news groups"))
|
|
|
|
|
|
|
|
|
|
(define-key menu-bar-tools-menu [separator-vc]
|
|
|
|
|
'("--"))
|
|
|
|
|
|
|
|
|
|
(defvar vc-menu-map (make-sparse-keymap "Version Control"))
|
2000-03-22 03:05:09 +00:00
|
|
|
|
(define-key menu-bar-tools-menu [pcl-cvs]
|
|
|
|
|
`(menu-item "PCL-CVS" ,cvs-global-menu
|
|
|
|
|
:help "Module-level interface to CVS"))
|
2000-02-17 11:08:09 +00:00
|
|
|
|
(define-key menu-bar-tools-menu [vc]
|
|
|
|
|
(list 'menu-item "Version Control" vc-menu-map
|
|
|
|
|
:help "Interface to RCS, CVS, SCCS"))
|
|
|
|
|
|
|
|
|
|
(define-key menu-bar-tools-menu [separator-compare]
|
|
|
|
|
'("--"))
|
|
|
|
|
|
|
|
|
|
(define-key menu-bar-tools-menu [ediff-misc]
|
|
|
|
|
'(menu-item "Ediff Miscellanea" menu-bar-ediff-misc-menu
|
|
|
|
|
:help "Ediff manual, customization, sessions, etc."))
|
|
|
|
|
(define-key menu-bar-tools-menu [epatch]
|
|
|
|
|
'(menu-item "Apply Patch" menu-bar-epatch-menu))
|
|
|
|
|
(define-key menu-bar-tools-menu [ediff-merge]
|
|
|
|
|
'(menu-item "Merge" menu-bar-ediff-merge-menu
|
|
|
|
|
:help "Merge different revisions of files/directories"))
|
|
|
|
|
(define-key menu-bar-tools-menu [compare]
|
|
|
|
|
'(menu-item "Compare (Ediff)" menu-bar-ediff-menu
|
|
|
|
|
:help "Display differences between files/directories"))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(define-key menu-bar-tools-menu [separator-spell]
|
|
|
|
|
'("--"))
|
|
|
|
|
|
|
|
|
|
(define-key menu-bar-tools-menu [spell]
|
|
|
|
|
'(menu-item "Spell Checking" ispell-menu-map))
|
|
|
|
|
|
|
|
|
|
(define-key menu-bar-tools-menu [separator-prog]
|
|
|
|
|
'("--"))
|
|
|
|
|
|
|
|
|
|
(define-key menu-bar-tools-menu [gdb]
|
2002-03-31 03:16:26 +00:00
|
|
|
|
'(menu-item "Debugger (GDB)..." gdb
|
|
|
|
|
:help "Debug a program from within Emacs with GDB"))
|
2000-02-17 11:08:09 +00:00
|
|
|
|
(define-key menu-bar-tools-menu [shell-on-region]
|
|
|
|
|
'(menu-item "Shell Command on Region..." shell-command-on-region
|
|
|
|
|
:enable mark-active
|
|
|
|
|
:help "Pass marked region to a shell command"))
|
|
|
|
|
(define-key menu-bar-tools-menu [shell]
|
|
|
|
|
'(menu-item "Shell Command..." shell-command
|
|
|
|
|
:help "Invoke a shell command and catch its output"))
|
|
|
|
|
(define-key menu-bar-tools-menu [compile]
|
|
|
|
|
'(menu-item "Compile..." compile
|
|
|
|
|
:help "Invoke compiler or Make, view compilation errors"))
|
|
|
|
|
(define-key menu-bar-tools-menu [grep]
|
|
|
|
|
'(menu-item "Search Files (Grep)..." grep
|
|
|
|
|
:help "Search files for strings or regexps (with Grep)"))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; The "Help" menu items
|
|
|
|
|
|
1997-11-24 04:59:24 +00:00
|
|
|
|
(defvar menu-bar-describe-menu (make-sparse-keymap "Describe"))
|
|
|
|
|
|
2000-02-17 11:08:09 +00:00
|
|
|
|
(define-key menu-bar-describe-menu [mule-diag]
|
|
|
|
|
'(menu-item "Show All of Mule Status" mule-diag
|
|
|
|
|
:visible default-enable-multibyte-characters
|
|
|
|
|
:help "Display multilingual environment settings"))
|
2001-11-25 05:46:35 +00:00
|
|
|
|
(define-key menu-bar-describe-menu [describe-coding-system-briefly]
|
|
|
|
|
'(menu-item "Describe Coding System (Briefly)..."
|
|
|
|
|
describe-current-coding-system-briefly
|
|
|
|
|
:visible default-enable-multibyte-characters))
|
2000-02-17 11:08:09 +00:00
|
|
|
|
(define-key menu-bar-describe-menu [describe-coding-system]
|
|
|
|
|
'(menu-item "Describe Coding System..." describe-coding-system
|
|
|
|
|
:visible default-enable-multibyte-characters))
|
|
|
|
|
(define-key menu-bar-describe-menu [describe-input-method]
|
|
|
|
|
'(menu-item "Describe Input Method..." describe-input-method
|
|
|
|
|
:visible default-enable-multibyte-characters
|
|
|
|
|
:help "Keyboard layout for specific input method"))
|
|
|
|
|
(define-key menu-bar-describe-menu [describe-language-environment]
|
2000-04-12 18:26:04 +00:00
|
|
|
|
(list 'menu-item "Describe Language Environment"
|
|
|
|
|
describe-language-environment-map
|
|
|
|
|
:help "Show multilingual settings for a specific language"))
|
2000-02-17 11:08:09 +00:00
|
|
|
|
|
|
|
|
|
(define-key menu-bar-describe-menu [separator-desc-mule]
|
2000-04-12 18:26:04 +00:00
|
|
|
|
'("--"))
|
2000-02-17 11:08:09 +00:00
|
|
|
|
|
|
|
|
|
(define-key menu-bar-describe-menu [list-keybindings]
|
|
|
|
|
'(menu-item "List Key Bindings" describe-bindings
|
|
|
|
|
:help "Display a list of all current keybindings"))
|
2001-11-25 05:46:35 +00:00
|
|
|
|
(define-key menu-bar-describe-menu [describe-current-display-table]
|
|
|
|
|
'(menu-item "Describe Display Table" describe-current-display-table
|
|
|
|
|
:help "Describe the current display table"))
|
|
|
|
|
(define-key menu-bar-describe-menu [describe-face]
|
|
|
|
|
'(menu-item "Describe Face..." describe-face
|
|
|
|
|
:help "Display the properties of a face"))
|
1997-11-24 04:59:24 +00:00
|
|
|
|
(define-key menu-bar-describe-menu [describe-variable]
|
2000-02-17 11:08:09 +00:00
|
|
|
|
'(menu-item "Describe Variable..." describe-variable
|
|
|
|
|
:help "Display documentation of variable/option"))
|
1997-11-24 04:59:24 +00:00
|
|
|
|
(define-key menu-bar-describe-menu [describe-function]
|
2000-02-17 11:08:09 +00:00
|
|
|
|
'(menu-item "Describe Function..." describe-function
|
|
|
|
|
:help "Display documentation of function/command"))
|
1997-11-24 04:59:24 +00:00
|
|
|
|
(define-key menu-bar-describe-menu [describe-key]
|
2000-02-17 11:08:09 +00:00
|
|
|
|
'(menu-item "Describe Key..." describe-key
|
2000-04-12 18:26:04 +00:00
|
|
|
|
;; Users typically don't identify keys and menu items...
|
|
|
|
|
:help "Display documentation of command bound to a \
|
|
|
|
|
key (or menu-item)"))
|
2001-11-25 05:46:35 +00:00
|
|
|
|
(define-key menu-bar-describe-menu [describe-mode]
|
|
|
|
|
'(menu-item "Describe Buffer Modes" describe-mode
|
|
|
|
|
:help "Describe this buffer's major and minor mode"))
|
|
|
|
|
|
|
|
|
|
(defvar menu-bar-apropos-menu (make-sparse-keymap "Apropos"))
|
2001-11-30 10:23:23 +00:00
|
|
|
|
(defun menu-bar-read-lispref ()
|
|
|
|
|
"Display the Emacs Lisp Reference manual in Info mode."
|
|
|
|
|
(interactive)
|
|
|
|
|
(info "elisp"))
|
|
|
|
|
|
|
|
|
|
(defun menu-bar-read-lispintro ()
|
|
|
|
|
"Display the Introduction to Emacs Lisp Programming in Info mode."
|
|
|
|
|
(interactive)
|
|
|
|
|
(info "eintr"))
|
|
|
|
|
|
|
|
|
|
(defun menu-bar-read-emacs-man ()
|
|
|
|
|
"Display Emacs User Manual in Info mode."
|
|
|
|
|
(interactive)
|
|
|
|
|
(info "emacs"))
|
|
|
|
|
|
|
|
|
|
(defun search-emacs-glossary ()
|
|
|
|
|
"Display the Glossary node of the Emacs manual in Info mode."
|
|
|
|
|
(interactive)
|
|
|
|
|
(info "(emacs)Glossary"))
|
|
|
|
|
|
|
|
|
|
(defun emacs-index-search (topic)
|
|
|
|
|
"Look up TOPIC in the indices of the Emacs User Manual."
|
|
|
|
|
(interactive "sSubject to look up: ")
|
|
|
|
|
(info "emacs")
|
|
|
|
|
(Info-index topic))
|
|
|
|
|
|
|
|
|
|
(defun elisp-index-search (topic)
|
|
|
|
|
"Look up TOPIC in the indices of the Emacs Lisp Reference Manual."
|
|
|
|
|
(interactive "sSubject to look up: ")
|
|
|
|
|
(info "elisp")
|
|
|
|
|
(Info-index topic))
|
2001-11-25 05:46:35 +00:00
|
|
|
|
|
|
|
|
|
(define-key menu-bar-apropos-menu [apropos-documentation]
|
2001-11-30 10:23:23 +00:00
|
|
|
|
'(menu-item "Search Documentation Strings..." apropos-documentation
|
|
|
|
|
:help
|
|
|
|
|
"Find functions and variables whose doc strings match a regexp"))
|
2001-11-25 05:46:35 +00:00
|
|
|
|
(define-key menu-bar-apropos-menu [apropos]
|
2001-11-30 10:23:23 +00:00
|
|
|
|
'(menu-item "Find Any Object by Name..." apropos
|
|
|
|
|
:help "Find symbols of any kind whose names match a regexp"))
|
2001-11-25 05:46:35 +00:00
|
|
|
|
(define-key menu-bar-apropos-menu [apropos-value]
|
2001-11-30 10:23:23 +00:00
|
|
|
|
'(menu-item "Find Options by Value..." apropos-value
|
|
|
|
|
:help "Find variables whose values match a regexp"))
|
2001-11-25 05:46:35 +00:00
|
|
|
|
(define-key menu-bar-apropos-menu [apropos-variables]
|
2001-11-30 10:23:23 +00:00
|
|
|
|
'(menu-item "Find Options by Name..." apropos-variable
|
|
|
|
|
:help "Find variables whose names match a regexp"))
|
2001-11-25 05:46:35 +00:00
|
|
|
|
(define-key menu-bar-apropos-menu [apropos-commands]
|
2001-11-30 10:23:23 +00:00
|
|
|
|
'(menu-item "Find Commands by Name..." apropos-command
|
|
|
|
|
:help "Find commands whose names match a regexp"))
|
|
|
|
|
(define-key menu-bar-apropos-menu [sep1]
|
|
|
|
|
'("--"))
|
|
|
|
|
(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-apropos-menu [emacs-index-search]
|
|
|
|
|
'(menu-item "Look Up Subject in User Manual..." emacs-index-search
|
|
|
|
|
:help "Find description of a subject in Emacs User manual"))
|
|
|
|
|
(define-key menu-bar-apropos-menu [emacs-glossary]
|
|
|
|
|
'(menu-item "Emacs Terminology" search-emacs-glossary
|
|
|
|
|
:help "Display the Glossary section of the Emacs manual"))
|
|
|
|
|
|
|
|
|
|
(defvar menu-bar-manuals-menu (make-sparse-keymap "More Manuals"))
|
1997-11-24 04:59:24 +00:00
|
|
|
|
|
|
|
|
|
(define-key menu-bar-manuals-menu [man]
|
2000-02-17 11:08:09 +00:00
|
|
|
|
'(menu-item "Read Man Page..." manual-entry
|
|
|
|
|
:help "Man-page docs for external commands and libraries"))
|
1997-11-24 04:59:24 +00:00
|
|
|
|
(define-key menu-bar-manuals-menu [sep2]
|
|
|
|
|
'("--"))
|
2001-11-30 10:23:23 +00:00
|
|
|
|
(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"))
|
1997-11-24 04:59:24 +00:00
|
|
|
|
(define-key menu-bar-manuals-menu [info]
|
2001-11-30 10:23:23 +00:00
|
|
|
|
'(menu-item "All Other Manuals (Info)" Info-directory
|
2000-02-17 11:08:09 +00:00
|
|
|
|
:help "Read any of the installed manuals"))
|
2001-11-30 10:23:23 +00:00
|
|
|
|
(define-key menu-bar-manuals-menu [info-elisp]
|
|
|
|
|
'(menu-item "Emacs Lisp Reference" menu-bar-read-lispref
|
|
|
|
|
:help "Read the Emacs Lisp Reference manual"))
|
|
|
|
|
(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]
|
|
|
|
|
'("--"))
|
2000-02-17 11:08:09 +00:00
|
|
|
|
(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"))
|
1997-08-29 02:12:38 +00:00
|
|
|
|
|
2000-02-17 11:08:09 +00:00
|
|
|
|
(define-key menu-bar-help-menu [eliza]
|
|
|
|
|
'(menu-item "Emacs Psychiatrist" doctor
|
|
|
|
|
:help "Our doctor will help you feel better"))
|
2001-11-30 10:23:23 +00:00
|
|
|
|
(define-key menu-bar-help-menu [sep4]
|
2000-02-17 11:08:09 +00:00
|
|
|
|
'("--"))
|
1998-01-24 02:23:15 +00:00
|
|
|
|
(define-key menu-bar-help-menu [describe-no-warranty]
|
2000-02-17 11:08:09 +00:00
|
|
|
|
'(menu-item "(Non)Warranty" describe-no-warranty
|
|
|
|
|
:help "Explain that Emacs has NO WARRANTY"))
|
1998-01-24 02:23:15 +00:00
|
|
|
|
(define-key menu-bar-help-menu [describe-copying]
|
2000-02-17 11:08:09 +00:00
|
|
|
|
'(menu-item "Copying Conditions" describe-copying
|
|
|
|
|
:help "Show the Emacs license (GPL)"))
|
1998-01-24 02:23:15 +00:00
|
|
|
|
(define-key menu-bar-help-menu [describe-distribution]
|
2000-02-17 11:08:09 +00:00
|
|
|
|
'(menu-item "Getting New Versions" describe-distribution
|
|
|
|
|
:help "How to get latest versions of Emacs"))
|
2000-10-26 21:51:22 +00:00
|
|
|
|
(define-key menu-bar-help-menu [more]
|
|
|
|
|
'(menu-item "Find Extra Packages"
|
|
|
|
|
(lambda ()
|
|
|
|
|
(interactive)
|
|
|
|
|
(let (enable-local-variables)
|
|
|
|
|
(view-file (expand-file-name "MORE.STUFF"
|
|
|
|
|
data-directory))
|
|
|
|
|
(goto-address)))
|
|
|
|
|
:help "Where to find some extra packages and possible updates"))
|
2002-01-29 13:55:43 +00:00
|
|
|
|
(define-key menu-bar-help-menu [about]
|
|
|
|
|
'(menu-item "About Emacs" display-splash-screen
|
2002-02-03 11:28:28 +00:00
|
|
|
|
:help "Display version number, copyright info, and basic help"))
|
1997-11-24 04:59:24 +00:00
|
|
|
|
(define-key menu-bar-help-menu [sep2]
|
|
|
|
|
'("--"))
|
1995-07-17 22:51:17 +00:00
|
|
|
|
(define-key menu-bar-help-menu [finder-by-keyword]
|
2000-02-17 11:08:09 +00:00
|
|
|
|
'(menu-item "Find Emacs Packages..." finder-by-keyword
|
|
|
|
|
:help "Find packages and features by keyword"))
|
2001-11-30 10:23:23 +00:00
|
|
|
|
(define-key menu-bar-help-menu [manuals]
|
|
|
|
|
(list 'menu-item "More Manuals" menu-bar-manuals-menu
|
|
|
|
|
:help "Search and browse on-line manuals"))
|
|
|
|
|
(define-key menu-bar-help-menu [emacs-manual]
|
|
|
|
|
'(menu-item "Read the Emacs Manual" menu-bar-read-emacs-man
|
|
|
|
|
:help "Full documentation of Emacs features"))
|
1997-11-24 04:59:24 +00:00
|
|
|
|
(define-key menu-bar-help-menu [describe]
|
2000-02-17 11:08:09 +00:00
|
|
|
|
(list 'menu-item "Describe" menu-bar-describe-menu
|
|
|
|
|
:help "Describe commands, variables, keys"))
|
2001-11-30 10:23:23 +00:00
|
|
|
|
(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)"))
|
1997-11-24 04:59:24 +00:00
|
|
|
|
(define-key menu-bar-help-menu [sep1]
|
|
|
|
|
'("--"))
|
2000-02-17 11:08:09 +00:00
|
|
|
|
(define-key menu-bar-help-menu [report-emacs-bug]
|
|
|
|
|
'(menu-item "Send Bug Report..." report-emacs-bug
|
|
|
|
|
:help "Send e-mail to Emacs maintainers"))
|
|
|
|
|
(define-key menu-bar-help-menu [emacs-problems]
|
|
|
|
|
'(menu-item "Emacs Known Problems" view-emacs-problems))
|
|
|
|
|
(define-key menu-bar-help-menu [emacs-news]
|
|
|
|
|
'(menu-item "Emacs News" view-emacs-news
|
|
|
|
|
:help "New features of this version"))
|
|
|
|
|
(define-key menu-bar-help-menu [emacs-faq]
|
|
|
|
|
'(menu-item "Emacs FAQ" view-emacs-FAQ))
|
2000-06-15 19:52:15 +00:00
|
|
|
|
(define-key menu-bar-help-menu [emacs-tutorial-language-specific]
|
|
|
|
|
'(menu-item "Emacs Tutorial (choose language)..."
|
|
|
|
|
(lambda () (interactive) (help-with-tutorial t))
|
|
|
|
|
:help "Learn how to use Emacs (choose a language)"))
|
2000-02-17 11:08:09 +00:00
|
|
|
|
(define-key menu-bar-help-menu [emacs-tutorial]
|
|
|
|
|
'(menu-item "Emacs Tutorial" help-with-tutorial
|
|
|
|
|
:help "Learn how to use Emacs"))
|
1995-03-06 05:19:05 +00:00
|
|
|
|
|
1993-03-14 23:39:34 +00:00
|
|
|
|
(defun kill-this-buffer () ; for the menubar
|
2000-04-12 18:26:04 +00:00
|
|
|
|
"Kill the current buffer."
|
1993-03-14 23:39:34 +00:00
|
|
|
|
(interactive)
|
|
|
|
|
(kill-buffer (current-buffer)))
|
|
|
|
|
|
1993-03-15 01:05:11 +00:00
|
|
|
|
(defun kill-this-buffer-enabled-p ()
|
|
|
|
|
(let ((count 0)
|
|
|
|
|
(buffers (buffer-list)))
|
|
|
|
|
(while buffers
|
|
|
|
|
(or (string-match "^ " (buffer-name (car buffers)))
|
|
|
|
|
(setq count (1+ count)))
|
|
|
|
|
(setq buffers (cdr buffers)))
|
1996-12-07 20:30:18 +00:00
|
|
|
|
(and (not (window-minibuffer-p (frame-selected-window menu-updating-frame)))
|
1995-04-24 15:26:19 +00:00
|
|
|
|
(> count 1))))
|
|
|
|
|
|
|
|
|
|
(put 'dired 'menu-enable
|
1996-12-07 20:30:18 +00:00
|
|
|
|
'(not (window-minibuffer-p (frame-selected-window menu-updating-frame))))
|
1995-04-24 15:26:19 +00:00
|
|
|
|
|
1993-07-29 04:50:27 +00:00
|
|
|
|
;; Permit deleting frame if it would leave a visible or iconified frame.
|
1995-05-24 01:02:08 +00:00
|
|
|
|
(defun delete-frame-enabled-p ()
|
|
|
|
|
"Return non-nil if `delete-frame' should be enabled in the menu bar."
|
|
|
|
|
(let ((frames (frame-list))
|
1996-06-21 05:54:19 +00:00
|
|
|
|
(count 0))
|
|
|
|
|
(while frames
|
|
|
|
|
(if (frame-visible-p (car frames))
|
|
|
|
|
(setq count (1+ count)))
|
|
|
|
|
(setq frames (cdr frames)))
|
|
|
|
|
(> count 1)))
|
1993-03-15 01:05:11 +00:00
|
|
|
|
|
1997-05-05 15:06:25 +00:00
|
|
|
|
(defcustom yank-menu-length 20
|
|
|
|
|
"*Maximum length to display in the yank-menu."
|
|
|
|
|
:type 'integer
|
|
|
|
|
:group 'mouse)
|
1994-09-15 22:16:49 +00:00
|
|
|
|
|
|
|
|
|
(defun menu-bar-update-yank-menu (string old)
|
|
|
|
|
(let ((front (car (cdr yank-menu)))
|
|
|
|
|
(menu-string (if (<= (length string) yank-menu-length)
|
|
|
|
|
string
|
1995-01-30 00:37:22 +00:00
|
|
|
|
(concat
|
|
|
|
|
(substring string 0 (/ yank-menu-length 2))
|
|
|
|
|
"..."
|
|
|
|
|
(substring string (- (/ yank-menu-length 2)))))))
|
1995-07-20 06:14:12 +00:00
|
|
|
|
;; Don't let the menu string be all dashes
|
|
|
|
|
;; because that has a special meaning in a menu.
|
|
|
|
|
(if (string-match "\\`-+\\'" menu-string)
|
|
|
|
|
(setq menu-string (concat menu-string " ")))
|
1994-09-15 22:16:49 +00:00
|
|
|
|
;; If we're supposed to be extending an existing string, and that
|
|
|
|
|
;; string really is at the front of the menu, then update it in place.
|
|
|
|
|
(if (and old (or (eq old (car front))
|
|
|
|
|
(string= old (car front))))
|
1993-07-01 03:31:58 +00:00
|
|
|
|
(progn
|
1994-09-15 22:16:49 +00:00
|
|
|
|
(setcar front string)
|
|
|
|
|
(setcar (cdr front) menu-string))
|
|
|
|
|
(setcdr yank-menu
|
|
|
|
|
(cons
|
|
|
|
|
(cons string (cons menu-string 'menu-bar-select-yank))
|
|
|
|
|
(cdr yank-menu)))))
|
|
|
|
|
(if (> (length (cdr yank-menu)) kill-ring-max)
|
|
|
|
|
(setcdr (nthcdr kill-ring-max yank-menu) nil)))
|
|
|
|
|
|
1997-12-21 01:46:29 +00:00
|
|
|
|
(put 'menu-bar-select-yank 'apropos-inhibit t)
|
1994-09-15 22:16:49 +00:00
|
|
|
|
(defun menu-bar-select-yank ()
|
|
|
|
|
(interactive "*")
|
|
|
|
|
(push-mark (point))
|
|
|
|
|
(insert last-command-event))
|
2002-04-24 05:35:03 +00:00
|
|
|
|
|
1993-03-15 02:00:20 +00:00
|
|
|
|
|
2002-04-24 05:35:03 +00:00
|
|
|
|
(defcustom buffers-menu-show-directories 'unless-uniquify
|
|
|
|
|
"If non-nil, show directories in the Buffers menu for buffers that have them.
|
|
|
|
|
The special value `unless-uniquify' means that directories will be shown
|
|
|
|
|
unless `uniquify-buffer-name-style' is non-nil (in which case, buffer
|
|
|
|
|
names should include enough of a buffer's directory to distinguish it
|
|
|
|
|
from other buffers).
|
|
|
|
|
|
|
|
|
|
Setting this variable directly does not take effect until next time the
|
|
|
|
|
Buffers menu is regenerated."
|
|
|
|
|
:set (lambda (symbol value)
|
|
|
|
|
(set symbol value)
|
|
|
|
|
(menu-bar-update-buffers t))
|
|
|
|
|
:initialize 'custom-initialize-default
|
|
|
|
|
:type '(choice (const :tag "Never" nil)
|
|
|
|
|
(const :tag "Unless uniquify is enabled" unless-uniquify)
|
|
|
|
|
(const :tag "Always" t))
|
|
|
|
|
:group 'menu)
|
|
|
|
|
|
|
|
|
|
(defcustom buffers-menu-show-status t
|
|
|
|
|
"If non-nil, show modified/read-only status of buffers in the Buffers menu.
|
|
|
|
|
Setting this variable directly does not take effect until next time the
|
|
|
|
|
Buffers menu is regenerated."
|
|
|
|
|
:set (lambda (symbol value)
|
|
|
|
|
(set symbol value)
|
|
|
|
|
(menu-bar-update-buffers t))
|
|
|
|
|
:initialize 'custom-initialize-default
|
|
|
|
|
:type 'boolean
|
|
|
|
|
:group 'menu)
|
|
|
|
|
|
1993-08-14 10:32:54 +00:00
|
|
|
|
(defvar list-buffers-directory nil)
|
|
|
|
|
|
1994-10-23 07:45:25 +00:00
|
|
|
|
(defvar menu-bar-update-buffers-maxbuf)
|
|
|
|
|
|
1994-04-28 03:44:48 +00:00
|
|
|
|
(defun menu-bar-select-buffer ()
|
|
|
|
|
(interactive)
|
|
|
|
|
(switch-to-buffer last-command-event))
|
|
|
|
|
|
|
|
|
|
(defun menu-bar-select-frame ()
|
|
|
|
|
(interactive)
|
2001-02-13 19:18:01 +00:00
|
|
|
|
(let (frame)
|
|
|
|
|
(dolist (f (frame-list))
|
|
|
|
|
(when (equal last-command-event (frame-parameter f 'name))
|
|
|
|
|
(setq frame f)))
|
|
|
|
|
(make-frame-visible frame)
|
|
|
|
|
(raise-frame frame)
|
|
|
|
|
(select-frame frame)))
|
1994-04-28 03:44:48 +00:00
|
|
|
|
|
1994-10-13 18:20:15 +00:00
|
|
|
|
(defun menu-bar-update-buffers-1 (elt)
|
2002-04-23 14:33:02 +00:00
|
|
|
|
(let* ((buf (car elt))
|
|
|
|
|
(file
|
2002-04-24 05:35:03 +00:00
|
|
|
|
(and (if (eq buffers-menu-show-directories 'unless-uniquify)
|
|
|
|
|
(or (not (boundp 'uniquify-buffer-name-style))
|
|
|
|
|
(null uniquify-buffer-name-style))
|
|
|
|
|
buffers-menu-show-directories)
|
2002-04-23 14:33:02 +00:00
|
|
|
|
(or (buffer-file-name buf)
|
2002-04-24 05:35:03 +00:00
|
|
|
|
(buffer-local-value 'list-buffers-directory buf)))))
|
2002-04-23 14:33:02 +00:00
|
|
|
|
(when file
|
|
|
|
|
(setq file (file-name-directory file)))
|
|
|
|
|
(when (and file (> (length file) 20))
|
|
|
|
|
(setq file (concat "..." (substring file -17))))
|
2002-04-24 05:35:03 +00:00
|
|
|
|
(cons (if buffers-menu-show-status
|
|
|
|
|
(let ((mod (if (buffer-modified-p buf) "*" ""))
|
|
|
|
|
(ro (if (buffer-local-value 'buffer-read-only buf) "%" "")))
|
|
|
|
|
(if file
|
|
|
|
|
(format "%s %s%s -- %s" (cdr elt) mod ro file)
|
|
|
|
|
(format "%s %s%s" (cdr elt) mod ro)))
|
|
|
|
|
(if file
|
|
|
|
|
(format "%s -- %s" (cdr elt) file)
|
|
|
|
|
(cdr elt)))
|
2002-04-23 14:33:02 +00:00
|
|
|
|
buf)))
|
|
|
|
|
|
2002-04-23 08:36:35 +00:00
|
|
|
|
;; Used to cache the menu entries for commands in the Buffers menu
|
|
|
|
|
(defvar menu-bar-buffers-menu-command-entries nil)
|
|
|
|
|
|
2001-02-20 15:25:06 +00:00
|
|
|
|
(defun menu-bar-update-buffers (&optional force)
|
1994-07-24 05:34:16 +00:00
|
|
|
|
;; If user discards the Buffers item, play along.
|
1994-07-26 19:57:59 +00:00
|
|
|
|
(and (lookup-key (current-global-map) [menu-bar buffer])
|
2001-02-20 15:25:06 +00:00
|
|
|
|
(or force (frame-or-buffer-changed-p))
|
1994-07-24 05:34:16 +00:00
|
|
|
|
(let ((buffers (buffer-list))
|
|
|
|
|
(frames (frame-list))
|
|
|
|
|
buffers-menu frames-menu)
|
|
|
|
|
;; If requested, list only the N most recently selected buffers.
|
|
|
|
|
(if (and (integerp buffers-menu-max-size)
|
|
|
|
|
(> buffers-menu-max-size 1))
|
|
|
|
|
(if (> (length buffers) buffers-menu-max-size)
|
|
|
|
|
(setcdr (nthcdr buffers-menu-max-size buffers) nil)))
|
|
|
|
|
|
|
|
|
|
;; Make the menu of buffers proper.
|
|
|
|
|
(setq buffers-menu
|
2002-04-23 05:02:14 +00:00
|
|
|
|
(let* ((buffer-list
|
|
|
|
|
(mapcar 'list buffers))
|
|
|
|
|
(menu-bar-update-buffers-maxbuf 0)
|
|
|
|
|
alist)
|
|
|
|
|
;; Put into each element of buffer-list
|
|
|
|
|
;; the name for actual display,
|
|
|
|
|
;; perhaps truncated in the middle.
|
|
|
|
|
(dolist (buf buffer-list)
|
|
|
|
|
(let ((name (buffer-name (car buf))))
|
|
|
|
|
(setcdr buf
|
|
|
|
|
(if (> (length name) 27)
|
|
|
|
|
(concat (substring name 0 12)
|
|
|
|
|
"..."
|
|
|
|
|
(substring name -12))
|
|
|
|
|
name))))
|
|
|
|
|
;; Compute the maximum length of any name.
|
|
|
|
|
(dolist (buf buffer-list)
|
|
|
|
|
(unless (eq ?\ (aref (cdr buf) 0))
|
|
|
|
|
(setq menu-bar-update-buffers-maxbuf
|
|
|
|
|
(max menu-bar-update-buffers-maxbuf
|
|
|
|
|
(length (cdr buf))))))
|
|
|
|
|
;; Set ALIST to an alist of the form
|
|
|
|
|
;; ITEM-STRING . BUFFER
|
|
|
|
|
(dolist (buf buffer-list)
|
|
|
|
|
(unless (eq ?\ (aref (cdr buf) 0))
|
|
|
|
|
(push (menu-bar-update-buffers-1 buf) alist)))
|
|
|
|
|
;; Now make the actual list of items, and add
|
|
|
|
|
;; some miscellaneous buffer commands to the end.
|
|
|
|
|
(mapcar (lambda (pair)
|
|
|
|
|
;; This is somewhat risque, to use
|
|
|
|
|
;; the buffer name itself as the event
|
|
|
|
|
;; type to define, but it works.
|
|
|
|
|
;; It would not work to use the buffer
|
|
|
|
|
;; since a buffer as an event has its
|
|
|
|
|
;; own meaning.
|
|
|
|
|
(nconc (list (buffer-name (cdr pair))
|
|
|
|
|
(car pair)
|
|
|
|
|
(cons nil nil))
|
|
|
|
|
'menu-bar-select-buffer))
|
|
|
|
|
(nreverse alist))))
|
1994-07-24 05:34:16 +00:00
|
|
|
|
|
|
|
|
|
;; Make a Frames menu if we have more than one frame.
|
2002-04-23 05:02:14 +00:00
|
|
|
|
(when (cdr frames)
|
|
|
|
|
(let ((frames-menu
|
|
|
|
|
(cons 'keymap
|
|
|
|
|
(cons "Select Frame"
|
|
|
|
|
(mapcar
|
|
|
|
|
(lambda (frame)
|
|
|
|
|
(nconc
|
|
|
|
|
(list (frame-parameter frame 'name)
|
|
|
|
|
(frame-parameter frame 'name)
|
|
|
|
|
(cons nil nil))
|
|
|
|
|
'menu-bar-select-frame))
|
|
|
|
|
frames)))))
|
|
|
|
|
;; Put it after the normal buffers
|
|
|
|
|
(setq buffers-menu
|
|
|
|
|
(nconc buffers-menu
|
|
|
|
|
`((frames-separator "--")
|
|
|
|
|
(frames menu-item "Frames" ,frames-menu))))))
|
|
|
|
|
|
2002-04-23 08:36:35 +00:00
|
|
|
|
;; Add in some normal commands at the end of the menu. We use
|
|
|
|
|
;; the copy cached in `menu-bar-buffers-menu-command-entries'
|
|
|
|
|
;; if it's been set already. Note that we can't use constant
|
|
|
|
|
;; lists for the menu-entries, because the low-level menu-code
|
|
|
|
|
;; modifies them.
|
|
|
|
|
(unless menu-bar-buffers-menu-command-entries
|
|
|
|
|
(setq menu-bar-buffers-menu-command-entries
|
|
|
|
|
(list '(command-separator "--")
|
2002-04-27 23:18:21 +00:00
|
|
|
|
(list 'next-buffer
|
|
|
|
|
'menu-item
|
|
|
|
|
"Next Buffer"
|
|
|
|
|
'next-buffer
|
|
|
|
|
:help "Switch to the \"next\" buffer in a cyclic order")
|
|
|
|
|
(list 'prev-buffer
|
|
|
|
|
'menu-item
|
|
|
|
|
"Previous Buffer"
|
|
|
|
|
'prev-buffer
|
|
|
|
|
:help "Switch to the \"previous\" buffer in a cyclic order")
|
2002-04-23 08:36:35 +00:00
|
|
|
|
(list 'select-named-buffer
|
|
|
|
|
'menu-item
|
|
|
|
|
"Select Named Buffer..."
|
|
|
|
|
'switch-to-buffer
|
|
|
|
|
:help "Prompt for a buffer name, and select that buffer in the current window")
|
|
|
|
|
(list 'list-all-buffers
|
|
|
|
|
'menu-item
|
|
|
|
|
"List All Buffers"
|
|
|
|
|
'list-buffers
|
|
|
|
|
:help "Pop up a window listing all emacs buffers"
|
|
|
|
|
))))
|
2002-04-23 05:02:14 +00:00
|
|
|
|
(setq buffers-menu
|
2002-04-23 08:36:35 +00:00
|
|
|
|
(nconc buffers-menu menu-bar-buffers-menu-command-entries))
|
2002-04-23 05:02:14 +00:00
|
|
|
|
|
|
|
|
|
(setq buffers-menu (cons 'keymap (cons "Select Buffer" buffers-menu)))
|
1994-07-26 19:57:59 +00:00
|
|
|
|
(define-key (current-global-map) [menu-bar buffer]
|
1996-08-31 16:25:51 +00:00
|
|
|
|
(cons "Buffers" buffers-menu)))))
|
1994-04-28 03:44:48 +00:00
|
|
|
|
|
|
|
|
|
(add-hook 'menu-bar-update-hook 'menu-bar-update-buffers)
|
1993-03-15 01:05:11 +00:00
|
|
|
|
|
1995-07-21 08:30:54 +00:00
|
|
|
|
(menu-bar-update-buffers)
|
|
|
|
|
|
1993-03-15 02:00:20 +00:00
|
|
|
|
;; this version is too slow
|
|
|
|
|
;;;(defun format-buffers-menu-line (buffer)
|
|
|
|
|
;;; "Returns a string to represent the given buffer in the Buffer menu.
|
|
|
|
|
;;;nil means the buffer shouldn't be listed. You can redefine this."
|
|
|
|
|
;;; (if (string-match "\\` " (buffer-name buffer))
|
|
|
|
|
;;; nil
|
|
|
|
|
;;; (save-excursion
|
|
|
|
|
;;; (set-buffer buffer)
|
|
|
|
|
;;; (let ((size (buffer-size)))
|
|
|
|
|
;;; (format "%s%s %-19s %6s %-15s %s"
|
|
|
|
|
;;; (if (buffer-modified-p) "*" " ")
|
|
|
|
|
;;; (if buffer-read-only "%" " ")
|
|
|
|
|
;;; (buffer-name)
|
|
|
|
|
;;; size
|
|
|
|
|
;;; mode-name
|
|
|
|
|
;;; (or (buffer-file-name) ""))))))
|
|
|
|
|
|
1995-06-29 03:11:37 +00:00
|
|
|
|
;;; Set up a menu bar menu for the minibuffer.
|
|
|
|
|
|
2001-10-12 19:59:43 +00:00
|
|
|
|
(dolist (map (list minibuffer-local-map
|
|
|
|
|
;; This shouldn't be necessary, but there's a funny
|
|
|
|
|
;; bug in keymap.c that I don't understand yet. -stef
|
2000-11-03 22:28:30 +00:00
|
|
|
|
minibuffer-local-completion-map))
|
|
|
|
|
(define-key map [menu-bar minibuf]
|
|
|
|
|
(cons "Minibuf" (make-sparse-keymap "Minibuf"))))
|
|
|
|
|
|
2001-10-12 19:59:43 +00:00
|
|
|
|
(let ((map minibuffer-local-completion-map))
|
2000-11-03 22:28:30 +00:00
|
|
|
|
(define-key map [menu-bar minibuf ?\?]
|
|
|
|
|
(list 'menu-item "List Completions" 'minibuffer-completion-help
|
|
|
|
|
:help "Display all possible completions"))
|
|
|
|
|
(define-key map [menu-bar minibuf space]
|
|
|
|
|
(list 'menu-item "Complete Word" 'minibuffer-complete-word
|
|
|
|
|
:help "Complete at most one word"))
|
|
|
|
|
(define-key map [menu-bar minibuf tab]
|
|
|
|
|
(list 'menu-item "Complete" 'minibuffer-complete
|
|
|
|
|
:help "Complete as far as possible")))
|
|
|
|
|
|
2001-10-12 19:59:43 +00:00
|
|
|
|
(let ((map minibuffer-local-map))
|
2000-11-03 22:28:30 +00:00
|
|
|
|
(define-key map [menu-bar minibuf quit]
|
|
|
|
|
(list 'menu-item "Quit" 'keyboard-escape-quit
|
|
|
|
|
:help "Abort input and exit minibuffer"))
|
|
|
|
|
(define-key map [menu-bar minibuf return]
|
|
|
|
|
(list 'menu-item "Enter" 'exit-minibuffer
|
|
|
|
|
:help "Terminate input and exit minibuffer")))
|
1995-06-29 03:11:37 +00:00
|
|
|
|
|
2002-02-19 10:30:30 +00:00
|
|
|
|
(defcustom menu-bar-mode t
|
1999-11-26 17:33:31 +00:00
|
|
|
|
"Toggle display of a menu bar on each frame.
|
|
|
|
|
Setting this variable directly does not take effect;
|
|
|
|
|
use either \\[customize] or the function `menu-bar-mode'."
|
|
|
|
|
:set (lambda (symbol value)
|
|
|
|
|
(menu-bar-mode (or value 0)))
|
|
|
|
|
:initialize 'custom-initialize-default
|
|
|
|
|
:type 'boolean
|
|
|
|
|
:group 'frames)
|
1994-06-25 18:20:30 +00:00
|
|
|
|
|
2001-12-10 20:39:26 +00:00
|
|
|
|
(defun menu-bar-mode (&optional flag)
|
1993-05-24 05:06:35 +00:00
|
|
|
|
"Toggle display of a menu bar on each frame.
|
1993-05-17 04:45:03 +00:00
|
|
|
|
This command applies to all frames that exist and frames to be
|
|
|
|
|
created in the future.
|
1998-07-02 22:09:29 +00:00
|
|
|
|
With a numeric argument, if the argument is positive,
|
|
|
|
|
turn on menu bars; otherwise, turn off menu bars."
|
1993-08-06 21:06:10 +00:00
|
|
|
|
(interactive "P")
|
|
|
|
|
|
1994-06-25 18:20:30 +00:00
|
|
|
|
;; Make menu-bar-mode and default-frame-alist consistent.
|
|
|
|
|
(let ((default (assq 'menu-bar-lines default-frame-alist)))
|
|
|
|
|
(if default
|
|
|
|
|
(setq menu-bar-mode (not (eq (cdr default) 0)))
|
|
|
|
|
(setq default-frame-alist
|
|
|
|
|
(cons (cons 'menu-bar-lines (if menu-bar-mode 1 0))
|
|
|
|
|
default-frame-alist))))
|
|
|
|
|
|
|
|
|
|
;; Toggle or set the mode, according to FLAG.
|
|
|
|
|
(setq menu-bar-mode (if (null flag) (not menu-bar-mode)
|
|
|
|
|
(> (prefix-numeric-value flag) 0)))
|
|
|
|
|
|
|
|
|
|
;; Apply it to default-frame-alist.
|
|
|
|
|
(let ((parameter (assq 'menu-bar-lines default-frame-alist)))
|
|
|
|
|
(if (consp parameter)
|
|
|
|
|
(setcdr parameter (if menu-bar-mode 1 0))
|
|
|
|
|
(setq default-frame-alist
|
|
|
|
|
(cons (cons 'menu-bar-lines (if menu-bar-mode 1 0))
|
|
|
|
|
default-frame-alist))))
|
|
|
|
|
|
|
|
|
|
;; Apply it to existing frames.
|
|
|
|
|
(let ((frames (frame-list)))
|
|
|
|
|
(while frames
|
|
|
|
|
(let ((height (cdr (assq 'height (frame-parameters (car frames))))))
|
|
|
|
|
(modify-frame-parameters (car frames)
|
|
|
|
|
(list (cons 'menu-bar-lines
|
|
|
|
|
(if menu-bar-mode 1 0))))
|
|
|
|
|
(modify-frame-parameters (car frames)
|
|
|
|
|
(list (cons 'height height))))
|
|
|
|
|
(setq frames (cdr frames)))))
|
1993-04-08 07:10:13 +00:00
|
|
|
|
|
1993-05-13 03:34:18 +00:00
|
|
|
|
(provide 'menu-bar)
|
|
|
|
|
|
1993-04-08 16:17:43 +00:00
|
|
|
|
;;; menu-bar.el ends here
|