1993-04-08 16:17:43 +00:00
|
|
|
|
;;; menu-bar.el --- define a default menu bar.
|
|
|
|
|
|
1996-01-14 07:34:30 +00:00
|
|
|
|
;; Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc.
|
|
|
|
|
|
1993-04-08 16:17:43 +00:00
|
|
|
|
;; Author: RMS
|
1993-11-23 20:12:25 +00:00
|
|
|
|
;; Keywords: internal
|
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.
|
|
|
|
|
|
1996-01-14 07:34:30 +00:00
|
|
|
|
;;; Code:
|
|
|
|
|
|
1995-12-26 19:11:18 +00:00
|
|
|
|
;;; User options:
|
|
|
|
|
|
|
|
|
|
(defvar buffers-menu-max-size 10
|
|
|
|
|
"*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.
|
|
|
|
|
A large number or nil slows down menu responsiveness.")
|
|
|
|
|
|
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-search-menu (make-sparse-keymap "Search"))
|
|
|
|
|
(define-key global-map [menu-bar search] (cons "Search" menu-bar-search-menu))
|
1993-06-05 19:13:03 +00:00
|
|
|
|
(defvar menu-bar-edit-menu (make-sparse-keymap "Edit"))
|
1993-03-15 02:00:20 +00:00
|
|
|
|
(define-key global-map [menu-bar edit] (cons "Edit" menu-bar-edit-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))
|
|
|
|
|
(defvar menu-bar-files-menu (make-sparse-keymap "Files"))
|
|
|
|
|
(define-key global-map [menu-bar files] (cons "Files" 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)
|
1994-06-22 20:37:41 +00:00
|
|
|
|
|
1994-09-21 20:48:00 +00:00
|
|
|
|
(defvar vc-menu-map (make-sparse-keymap "Version Control"))
|
|
|
|
|
|
1996-12-14 22:23:58 +00:00
|
|
|
|
(define-key menu-bar-tools-menu [gdb] '("Debugger..." . gdb))
|
|
|
|
|
(define-key menu-bar-tools-menu [compile] '("Compile..." . compile))
|
|
|
|
|
(define-key menu-bar-tools-menu [grep] '("Search Files..." . grep))
|
|
|
|
|
|
|
|
|
|
(define-key menu-bar-tools-menu [separator-1]
|
|
|
|
|
'("--"))
|
|
|
|
|
|
1995-04-02 05:46:12 +00:00
|
|
|
|
(define-key menu-bar-tools-menu [calendar] '("Display Calendar" . calendar))
|
1997-02-27 00:11:29 +00:00
|
|
|
|
(define-key menu-bar-tools-menu [compose-mail] '("Send Mail" . compose-mail))
|
1995-03-19 21:11:13 +00:00
|
|
|
|
(define-key menu-bar-tools-menu [rmail] '("Read Mail" . rmail))
|
1995-11-10 17:18:23 +00:00
|
|
|
|
(define-key menu-bar-tools-menu [gnus] '("Read Net News" . gnus))
|
1995-03-19 21:11:13 +00:00
|
|
|
|
|
|
|
|
|
(define-key menu-bar-tools-menu [separator-vc]
|
|
|
|
|
'("--"))
|
|
|
|
|
|
1996-01-24 23:29:01 +00:00
|
|
|
|
(define-key menu-bar-tools-menu [vc]
|
1995-03-19 21:11:13 +00:00
|
|
|
|
(cons "Version Control" vc-menu-map))
|
1994-06-22 20:37:41 +00:00
|
|
|
|
|
1995-03-19 21:11:13 +00:00
|
|
|
|
(define-key menu-bar-tools-menu [separator-compare]
|
1994-06-22 20:37:41 +00:00
|
|
|
|
'("--"))
|
|
|
|
|
|
1995-03-19 21:11:13 +00:00
|
|
|
|
(define-key menu-bar-tools-menu [epatch]
|
1994-05-09 20:46:58 +00:00
|
|
|
|
'("Apply Patch" . menu-bar-epatch-menu))
|
1995-03-19 21:11:13 +00:00
|
|
|
|
(define-key menu-bar-tools-menu [ediff-merge]
|
1995-03-16 23:04:55 +00:00
|
|
|
|
'("Merge" . menu-bar-ediff-merge-menu))
|
1995-05-08 15:22:30 +00:00
|
|
|
|
(define-key menu-bar-tools-menu [compare]
|
1994-08-11 21:50:39 +00:00
|
|
|
|
'("Compare" . menu-bar-ediff-menu))
|
1994-06-22 20:37:41 +00:00
|
|
|
|
|
1995-03-19 21:11:13 +00:00
|
|
|
|
(define-key menu-bar-tools-menu [separator-print]
|
1994-06-22 20:37:41 +00:00
|
|
|
|
'("--"))
|
|
|
|
|
|
1995-03-19 21:11:13 +00:00
|
|
|
|
(put 'print-region 'menu-enable 'mark-active)
|
|
|
|
|
(put 'ps-print-region-with-faces 'menu-enable 'mark-active)
|
|
|
|
|
|
|
|
|
|
(define-key menu-bar-tools-menu [ps-print-region]
|
|
|
|
|
'("Postscript Print Region" . ps-print-region-with-faces))
|
|
|
|
|
(define-key menu-bar-tools-menu [ps-print-buffer]
|
|
|
|
|
'("Postscript Print Buffer" . ps-print-buffer-with-faces))
|
|
|
|
|
(define-key menu-bar-tools-menu [print-region]
|
|
|
|
|
'("Print Region" . print-region))
|
|
|
|
|
(define-key menu-bar-tools-menu [print-buffer]
|
|
|
|
|
'("Print Buffer" . print-buffer))
|
|
|
|
|
|
|
|
|
|
(define-key menu-bar-files-menu [exit-emacs]
|
|
|
|
|
'("Exit Emacs" . save-buffers-kill-emacs))
|
|
|
|
|
|
|
|
|
|
(define-key menu-bar-files-menu [separator-exit]
|
|
|
|
|
'("--"))
|
|
|
|
|
|
|
|
|
|
(define-key menu-bar-files-menu [one-window]
|
|
|
|
|
'("One Window" . delete-other-windows))
|
|
|
|
|
|
|
|
|
|
(define-key menu-bar-files-menu [split-window]
|
|
|
|
|
'("Split Window" . split-window-vertically))
|
1994-06-22 20:37:41 +00:00
|
|
|
|
|
1994-10-10 21:47:33 +00:00
|
|
|
|
(if (fboundp 'delete-frame)
|
|
|
|
|
(progn
|
1995-11-11 07:06:05 +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]
|
1994-10-10 21:47:33 +00:00
|
|
|
|
'("Delete Frame" . delete-frame))
|
1995-03-19 21:11:13 +00:00
|
|
|
|
(define-key menu-bar-files-menu [make-frame-on-display]
|
|
|
|
|
'("Open New Display..." . make-frame-on-display))
|
|
|
|
|
(define-key menu-bar-files-menu [make-frame]
|
1994-10-10 21:47:33 +00:00
|
|
|
|
'("Make New Frame" . make-frame))))
|
1994-06-22 20:37:41 +00:00
|
|
|
|
|
1995-03-19 21:11:13 +00:00
|
|
|
|
(define-key menu-bar-files-menu [separator-buffers]
|
1994-06-22 20:37:41 +00:00
|
|
|
|
'("--"))
|
|
|
|
|
|
1995-03-19 21:11:13 +00:00
|
|
|
|
(define-key menu-bar-files-menu [kill-buffer]
|
|
|
|
|
'("Kill Current Buffer" . kill-this-buffer))
|
|
|
|
|
(define-key menu-bar-files-menu [insert-file]
|
1995-04-24 15:26:19 +00:00
|
|
|
|
'("Insert File..." . insert-file))
|
1995-03-19 21:11:13 +00:00
|
|
|
|
(define-key menu-bar-files-menu [revert-buffer]
|
1993-03-15 01:05:11 +00:00
|
|
|
|
'("Revert Buffer" . revert-buffer))
|
1995-03-19 21:11:13 +00:00
|
|
|
|
(define-key menu-bar-files-menu [write-file]
|
1993-03-15 01:05:11 +00:00
|
|
|
|
'("Save Buffer As..." . write-file))
|
1995-03-19 21:11:13 +00:00
|
|
|
|
(define-key menu-bar-files-menu [save-buffer] '("Save Buffer" . save-buffer))
|
|
|
|
|
(define-key menu-bar-files-menu [dired] '("Open Directory..." . dired))
|
|
|
|
|
(define-key menu-bar-files-menu [open-file] '("Open File..." . find-file))
|
1994-08-11 21:50:39 +00:00
|
|
|
|
|
1994-06-22 20:37:41 +00:00
|
|
|
|
|
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)
|
|
|
|
|
(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)
|
|
|
|
|
(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)
|
|
|
|
|
(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)
|
|
|
|
|
(re-search-backward (car regexp-search-ring)))
|
|
|
|
|
|
1995-04-24 15:26:19 +00:00
|
|
|
|
(define-key menu-bar-search-menu [query-replace-regexp]
|
|
|
|
|
'("Query Replace Regexp..." . query-replace-regexp))
|
1995-03-19 21:11:13 +00:00
|
|
|
|
(define-key menu-bar-search-menu [query-replace]
|
1995-04-24 15:26:19 +00:00
|
|
|
|
'("Query Replace..." . query-replace))
|
1995-03-19 21:11:13 +00:00
|
|
|
|
(define-key menu-bar-search-menu [find-tag]
|
1995-04-24 15:26:19 +00:00
|
|
|
|
'("Find Tag..." . find-tag))
|
1995-03-19 21:11:13 +00:00
|
|
|
|
(define-key menu-bar-search-menu [bookmark]
|
|
|
|
|
'("Bookmarks" . menu-bar-bookmark-map))
|
|
|
|
|
|
|
|
|
|
(define-key menu-bar-search-menu [separator-search]
|
|
|
|
|
'("--"))
|
|
|
|
|
|
1996-01-24 23:29:01 +00:00
|
|
|
|
(define-key menu-bar-search-menu [repeat-regexp-back]
|
1995-03-19 21:11:13 +00:00
|
|
|
|
'("Repeat Regexp Backwards" . nonincremental-repeat-re-search-backward))
|
1996-01-24 23:29:01 +00:00
|
|
|
|
(define-key menu-bar-search-menu [repeat-search-back]
|
1995-03-19 21:11:13 +00:00
|
|
|
|
'("Repeat Backwards" . nonincremental-repeat-search-backward))
|
1996-01-24 23:29:01 +00:00
|
|
|
|
(define-key menu-bar-search-menu [repeat-regexp-fwd]
|
1995-03-19 21:11:13 +00:00
|
|
|
|
'("Repeat Regexp" . nonincremental-repeat-re-search-forward))
|
1996-01-24 23:29:01 +00:00
|
|
|
|
(define-key menu-bar-search-menu [repeat-search-fwd]
|
1995-03-19 21:11:13 +00:00
|
|
|
|
'("Repeat Search" . nonincremental-repeat-search-forward))
|
|
|
|
|
|
|
|
|
|
(define-key menu-bar-search-menu [separator-repeat]
|
1994-06-22 20:37:41 +00:00
|
|
|
|
'("--"))
|
|
|
|
|
|
1996-01-24 23:29:01 +00:00
|
|
|
|
(define-key menu-bar-search-menu [re-search-backward]
|
1995-04-24 15:26:19 +00:00
|
|
|
|
'("Regexp Search Backwards..." . nonincremental-re-search-backward))
|
1996-01-24 23:29:01 +00:00
|
|
|
|
(define-key menu-bar-search-menu [search-backward]
|
1995-04-24 15:26:19 +00:00
|
|
|
|
'("Search Backwards..." . nonincremental-search-backward))
|
1996-01-24 23:29:01 +00:00
|
|
|
|
(define-key menu-bar-search-menu [re-search-forward]
|
1995-04-24 15:26:19 +00:00
|
|
|
|
'("Regexp Search..." . nonincremental-re-search-forward))
|
1996-01-24 23:29:01 +00:00
|
|
|
|
(define-key menu-bar-search-menu [search-forward]
|
1995-04-24 15:26:19 +00:00
|
|
|
|
'("Search..." . nonincremental-search-forward))
|
1995-03-19 21:11:13 +00:00
|
|
|
|
|
1995-04-08 20:40:33 +00:00
|
|
|
|
(if (fboundp 'start-process)
|
|
|
|
|
(define-key menu-bar-edit-menu [spell] '("Spell" . ispell-menu-map)))
|
1994-06-22 20:37:41 +00:00
|
|
|
|
(define-key menu-bar-edit-menu [fill] '("Fill" . fill-region))
|
1995-03-25 16:02:43 +00:00
|
|
|
|
(define-key menu-bar-edit-menu [props] '("Text Properties" . facemenu-menu))
|
1994-06-22 20:37:41 +00:00
|
|
|
|
|
|
|
|
|
(define-key menu-bar-edit-menu [separator-edit]
|
|
|
|
|
'("--"))
|
|
|
|
|
|
|
|
|
|
(define-key menu-bar-edit-menu [clear] '("Clear" . delete-region))
|
1994-09-15 22:16:49 +00:00
|
|
|
|
|
1995-04-02 05:46:12 +00:00
|
|
|
|
(define-key menu-bar-edit-menu [paste] '("Paste Most Recent" . yank))
|
1994-09-15 22:16:49 +00:00
|
|
|
|
|
|
|
|
|
(defvar yank-menu (cons "Select Yank" nil))
|
|
|
|
|
(fset 'yank-menu (cons 'keymap yank-menu))
|
|
|
|
|
(define-key menu-bar-edit-menu [select-paste] '("Select and Paste" . yank-menu))
|
1995-02-12 04:54:34 +00:00
|
|
|
|
(define-key menu-bar-edit-menu [copy] '("Copy" . menu-bar-kill-ring-save))
|
1993-05-17 04:45:03 +00:00
|
|
|
|
(define-key menu-bar-edit-menu [cut] '("Cut" . kill-region))
|
|
|
|
|
(define-key menu-bar-edit-menu [undo] '("Undo" . undo))
|
|
|
|
|
|
1995-02-12 04:54:34 +00:00
|
|
|
|
(defun menu-bar-kill-ring-save (beg end)
|
|
|
|
|
(interactive "r")
|
|
|
|
|
(if (mouse-region-match)
|
|
|
|
|
(message "Select a region with the mouse does `copy' automatically")
|
|
|
|
|
(kill-ring-save beg end)))
|
|
|
|
|
|
1995-06-29 03:11:37 +00:00
|
|
|
|
(put 'fill-region 'menu-enable '(and mark-active (not buffer-read-only)))
|
|
|
|
|
(put 'kill-region 'menu-enable '(and mark-active (not buffer-read-only)))
|
1995-02-12 04:54:34 +00:00
|
|
|
|
(put 'menu-bar-kill-ring-save 'menu-enable 'mark-active)
|
1995-06-29 03:11:37 +00:00
|
|
|
|
(put 'yank 'menu-enable '(and (x-selection-exists-p) (not buffer-read-only)))
|
|
|
|
|
(put 'yank-menu 'menu-enable '(and (cdr yank-menu) (not buffer-read-only)))
|
1995-02-12 04:54:34 +00:00
|
|
|
|
(put 'delete-region 'menu-enable '(and mark-active
|
1995-06-29 03:11:37 +00:00
|
|
|
|
(not buffer-read-only)
|
1995-02-12 04:54:34 +00:00
|
|
|
|
(not (mouse-region-match))))
|
1995-06-29 03:11:37 +00:00
|
|
|
|
(put 'undo 'menu-enable '(and (not buffer-read-only)
|
|
|
|
|
(if (eq last-command 'undo)
|
|
|
|
|
pending-undo-list
|
|
|
|
|
(consp buffer-undo-list))))
|
1994-10-06 20:56:24 +00:00
|
|
|
|
(put 'query-replace 'menu-enable '(not buffer-read-only))
|
1995-06-29 03:11:37 +00:00
|
|
|
|
(put 'query-replace-regexp 'menu-enable '(not buffer-read-only))
|
1993-03-14 23:39:34 +00:00
|
|
|
|
|
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
|
|
|
|
|
'(or (x-selection-exists-p) (x-selection-exists-p 'CLIPBOARD)))
|
|
|
|
|
|
|
|
|
|
(defun clipboard-yank ()
|
|
|
|
|
"Reinsert the last stretch of killed text, or the clipboard contents."
|
|
|
|
|
(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]
|
|
|
|
|
(cons "Paste" 'clipboard-yank))
|
|
|
|
|
(define-key menu-bar-edit-menu [copy]
|
|
|
|
|
(cons "Copy" 'clipboard-kill-ring-save))
|
|
|
|
|
(define-key menu-bar-edit-menu [cut]
|
1994-07-31 03:01:00 +00:00
|
|
|
|
(cons "Cut" 'clipboard-kill-region))
|
|
|
|
|
|
|
|
|
|
(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
|
|
|
|
|
1997-04-08 22:20:30 +00:00
|
|
|
|
|
|
|
|
|
;;; Menu support
|
|
|
|
|
|
|
|
|
|
(defvar menu-bar-custom-menu (make-sparse-keymap "Customize"))
|
|
|
|
|
|
1997-05-01 22:21:19 +00:00
|
|
|
|
(define-key menu-bar-custom-menu [custom-menu-update]
|
|
|
|
|
'("Update This Menu" . custom-menu-update))
|
1997-04-08 22:20:30 +00:00
|
|
|
|
(define-key menu-bar-custom-menu [customize-apropos]
|
|
|
|
|
'("Apropos..." . customize-apropos))
|
1997-05-01 22:21:19 +00:00
|
|
|
|
(define-key menu-bar-custom-menu [customize-group]
|
|
|
|
|
'("Specific Group..." . customize-group))
|
1997-04-08 22:20:30 +00:00
|
|
|
|
(define-key menu-bar-custom-menu [customize-face]
|
1997-05-01 22:21:19 +00:00
|
|
|
|
'("Specific Face..." . customize-face))
|
|
|
|
|
(define-key menu-bar-custom-menu [customize-variable]
|
|
|
|
|
'("Specific Variable..." . customize-variable))
|
1997-04-08 22:20:30 +00:00
|
|
|
|
(define-key menu-bar-custom-menu [customize]
|
1997-05-01 22:21:19 +00:00
|
|
|
|
'("Browse Hierarchy of User Options" . customize))
|
1997-04-08 22:20:30 +00:00
|
|
|
|
|
|
|
|
|
(define-key menu-bar-help-menu [customize-menu]
|
|
|
|
|
(cons "Customize" menu-bar-custom-menu))
|
1994-04-28 04:15:32 +00:00
|
|
|
|
(define-key menu-bar-help-menu [emacs-version]
|
|
|
|
|
'("Show Version" . emacs-version))
|
1994-04-28 04:17:42 +00:00
|
|
|
|
(define-key menu-bar-help-menu [report-emacs-bug]
|
1995-05-31 19:41:49 +00:00
|
|
|
|
'("Send Bug Report..." . report-emacs-bug))
|
1995-07-17 22:51:17 +00:00
|
|
|
|
(define-key menu-bar-help-menu [finder-by-keyword]
|
|
|
|
|
'("Find Lisp Packages..." . finder-by-keyword))
|
1993-03-15 00:46:58 +00:00
|
|
|
|
(define-key menu-bar-help-menu [emacs-tutorial]
|
1993-03-14 23:39:34 +00:00
|
|
|
|
'("Emacs Tutorial" . help-with-tutorial))
|
1995-07-17 22:51:17 +00:00
|
|
|
|
(define-key menu-bar-help-menu [man]
|
|
|
|
|
'("Man..." . manual-entry))
|
1993-03-15 01:05:11 +00:00
|
|
|
|
(define-key menu-bar-help-menu [describe-variable]
|
|
|
|
|
'("Describe Variable..." . describe-variable))
|
|
|
|
|
(define-key menu-bar-help-menu [describe-function]
|
|
|
|
|
'("Describe Function..." . describe-function))
|
|
|
|
|
(define-key menu-bar-help-menu [describe-key]
|
|
|
|
|
'("Describe Key..." . describe-key))
|
|
|
|
|
(define-key menu-bar-help-menu [list-keybindings]
|
|
|
|
|
'("List Keybindings" . describe-bindings))
|
|
|
|
|
(define-key menu-bar-help-menu [command-apropos]
|
|
|
|
|
'("Command Apropos..." . command-apropos))
|
|
|
|
|
(define-key menu-bar-help-menu [describe-mode]
|
|
|
|
|
'("Describe Mode" . describe-mode))
|
1995-04-02 05:46:12 +00:00
|
|
|
|
(define-key menu-bar-help-menu [info] '("Browse Manuals" . info))
|
1995-03-06 05:19:05 +00:00
|
|
|
|
(define-key menu-bar-help-menu [emacs-faq] '("Emacs FAQ" . view-emacs-FAQ))
|
1993-03-15 01:05:11 +00:00
|
|
|
|
(define-key menu-bar-help-menu [emacs-news] '("Emacs News" . view-emacs-news))
|
1995-03-06 05:19:05 +00:00
|
|
|
|
|
1993-03-14 23:39:34 +00:00
|
|
|
|
(defun kill-this-buffer () ; for the menubar
|
|
|
|
|
"Kills the current buffer."
|
|
|
|
|
(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 'kill-this-buffer 'menu-enable '(kill-this-buffer-enabled-p))
|
|
|
|
|
|
|
|
|
|
(put 'save-buffer 'menu-enable
|
|
|
|
|
'(and (buffer-modified-p)
|
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
|
|
|
|
|
|
|
|
|
(put 'write-file '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
|
|
|
|
|
|
|
|
|
(put 'find-file '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
|
|
|
|
|
|
|
|
|
(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
|
|
|
|
|
|
|
|
|
(put 'insert-file 'menu-enable
|
1996-12-07 20:30:18 +00:00
|
|
|
|
'(not (window-minibuffer-p (frame-selected-window menu-updating-frame))))
|
1993-03-15 01:05:11 +00:00
|
|
|
|
|
1993-07-17 01:43:00 +00:00
|
|
|
|
(put 'revert-buffer 'menu-enable
|
|
|
|
|
'(or revert-buffer-function revert-buffer-insert-file-contents-function
|
|
|
|
|
(and (buffer-file-name)
|
1993-09-19 02:05:38 +00:00
|
|
|
|
(or (buffer-modified-p)
|
|
|
|
|
(not (verify-visited-file-modtime (current-buffer)))))))
|
1995-05-24 01:02:08 +00:00
|
|
|
|
|
1993-07-29 04:50:27 +00:00
|
|
|
|
;; Permit deleting frame if it would leave a visible or iconified frame.
|
|
|
|
|
(put 'delete-frame 'menu-enable
|
1995-05-24 01:02:08 +00:00
|
|
|
|
'(delete-frame-enabled-p))
|
|
|
|
|
|
|
|
|
|
(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
|
|
|
|
|
1993-03-14 23:39:34 +00:00
|
|
|
|
(put 'advertised-undo 'menu-enable
|
|
|
|
|
'(and (not (eq t buffer-undo-list))
|
|
|
|
|
(if (eq last-command 'undo)
|
1993-03-15 01:05:11 +00:00
|
|
|
|
(and (boundp 'pending-undo-list)
|
|
|
|
|
pending-undo-list)
|
|
|
|
|
buffer-undo-list)))
|
1993-06-17 04:17:21 +00:00
|
|
|
|
|
1995-01-30 00:37:22 +00:00
|
|
|
|
(defvar yank-menu-length 20
|
1994-09-15 22:16:49 +00:00
|
|
|
|
"*Maximum length to display in the yank-menu.")
|
|
|
|
|
|
|
|
|
|
(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)))
|
|
|
|
|
|
|
|
|
|
(defun menu-bar-select-yank ()
|
|
|
|
|
(interactive "*")
|
|
|
|
|
(push-mark (point))
|
|
|
|
|
(insert last-command-event))
|
1993-03-15 02:00:20 +00:00
|
|
|
|
|
1995-07-21 08:30:54 +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")))
|
1993-03-15 02:00:20 +00:00
|
|
|
|
|
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)
|
|
|
|
|
(make-frame-visible last-command-event)
|
|
|
|
|
(raise-frame last-command-event)
|
|
|
|
|
(select-frame last-command-event))
|
|
|
|
|
|
1994-10-13 18:20:15 +00:00
|
|
|
|
(defun menu-bar-update-buffers-1 (elt)
|
|
|
|
|
(cons (format
|
1994-10-23 07:45:25 +00:00
|
|
|
|
(format "%%%ds %%s%%s %%s" menu-bar-update-buffers-maxbuf)
|
1994-10-13 18:20:15 +00:00
|
|
|
|
(cdr elt)
|
|
|
|
|
(if (buffer-modified-p (car elt))
|
|
|
|
|
"*" " ")
|
|
|
|
|
(save-excursion
|
|
|
|
|
(set-buffer (car elt))
|
|
|
|
|
(if buffer-read-only "%" " "))
|
|
|
|
|
(let ((file
|
|
|
|
|
(or (buffer-file-name (car elt))
|
|
|
|
|
(save-excursion
|
|
|
|
|
(set-buffer (car elt))
|
|
|
|
|
list-buffers-directory)
|
|
|
|
|
"")))
|
|
|
|
|
(setq file (or (file-name-directory file)
|
|
|
|
|
""))
|
|
|
|
|
(if (> (length file) 20)
|
|
|
|
|
(setq file (concat "..." (substring file -17))))
|
|
|
|
|
file))
|
|
|
|
|
(car elt)))
|
|
|
|
|
|
1995-04-09 07:32:17 +00:00
|
|
|
|
(defvar menu-bar-buffers-menu-list-buffers-entry nil)
|
|
|
|
|
|
1994-04-28 03:44:48 +00:00
|
|
|
|
(defun menu-bar-update-buffers ()
|
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])
|
1994-07-24 05:34:16 +00:00
|
|
|
|
(frame-or-buffer-changed-p)
|
|
|
|
|
(let ((buffers (buffer-list))
|
|
|
|
|
(frames (frame-list))
|
1996-08-31 16:25:51 +00:00
|
|
|
|
(maxlen 0)
|
1994-07-24 05:34:16 +00:00
|
|
|
|
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
|
|
|
|
|
(cons "Select Buffer"
|
1994-10-13 18:20:15 +00:00
|
|
|
|
(let* ((buffer-list
|
|
|
|
|
(mapcar 'list buffers))
|
|
|
|
|
tail
|
1994-10-23 07:45:25 +00:00
|
|
|
|
(menu-bar-update-buffers-maxbuf 0)
|
1994-10-13 18:20:15 +00:00
|
|
|
|
alist
|
|
|
|
|
head)
|
|
|
|
|
;; Put into each element of buffer-list
|
|
|
|
|
;; the name for actual display,
|
|
|
|
|
;; perhaps truncated in the middle.
|
|
|
|
|
(setq tail buffer-list)
|
|
|
|
|
(while tail
|
|
|
|
|
(let ((name (buffer-name (car (car tail)))))
|
|
|
|
|
(setcdr (car tail)
|
|
|
|
|
(if (> (length name) 27)
|
|
|
|
|
(concat (substring name 0 12)
|
|
|
|
|
"..."
|
|
|
|
|
(substring name -12))
|
|
|
|
|
name)))
|
|
|
|
|
(setq tail (cdr tail)))
|
|
|
|
|
;; Compute the maximum length of any name.
|
|
|
|
|
(setq tail buffer-list)
|
1994-07-24 05:34:16 +00:00
|
|
|
|
(while tail
|
1994-10-13 18:20:15 +00:00
|
|
|
|
(or (eq ?\ (aref (cdr (car tail)) 0))
|
1994-10-23 07:45:25 +00:00
|
|
|
|
(setq menu-bar-update-buffers-maxbuf
|
|
|
|
|
(max menu-bar-update-buffers-maxbuf
|
1994-10-13 18:20:15 +00:00
|
|
|
|
(length (cdr (car tail))))))
|
1994-07-24 05:34:16 +00:00
|
|
|
|
(setq tail (cdr tail)))
|
1994-10-13 18:20:15 +00:00
|
|
|
|
;; Set ALIST to an alist of the form
|
|
|
|
|
;; ITEM-STRING . BUFFER
|
|
|
|
|
(setq tail buffer-list)
|
1994-07-24 05:34:16 +00:00
|
|
|
|
(while tail
|
|
|
|
|
(let ((elt (car tail)))
|
1994-10-13 18:20:15 +00:00
|
|
|
|
(or (eq ?\ (aref (cdr elt) 0))
|
1994-07-24 05:34:16 +00:00
|
|
|
|
(setq alist (cons
|
1994-10-13 18:20:15 +00:00
|
|
|
|
(menu-bar-update-buffers-1 elt)
|
1994-07-24 05:34:16 +00:00
|
|
|
|
alist)))
|
|
|
|
|
(and alist (> (length (car (car alist))) maxlen)
|
|
|
|
|
(setq maxlen (length (car (car alist))))))
|
|
|
|
|
(setq tail (cdr tail)))
|
|
|
|
|
(setq alist (nreverse alist))
|
1995-04-09 07:32:17 +00:00
|
|
|
|
;; Make the menu item for list-buffers
|
|
|
|
|
;; or reuse the one we already have.
|
|
|
|
|
;; The advantage in reusing one
|
|
|
|
|
;; is that it already has the keyboard equivalent
|
|
|
|
|
;; cached, so we save the time to look that up again.
|
|
|
|
|
(or menu-bar-buffers-menu-list-buffers-entry
|
|
|
|
|
(setq menu-bar-buffers-menu-list-buffers-entry
|
|
|
|
|
(cons
|
|
|
|
|
'list-buffers
|
|
|
|
|
(cons
|
|
|
|
|
""
|
|
|
|
|
'list-buffers))))
|
|
|
|
|
;; Update the item string for menu's new width.
|
|
|
|
|
(setcar (cdr menu-bar-buffers-menu-list-buffers-entry)
|
|
|
|
|
(concat (make-string (max (- (/ maxlen 2) 8) 0)
|
|
|
|
|
?\ )
|
|
|
|
|
"List All Buffers"))
|
|
|
|
|
;; Now make the actual list of items,
|
|
|
|
|
;; ending with the list-buffers item.
|
1994-07-24 05:34:16 +00:00
|
|
|
|
(nconc (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))
|
|
|
|
|
alist)
|
1995-04-09 07:32:17 +00:00
|
|
|
|
(list menu-bar-buffers-menu-list-buffers-entry)))))
|
1994-07-24 05:34:16 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;; Make a Frames menu if we have more than one frame.
|
|
|
|
|
(if (cdr frames)
|
1996-08-31 16:25:51 +00:00
|
|
|
|
(let ((name (concat (make-string (max (- (/ maxlen 2) 3) 0)
|
|
|
|
|
?\ )
|
|
|
|
|
"Frames"))
|
|
|
|
|
(frames-menu
|
|
|
|
|
(cons 'keymap
|
|
|
|
|
(cons "Select Frame"
|
|
|
|
|
(mapcar '(lambda (frame)
|
|
|
|
|
(nconc (list frame
|
|
|
|
|
(cdr (assq 'name
|
|
|
|
|
(frame-parameters frame)))
|
|
|
|
|
(cons nil nil))
|
|
|
|
|
'menu-bar-select-frame))
|
|
|
|
|
frames)))))
|
|
|
|
|
;; Put it underneath the Buffers menu.
|
|
|
|
|
(setq buffers-menu (cons (cons 'frames (cons name frames-menu))
|
|
|
|
|
buffers-menu))))
|
1994-07-24 05:34:16 +00:00
|
|
|
|
(if buffers-menu
|
|
|
|
|
(setq buffers-menu (cons 'keymap 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.
|
|
|
|
|
|
|
|
|
|
(mapcar
|
|
|
|
|
(function
|
|
|
|
|
(lambda (map)
|
|
|
|
|
(define-key map [menu-bar minibuf]
|
|
|
|
|
(cons "Minibuf" (make-sparse-keymap "Minibuf")))))
|
|
|
|
|
(list minibuffer-local-ns-map
|
|
|
|
|
minibuffer-local-must-match-map
|
|
|
|
|
minibuffer-local-isearch-map
|
|
|
|
|
minibuffer-local-map
|
|
|
|
|
minibuffer-local-completion-map))
|
|
|
|
|
|
|
|
|
|
(mapcar
|
|
|
|
|
(function
|
|
|
|
|
(lambda (map)
|
|
|
|
|
(define-key map [menu-bar minibuf ?\?]
|
|
|
|
|
'("List Completions" . minibuffer-completion-help))
|
|
|
|
|
(define-key map [menu-bar minibuf space]
|
|
|
|
|
'("Complete Word" . minibuffer-complete-word))
|
|
|
|
|
(define-key map [menu-bar minibuf tab]
|
1995-11-16 17:16:12 +00:00
|
|
|
|
'("Complete" . minibuffer-complete))
|
1995-06-29 03:11:37 +00:00
|
|
|
|
))
|
|
|
|
|
(list minibuffer-local-must-match-map
|
|
|
|
|
minibuffer-local-completion-map))
|
|
|
|
|
|
|
|
|
|
(mapcar
|
|
|
|
|
(function
|
|
|
|
|
(lambda (map)
|
|
|
|
|
(define-key map [menu-bar minibuf quit]
|
|
|
|
|
'("Quit" . keyboard-escape-quit))
|
|
|
|
|
(define-key map [menu-bar minibuf return]
|
|
|
|
|
'("Enter" . exit-minibuffer))
|
|
|
|
|
))
|
|
|
|
|
(list minibuffer-local-ns-map
|
|
|
|
|
minibuffer-local-must-match-map
|
|
|
|
|
minibuffer-local-isearch-map
|
|
|
|
|
minibuffer-local-map
|
|
|
|
|
minibuffer-local-completion-map))
|
|
|
|
|
|
1994-06-25 18:20:30 +00:00
|
|
|
|
(defvar menu-bar-mode nil)
|
|
|
|
|
|
1993-05-17 04:45:03 +00:00
|
|
|
|
(defun menu-bar-mode (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.
|
|
|
|
|
With a numeric argument, if the argument is negative,
|
1993-05-24 05:06:35 +00:00
|
|
|
|
turn off menu bars; otherwise, turn on 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
|