annotate lisp/menu-bar.el @ 14900:a51ddd17cdc4

(DEL): Defined. (DELTREE) [win95]: Defined. (SYS_LDFLAGS): Set executable versions to 3.10.
author Geoff Voelker <voelker@cs.washington.edu>
date Thu, 28 Mar 1996 04:40:02 +0000
parents 66a9ba81f2c4
children f0b473ee47a5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2488
278580be9b4a Added and corrected library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2485
diff changeset
1 ;;; menu-bar.el --- define a default menu bar.
278580be9b4a Added and corrected library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2485
diff changeset
2
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13871
diff changeset
3 ;; Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc.
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13871
diff changeset
4
2488
278580be9b4a Added and corrected library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2485
diff changeset
5 ;; Author: RMS
5140
9cde7d7fea1f Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 4941
diff changeset
6 ;; Keywords: internal
2488
278580be9b4a Added and corrected library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2485
diff changeset
7
2485
c34bbe650160 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 2181
diff changeset
8 ;; This file is part of GNU Emacs.
c34bbe650160 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 2181
diff changeset
9
c34bbe650160 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 2181
diff changeset
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
c34bbe650160 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 2181
diff changeset
11 ;; it under the terms of the GNU General Public License as published by
c34bbe650160 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 2181
diff changeset
12 ;; the Free Software Foundation; either version 2, or (at your option)
c34bbe650160 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 2181
diff changeset
13 ;; any later version.
c34bbe650160 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 2181
diff changeset
14
c34bbe650160 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 2181
diff changeset
15 ;; GNU Emacs is distributed in the hope that it will be useful,
c34bbe650160 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 2181
diff changeset
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
c34bbe650160 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 2181
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
c34bbe650160 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 2181
diff changeset
18 ;; GNU General Public License for more details.
c34bbe650160 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 2181
diff changeset
19
c34bbe650160 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 2181
diff changeset
20 ;; You should have received a copy of the GNU General Public License
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13871
diff changeset
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13871
diff changeset
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13871
diff changeset
23 ;; Boston, MA 02111-1307, USA.
2485
c34bbe650160 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 2181
diff changeset
24
12558
98c9ac60aa20 (menu-bar-help-menu): Add finder-by-keyword.
Karl Heuer <kwzh@gnu.org>
parents: 12434
diff changeset
25 ;; Avishai Yacobi suggested some menu rearrangements.
98c9ac60aa20 (menu-bar-help-menu): Add finder-by-keyword.
Karl Heuer <kwzh@gnu.org>
parents: 12434
diff changeset
26
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13871
diff changeset
27 ;;; Code:
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13871
diff changeset
28
13871
4b5161e903c1 (buffers-menu-max-size): Move definition to top of file.
Richard M. Stallman <rms@gnu.org>
parents: 13567
diff changeset
29 ;;; User options:
4b5161e903c1 (buffers-menu-max-size): Move definition to top of file.
Richard M. Stallman <rms@gnu.org>
parents: 13567
diff changeset
30
4b5161e903c1 (buffers-menu-max-size): Move definition to top of file.
Richard M. Stallman <rms@gnu.org>
parents: 13567
diff changeset
31 (defvar buffers-menu-max-size 10
4b5161e903c1 (buffers-menu-max-size): Move definition to top of file.
Richard M. Stallman <rms@gnu.org>
parents: 13567
diff changeset
32 "*Maximum number of entries which may appear on the Buffers menu.
4b5161e903c1 (buffers-menu-max-size): Move definition to top of file.
Richard M. Stallman <rms@gnu.org>
parents: 13567
diff changeset
33 If this is 10, then only the ten most-recently-selected buffers are shown.
4b5161e903c1 (buffers-menu-max-size): Move definition to top of file.
Richard M. Stallman <rms@gnu.org>
parents: 13567
diff changeset
34 If this is nil, then all buffers are shown.
4b5161e903c1 (buffers-menu-max-size): Move definition to top of file.
Richard M. Stallman <rms@gnu.org>
parents: 13567
diff changeset
35 A large number or nil slows down menu responsiveness.")
4b5161e903c1 (buffers-menu-max-size): Move definition to top of file.
Richard M. Stallman <rms@gnu.org>
parents: 13567
diff changeset
36
4668
12289fa93455 Don't clobber existing binding for menu-bar in global-map.
Roland McGrath <roland@gnu.org>
parents: 4628
diff changeset
37 ;; Don't clobber an existing menu-bar keymap, to preserve any menu-bar key
12289fa93455 Don't clobber existing binding for menu-bar in global-map.
Roland McGrath <roland@gnu.org>
parents: 4628
diff changeset
38 ;; definitions made in loaddefs.el.
12289fa93455 Don't clobber existing binding for menu-bar in global-map.
Roland McGrath <roland@gnu.org>
parents: 4628
diff changeset
39 (or (lookup-key global-map [menu-bar])
12289fa93455 Don't clobber existing binding for menu-bar in global-map.
Roland McGrath <roland@gnu.org>
parents: 4628
diff changeset
40 (define-key global-map [menu-bar] (make-sparse-keymap "menu-bar")))
3504
5fb4eefbd7ac (menu-bar-help-menu): Add defvar.
Richard M. Stallman <rms@gnu.org>
parents: 3500
diff changeset
41 (defvar menu-bar-help-menu (make-sparse-keymap "Help"))
11067
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
42
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
43 ;; Force Help item to come last, after the major mode's own items.
12199
5f618eea1343 (help-menu): Symbol renamed from `help'.
Karl Heuer <kwzh@gnu.org>
parents: 12041
diff changeset
44 ;; The symbol used to be called `help', but that gets confused with the
5f618eea1343 (help-menu): Symbol renamed from `help'.
Karl Heuer <kwzh@gnu.org>
parents: 12041
diff changeset
45 ;; help key.
5f618eea1343 (help-menu): Symbol renamed from `help'.
Karl Heuer <kwzh@gnu.org>
parents: 12041
diff changeset
46 (setq menu-bar-final-items '(help-menu))
11067
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
47
12199
5f618eea1343 (help-menu): Symbol renamed from `help'.
Karl Heuer <kwzh@gnu.org>
parents: 12041
diff changeset
48 (define-key global-map [menu-bar help-menu] (cons "Help" menu-bar-help-menu))
11067
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
49 (defvar menu-bar-search-menu (make-sparse-keymap "Search"))
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
50 (define-key global-map [menu-bar search] (cons "Search" menu-bar-search-menu))
3504
5fb4eefbd7ac (menu-bar-help-menu): Add defvar.
Richard M. Stallman <rms@gnu.org>
parents: 3500
diff changeset
51 (defvar menu-bar-edit-menu (make-sparse-keymap "Edit"))
2178
76da020d14f8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 2177
diff changeset
52 (define-key global-map [menu-bar edit] (cons "Edit" menu-bar-edit-menu))
11067
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
53 (defvar menu-bar-tools-menu (make-sparse-keymap "Tools"))
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
54 (define-key global-map [menu-bar tools] (cons "Tools" menu-bar-tools-menu))
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
55 (defvar menu-bar-files-menu (make-sparse-keymap "Files"))
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
56 (define-key global-map [menu-bar files] (cons "Files" menu-bar-files-menu))
11293
d24be7d7af5d (menu-bar-file-menu): Add back as alias for menu-bar-files-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11235
diff changeset
57
d24be7d7af5d (menu-bar-file-menu): Add back as alias for menu-bar-files-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11235
diff changeset
58 ;; This alias is for compatibility with 19.28 and before.
d24be7d7af5d (menu-bar-file-menu): Add back as alias for menu-bar-files-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11235
diff changeset
59 (defvar menu-bar-file-menu menu-bar-files-menu)
8010
e199eda519b5 Rearrange the edit and file menus, and add separators.
Richard M. Stallman <rms@gnu.org>
parents: 7811
diff changeset
60
8977
c8e2c62cf851 (vc-menu-map): New menu.
Richard M. Stallman <rms@gnu.org>
parents: 8809
diff changeset
61 (defvar vc-menu-map (make-sparse-keymap "Version Control"))
c8e2c62cf851 (vc-menu-map): New menu.
Richard M. Stallman <rms@gnu.org>
parents: 8809
diff changeset
62
11182
9fdd7498250f (menu-bar-edit-menu): Capitalize an item name.
Richard M. Stallman <rms@gnu.org>
parents: 11118
diff changeset
63 (define-key menu-bar-tools-menu [calendar] '("Display Calendar" . calendar))
11067
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
64 (define-key menu-bar-tools-menu [rmail] '("Read Mail" . rmail))
13475
ddf1e34018d2 (menu-bar-tools-menu): Always define GNUS entry.
Richard M. Stallman <rms@gnu.org>
parents: 13173
diff changeset
65 (define-key menu-bar-tools-menu [gnus] '("Read Net News" . gnus))
11067
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
66
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
67 (define-key menu-bar-tools-menu [separator-vc]
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
68 '("--"))
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
69
14291
3eb791861e23 (menu-bar-search-menu): Clean up key symbols.
Karl Heuer <kwzh@gnu.org>
parents: 14169
diff changeset
70 (define-key menu-bar-tools-menu [vc]
11067
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
71 (cons "Version Control" vc-menu-map))
8010
e199eda519b5 Rearrange the edit and file menus, and add separators.
Richard M. Stallman <rms@gnu.org>
parents: 7811
diff changeset
72
11067
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
73 (define-key menu-bar-tools-menu [separator-compare]
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
74 '("--"))
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
75
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
76 (define-key menu-bar-tools-menu [epatch]
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
77 '("Apply Patch" . menu-bar-epatch-menu))
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
78 (define-key menu-bar-tools-menu [ediff-merge]
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
79 '("Merge" . menu-bar-ediff-merge-menu))
11753
6a7b0b9bb6ac (menu-bar-tools-menu): Rename key to `compare'.
Richard M. Stallman <rms@gnu.org>
parents: 11525
diff changeset
80 (define-key menu-bar-tools-menu [compare]
11067
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
81 '("Compare" . menu-bar-ediff-menu))
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
82
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
83 (define-key menu-bar-tools-menu [separator-print]
8010
e199eda519b5 Rearrange the edit and file menus, and add separators.
Richard M. Stallman <rms@gnu.org>
parents: 7811
diff changeset
84 '("--"))
e199eda519b5 Rearrange the edit and file menus, and add separators.
Richard M. Stallman <rms@gnu.org>
parents: 7811
diff changeset
85
11067
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
86 (put 'print-region 'menu-enable 'mark-active)
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
87 (put 'ps-print-region-with-faces 'menu-enable 'mark-active)
8010
e199eda519b5 Rearrange the edit and file menus, and add separators.
Richard M. Stallman <rms@gnu.org>
parents: 7811
diff changeset
88
11067
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
89 (define-key menu-bar-tools-menu [ps-print-region]
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
90 '("Postscript Print Region" . ps-print-region-with-faces))
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
91 (define-key menu-bar-tools-menu [ps-print-buffer]
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
92 '("Postscript Print Buffer" . ps-print-buffer-with-faces))
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
93 (define-key menu-bar-tools-menu [print-region]
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
94 '("Print Region" . print-region))
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
95 (define-key menu-bar-tools-menu [print-buffer]
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
96 '("Print Buffer" . print-buffer))
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
97
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
98 (define-key menu-bar-files-menu [exit-emacs]
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
99 '("Exit Emacs" . save-buffers-kill-emacs))
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
100
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
101 (define-key menu-bar-files-menu [separator-exit]
8010
e199eda519b5 Rearrange the edit and file menus, and add separators.
Richard M. Stallman <rms@gnu.org>
parents: 7811
diff changeset
102 '("--"))
e199eda519b5 Rearrange the edit and file menus, and add separators.
Richard M. Stallman <rms@gnu.org>
parents: 7811
diff changeset
103
11067
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
104 (define-key menu-bar-files-menu [one-window]
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
105 '("One Window" . delete-other-windows))
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
106
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
107 (define-key menu-bar-files-menu [split-window]
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
108 '("Split Window" . split-window-vertically))
8010
e199eda519b5 Rearrange the edit and file menus, and add separators.
Richard M. Stallman <rms@gnu.org>
parents: 7811
diff changeset
109
9422
669208821120 (menu-bar-file-menu): Don't include the frame
Richard M. Stallman <rms@gnu.org>
parents: 9356
diff changeset
110 (if (fboundp 'delete-frame)
669208821120 (menu-bar-file-menu): Don't include the frame
Richard M. Stallman <rms@gnu.org>
parents: 9356
diff changeset
111 (progn
13506
6360f5543071 (delete-frame): Don't use delete-frame as event name.
Richard M. Stallman <rms@gnu.org>
parents: 13475
diff changeset
112 ;; Don't use delete-frame as event name
6360f5543071 (delete-frame): Don't use delete-frame as event name.
Richard M. Stallman <rms@gnu.org>
parents: 13475
diff changeset
113 ;; because that is a special event.
6360f5543071 (delete-frame): Don't use delete-frame as event name.
Richard M. Stallman <rms@gnu.org>
parents: 13475
diff changeset
114 (define-key menu-bar-files-menu [delete-this-frame]
9422
669208821120 (menu-bar-file-menu): Don't include the frame
Richard M. Stallman <rms@gnu.org>
parents: 9356
diff changeset
115 '("Delete Frame" . delete-frame))
11067
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
116 (define-key menu-bar-files-menu [make-frame-on-display]
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
117 '("Open New Display..." . make-frame-on-display))
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
118 (define-key menu-bar-files-menu [make-frame]
9422
669208821120 (menu-bar-file-menu): Don't include the frame
Richard M. Stallman <rms@gnu.org>
parents: 9356
diff changeset
119 '("Make New Frame" . make-frame))))
8010
e199eda519b5 Rearrange the edit and file menus, and add separators.
Richard M. Stallman <rms@gnu.org>
parents: 7811
diff changeset
120
11067
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
121 (define-key menu-bar-files-menu [separator-buffers]
8010
e199eda519b5 Rearrange the edit and file menus, and add separators.
Richard M. Stallman <rms@gnu.org>
parents: 7811
diff changeset
122 '("--"))
e199eda519b5 Rearrange the edit and file menus, and add separators.
Richard M. Stallman <rms@gnu.org>
parents: 7811
diff changeset
123
11067
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
124 (define-key menu-bar-files-menu [kill-buffer]
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
125 '("Kill Current Buffer" . kill-this-buffer))
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
126 (define-key menu-bar-files-menu [insert-file]
11525
3bd7735bba9b Disable many Files menu items in minibuffer.
Richard M. Stallman <rms@gnu.org>
parents: 11325
diff changeset
127 '("Insert File..." . insert-file))
11067
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
128 (define-key menu-bar-files-menu [revert-buffer]
2178
76da020d14f8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 2177
diff changeset
129 '("Revert Buffer" . revert-buffer))
11067
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
130 (define-key menu-bar-files-menu [write-file]
2178
76da020d14f8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 2177
diff changeset
131 '("Save Buffer As..." . write-file))
11067
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
132 (define-key menu-bar-files-menu [save-buffer] '("Save Buffer" . save-buffer))
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
133 (define-key menu-bar-files-menu [dired] '("Open Directory..." . dired))
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
134 (define-key menu-bar-files-menu [open-file] '("Open File..." . find-file))
8525
fcc070bca96d (menu-bar-file-menu): Compare Files renamed to Compare.
Richard M. Stallman <rms@gnu.org>
parents: 8391
diff changeset
135
8010
e199eda519b5 Rearrange the edit and file menus, and add separators.
Richard M. Stallman <rms@gnu.org>
parents: 7811
diff changeset
136
11067
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
137 (defun nonincremental-search-forward (string)
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
138 "Read a string and search for it nonincrementally."
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
139 (interactive "sSearch for string: ")
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
140 (if (equal string "")
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
141 (search-forward (car search-ring))
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
142 (isearch-update-ring string nil)
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
143 (search-forward string)))
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
144
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
145 (defun nonincremental-search-backward (string)
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
146 "Read a string and search backward for it nonincrementally."
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
147 (interactive "sSearch for string: ")
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
148 (if (equal string "")
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
149 (search-backward (car search-ring))
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
150 (isearch-update-ring string nil)
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
151 (search-backward string)))
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
152
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
153 (defun nonincremental-re-search-forward (string)
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
154 "Read a regular expression and search for it nonincrementally."
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
155 (interactive "sSearch for regexp: ")
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
156 (if (equal string "")
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
157 (re-search-forward (car regexp-search-ring))
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
158 (isearch-update-ring string t)
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
159 (re-search-forward string)))
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
160
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
161 (defun nonincremental-re-search-backward (string)
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
162 "Read a regular expression and search backward for it nonincrementally."
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
163 (interactive "sSearch for regexp: ")
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
164 (if (equal string "")
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
165 (re-search-backward (car regexp-search-ring))
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
166 (isearch-update-ring string t)
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
167 (re-search-backward string)))
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
168
11525
3bd7735bba9b Disable many Files menu items in minibuffer.
Richard M. Stallman <rms@gnu.org>
parents: 11325
diff changeset
169 (defun nonincremental-repeat-search-forward ()
11067
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
170 "Search forward for the previous search string."
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
171 (interactive)
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
172 (search-forward (car search-ring)))
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
173
11525
3bd7735bba9b Disable many Files menu items in minibuffer.
Richard M. Stallman <rms@gnu.org>
parents: 11325
diff changeset
174 (defun nonincremental-repeat-search-backward ()
11067
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
175 "Search backward for the previous search string."
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
176 (interactive)
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
177 (search-backward (car search-ring)))
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
178
11525
3bd7735bba9b Disable many Files menu items in minibuffer.
Richard M. Stallman <rms@gnu.org>
parents: 11325
diff changeset
179 (defun nonincremental-repeat-re-search-forward ()
11067
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
180 "Search forward for the previous regular expression."
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
181 (interactive)
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
182 (re-search-forward (car regexp-search-ring)))
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
183
11525
3bd7735bba9b Disable many Files menu items in minibuffer.
Richard M. Stallman <rms@gnu.org>
parents: 11325
diff changeset
184 (defun nonincremental-repeat-re-search-backward ()
11067
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
185 "Search backward for the previous regular expression."
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
186 (interactive)
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
187 (re-search-backward (car regexp-search-ring)))
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
188
11525
3bd7735bba9b Disable many Files menu items in minibuffer.
Richard M. Stallman <rms@gnu.org>
parents: 11325
diff changeset
189 (define-key menu-bar-search-menu [query-replace-regexp]
3bd7735bba9b Disable many Files menu items in minibuffer.
Richard M. Stallman <rms@gnu.org>
parents: 11325
diff changeset
190 '("Query Replace Regexp..." . query-replace-regexp))
11067
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
191 (define-key menu-bar-search-menu [query-replace]
11525
3bd7735bba9b Disable many Files menu items in minibuffer.
Richard M. Stallman <rms@gnu.org>
parents: 11325
diff changeset
192 '("Query Replace..." . query-replace))
11067
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
193 (define-key menu-bar-search-menu [find-tag]
11525
3bd7735bba9b Disable many Files menu items in minibuffer.
Richard M. Stallman <rms@gnu.org>
parents: 11325
diff changeset
194 '("Find Tag..." . find-tag))
11067
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
195 (define-key menu-bar-search-menu [bookmark]
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
196 '("Bookmarks" . menu-bar-bookmark-map))
8010
e199eda519b5 Rearrange the edit and file menus, and add separators.
Richard M. Stallman <rms@gnu.org>
parents: 7811
diff changeset
197
11067
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
198 (define-key menu-bar-search-menu [separator-search]
8010
e199eda519b5 Rearrange the edit and file menus, and add separators.
Richard M. Stallman <rms@gnu.org>
parents: 7811
diff changeset
199 '("--"))
e199eda519b5 Rearrange the edit and file menus, and add separators.
Richard M. Stallman <rms@gnu.org>
parents: 7811
diff changeset
200
14291
3eb791861e23 (menu-bar-search-menu): Clean up key symbols.
Karl Heuer <kwzh@gnu.org>
parents: 14169
diff changeset
201 (define-key menu-bar-search-menu [repeat-regexp-back]
11067
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
202 '("Repeat Regexp Backwards" . nonincremental-repeat-re-search-backward))
14291
3eb791861e23 (menu-bar-search-menu): Clean up key symbols.
Karl Heuer <kwzh@gnu.org>
parents: 14169
diff changeset
203 (define-key menu-bar-search-menu [repeat-search-back]
11067
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
204 '("Repeat Backwards" . nonincremental-repeat-search-backward))
14291
3eb791861e23 (menu-bar-search-menu): Clean up key symbols.
Karl Heuer <kwzh@gnu.org>
parents: 14169
diff changeset
205 (define-key menu-bar-search-menu [repeat-regexp-fwd]
11067
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
206 '("Repeat Regexp" . nonincremental-repeat-re-search-forward))
14291
3eb791861e23 (menu-bar-search-menu): Clean up key symbols.
Karl Heuer <kwzh@gnu.org>
parents: 14169
diff changeset
207 (define-key menu-bar-search-menu [repeat-search-fwd]
11067
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
208 '("Repeat Search" . nonincremental-repeat-search-forward))
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
209
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
210 (define-key menu-bar-search-menu [separator-repeat]
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
211 '("--"))
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
212
14291
3eb791861e23 (menu-bar-search-menu): Clean up key symbols.
Karl Heuer <kwzh@gnu.org>
parents: 14169
diff changeset
213 (define-key menu-bar-search-menu [re-search-backward]
11525
3bd7735bba9b Disable many Files menu items in minibuffer.
Richard M. Stallman <rms@gnu.org>
parents: 11325
diff changeset
214 '("Regexp Search Backwards..." . nonincremental-re-search-backward))
14291
3eb791861e23 (menu-bar-search-menu): Clean up key symbols.
Karl Heuer <kwzh@gnu.org>
parents: 14169
diff changeset
215 (define-key menu-bar-search-menu [search-backward]
11525
3bd7735bba9b Disable many Files menu items in minibuffer.
Richard M. Stallman <rms@gnu.org>
parents: 11325
diff changeset
216 '("Search Backwards..." . nonincremental-search-backward))
14291
3eb791861e23 (menu-bar-search-menu): Clean up key symbols.
Karl Heuer <kwzh@gnu.org>
parents: 14169
diff changeset
217 (define-key menu-bar-search-menu [re-search-forward]
11525
3bd7735bba9b Disable many Files menu items in minibuffer.
Richard M. Stallman <rms@gnu.org>
parents: 11325
diff changeset
218 '("Regexp Search..." . nonincremental-re-search-forward))
14291
3eb791861e23 (menu-bar-search-menu): Clean up key symbols.
Karl Heuer <kwzh@gnu.org>
parents: 14169
diff changeset
219 (define-key menu-bar-search-menu [search-forward]
11525
3bd7735bba9b Disable many Files menu items in minibuffer.
Richard M. Stallman <rms@gnu.org>
parents: 11325
diff changeset
220 '("Search..." . nonincremental-search-forward))
11067
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
221
11309
c584bf36429f (menu-bar-edit-menu): Don't define ispell item unless start-process is fboundp.
Richard M. Stallman <rms@gnu.org>
parents: 11293
diff changeset
222 (if (fboundp 'start-process)
c584bf36429f (menu-bar-edit-menu): Don't define ispell item unless start-process is fboundp.
Richard M. Stallman <rms@gnu.org>
parents: 11293
diff changeset
223 (define-key menu-bar-edit-menu [spell] '("Spell" . ispell-menu-map)))
8010
e199eda519b5 Rearrange the edit and file menus, and add separators.
Richard M. Stallman <rms@gnu.org>
parents: 7811
diff changeset
224 (define-key menu-bar-edit-menu [fill] '("Fill" . fill-region))
11118
238b3b5adefd Add Text Properties submenu to Edit menu.
Boris Goldowsky <boris@gnu.org>
parents: 11067
diff changeset
225 (define-key menu-bar-edit-menu [props] '("Text Properties" . facemenu-menu))
8010
e199eda519b5 Rearrange the edit and file menus, and add separators.
Richard M. Stallman <rms@gnu.org>
parents: 7811
diff changeset
226
e199eda519b5 Rearrange the edit and file menus, and add separators.
Richard M. Stallman <rms@gnu.org>
parents: 7811
diff changeset
227 (define-key menu-bar-edit-menu [separator-edit]
e199eda519b5 Rearrange the edit and file menus, and add separators.
Richard M. Stallman <rms@gnu.org>
parents: 7811
diff changeset
228 '("--"))
e199eda519b5 Rearrange the edit and file menus, and add separators.
Richard M. Stallman <rms@gnu.org>
parents: 7811
diff changeset
229
e199eda519b5 Rearrange the edit and file menus, and add separators.
Richard M. Stallman <rms@gnu.org>
parents: 7811
diff changeset
230 (define-key menu-bar-edit-menu [clear] '("Clear" . delete-region))
8767
441af4b664ac (yank-menu): New variable; kill-ring in menu format.
Karl Heuer <kwzh@gnu.org>
parents: 8525
diff changeset
231
11182
9fdd7498250f (menu-bar-edit-menu): Capitalize an item name.
Richard M. Stallman <rms@gnu.org>
parents: 11118
diff changeset
232 (define-key menu-bar-edit-menu [paste] '("Paste Most Recent" . yank))
8767
441af4b664ac (yank-menu): New variable; kill-ring in menu format.
Karl Heuer <kwzh@gnu.org>
parents: 8525
diff changeset
233
441af4b664ac (yank-menu): New variable; kill-ring in menu format.
Karl Heuer <kwzh@gnu.org>
parents: 8525
diff changeset
234 (defvar yank-menu (cons "Select Yank" nil))
441af4b664ac (yank-menu): New variable; kill-ring in menu format.
Karl Heuer <kwzh@gnu.org>
parents: 8525
diff changeset
235 (fset 'yank-menu (cons 'keymap yank-menu))
441af4b664ac (yank-menu): New variable; kill-ring in menu format.
Karl Heuer <kwzh@gnu.org>
parents: 8525
diff changeset
236 (define-key menu-bar-edit-menu [select-paste] '("Select and Paste" . yank-menu))
10721
3d056c5a8319 (menu-bar-kill-ring-save): New function--use as `copy'.
Richard M. Stallman <rms@gnu.org>
parents: 10590
diff changeset
237 (define-key menu-bar-edit-menu [copy] '("Copy" . menu-bar-kill-ring-save))
2847
01a46a8f1e1b (fill-region, kill-region, delete-region)
Richard M. Stallman <rms@gnu.org>
parents: 2765
diff changeset
238 (define-key menu-bar-edit-menu [cut] '("Cut" . kill-region))
01a46a8f1e1b (fill-region, kill-region, delete-region)
Richard M. Stallman <rms@gnu.org>
parents: 2765
diff changeset
239 (define-key menu-bar-edit-menu [undo] '("Undo" . undo))
01a46a8f1e1b (fill-region, kill-region, delete-region)
Richard M. Stallman <rms@gnu.org>
parents: 2765
diff changeset
240
10721
3d056c5a8319 (menu-bar-kill-ring-save): New function--use as `copy'.
Richard M. Stallman <rms@gnu.org>
parents: 10590
diff changeset
241 (defun menu-bar-kill-ring-save (beg end)
3d056c5a8319 (menu-bar-kill-ring-save): New function--use as `copy'.
Richard M. Stallman <rms@gnu.org>
parents: 10590
diff changeset
242 (interactive "r")
3d056c5a8319 (menu-bar-kill-ring-save): New function--use as `copy'.
Richard M. Stallman <rms@gnu.org>
parents: 10590
diff changeset
243 (if (mouse-region-match)
3d056c5a8319 (menu-bar-kill-ring-save): New function--use as `copy'.
Richard M. Stallman <rms@gnu.org>
parents: 10590
diff changeset
244 (message "Select a region with the mouse does `copy' automatically")
3d056c5a8319 (menu-bar-kill-ring-save): New function--use as `copy'.
Richard M. Stallman <rms@gnu.org>
parents: 10590
diff changeset
245 (kill-ring-save beg end)))
3d056c5a8319 (menu-bar-kill-ring-save): New function--use as `copy'.
Richard M. Stallman <rms@gnu.org>
parents: 10590
diff changeset
246
12427
04bcad1807b9 Make more menu-enables check (not buffer-read-only).
Richard M. Stallman <rms@gnu.org>
parents: 12199
diff changeset
247 (put 'fill-region 'menu-enable '(and mark-active (not buffer-read-only)))
04bcad1807b9 Make more menu-enables check (not buffer-read-only).
Richard M. Stallman <rms@gnu.org>
parents: 12199
diff changeset
248 (put 'kill-region 'menu-enable '(and mark-active (not buffer-read-only)))
10721
3d056c5a8319 (menu-bar-kill-ring-save): New function--use as `copy'.
Richard M. Stallman <rms@gnu.org>
parents: 10590
diff changeset
249 (put 'menu-bar-kill-ring-save 'menu-enable 'mark-active)
12427
04bcad1807b9 Make more menu-enables check (not buffer-read-only).
Richard M. Stallman <rms@gnu.org>
parents: 12199
diff changeset
250 (put 'yank 'menu-enable '(and (x-selection-exists-p) (not buffer-read-only)))
04bcad1807b9 Make more menu-enables check (not buffer-read-only).
Richard M. Stallman <rms@gnu.org>
parents: 12199
diff changeset
251 (put 'yank-menu 'menu-enable '(and (cdr yank-menu) (not buffer-read-only)))
10721
3d056c5a8319 (menu-bar-kill-ring-save): New function--use as `copy'.
Richard M. Stallman <rms@gnu.org>
parents: 10590
diff changeset
252 (put 'delete-region 'menu-enable '(and mark-active
12427
04bcad1807b9 Make more menu-enables check (not buffer-read-only).
Richard M. Stallman <rms@gnu.org>
parents: 12199
diff changeset
253 (not buffer-read-only)
10721
3d056c5a8319 (menu-bar-kill-ring-save): New function--use as `copy'.
Richard M. Stallman <rms@gnu.org>
parents: 10590
diff changeset
254 (not (mouse-region-match))))
12427
04bcad1807b9 Make more menu-enables check (not buffer-read-only).
Richard M. Stallman <rms@gnu.org>
parents: 12199
diff changeset
255 (put 'undo 'menu-enable '(and (not buffer-read-only)
04bcad1807b9 Make more menu-enables check (not buffer-read-only).
Richard M. Stallman <rms@gnu.org>
parents: 12199
diff changeset
256 (if (eq last-command 'undo)
04bcad1807b9 Make more menu-enables check (not buffer-read-only).
Richard M. Stallman <rms@gnu.org>
parents: 12199
diff changeset
257 pending-undo-list
04bcad1807b9 Make more menu-enables check (not buffer-read-only).
Richard M. Stallman <rms@gnu.org>
parents: 12199
diff changeset
258 (consp buffer-undo-list))))
9356
28c6c3d7efb4 (query-replace): Add missing quote.
Richard M. Stallman <rms@gnu.org>
parents: 8977
diff changeset
259 (put 'query-replace 'menu-enable '(not buffer-read-only))
12427
04bcad1807b9 Make more menu-enables check (not buffer-read-only).
Richard M. Stallman <rms@gnu.org>
parents: 12199
diff changeset
260 (put 'query-replace-regexp 'menu-enable '(not buffer-read-only))
2175
61d3483521d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
261
4061
7279958409fe (ispell-menu-map): New autoload definition.
Richard M. Stallman <rms@gnu.org>
parents: 4048
diff changeset
262 (autoload 'ispell-menu-map "ispell" nil t 'keymap)
7279958409fe (ispell-menu-map): New autoload definition.
Richard M. Stallman <rms@gnu.org>
parents: 4048
diff changeset
263
6699
59e74bc34228 (clipboard-yank, clipboard-kill-ring-save)
Richard M. Stallman <rms@gnu.org>
parents: 6513
diff changeset
264 ;; These are alternative definitions for the cut, paste and copy
10721
3d056c5a8319 (menu-bar-kill-ring-save): New function--use as `copy'.
Richard M. Stallman <rms@gnu.org>
parents: 10590
diff changeset
265 ;; menu items. Use them if your system expects these to use the clipboard.
6699
59e74bc34228 (clipboard-yank, clipboard-kill-ring-save)
Richard M. Stallman <rms@gnu.org>
parents: 6513
diff changeset
266
59e74bc34228 (clipboard-yank, clipboard-kill-ring-save)
Richard M. Stallman <rms@gnu.org>
parents: 6513
diff changeset
267 (put 'clipboard-kill-region 'menu-enable 'mark-active)
59e74bc34228 (clipboard-yank, clipboard-kill-ring-save)
Richard M. Stallman <rms@gnu.org>
parents: 6513
diff changeset
268 (put 'clipboard-kill-ring-save 'menu-enable 'mark-active)
59e74bc34228 (clipboard-yank, clipboard-kill-ring-save)
Richard M. Stallman <rms@gnu.org>
parents: 6513
diff changeset
269 (put 'clipboard-yank 'menu-enable
59e74bc34228 (clipboard-yank, clipboard-kill-ring-save)
Richard M. Stallman <rms@gnu.org>
parents: 6513
diff changeset
270 '(or (x-selection-exists-p) (x-selection-exists-p 'CLIPBOARD)))
59e74bc34228 (clipboard-yank, clipboard-kill-ring-save)
Richard M. Stallman <rms@gnu.org>
parents: 6513
diff changeset
271
59e74bc34228 (clipboard-yank, clipboard-kill-ring-save)
Richard M. Stallman <rms@gnu.org>
parents: 6513
diff changeset
272 (defun clipboard-yank ()
59e74bc34228 (clipboard-yank, clipboard-kill-ring-save)
Richard M. Stallman <rms@gnu.org>
parents: 6513
diff changeset
273 "Reinsert the last stretch of killed text, or the clipboard contents."
59e74bc34228 (clipboard-yank, clipboard-kill-ring-save)
Richard M. Stallman <rms@gnu.org>
parents: 6513
diff changeset
274 (interactive)
59e74bc34228 (clipboard-yank, clipboard-kill-ring-save)
Richard M. Stallman <rms@gnu.org>
parents: 6513
diff changeset
275 (let ((x-select-enable-clipboard t))
59e74bc34228 (clipboard-yank, clipboard-kill-ring-save)
Richard M. Stallman <rms@gnu.org>
parents: 6513
diff changeset
276 (yank)))
59e74bc34228 (clipboard-yank, clipboard-kill-ring-save)
Richard M. Stallman <rms@gnu.org>
parents: 6513
diff changeset
277
59e74bc34228 (clipboard-yank, clipboard-kill-ring-save)
Richard M. Stallman <rms@gnu.org>
parents: 6513
diff changeset
278 (defun clipboard-kill-ring-save (beg end)
59e74bc34228 (clipboard-yank, clipboard-kill-ring-save)
Richard M. Stallman <rms@gnu.org>
parents: 6513
diff changeset
279 "Copy region to kill ring, and save in the X clipboard."
59e74bc34228 (clipboard-yank, clipboard-kill-ring-save)
Richard M. Stallman <rms@gnu.org>
parents: 6513
diff changeset
280 (interactive "r")
59e74bc34228 (clipboard-yank, clipboard-kill-ring-save)
Richard M. Stallman <rms@gnu.org>
parents: 6513
diff changeset
281 (let ((x-select-enable-clipboard t))
59e74bc34228 (clipboard-yank, clipboard-kill-ring-save)
Richard M. Stallman <rms@gnu.org>
parents: 6513
diff changeset
282 (kill-ring-save beg end)))
59e74bc34228 (clipboard-yank, clipboard-kill-ring-save)
Richard M. Stallman <rms@gnu.org>
parents: 6513
diff changeset
283
59e74bc34228 (clipboard-yank, clipboard-kill-ring-save)
Richard M. Stallman <rms@gnu.org>
parents: 6513
diff changeset
284 (defun clipboard-kill-region (beg end)
59e74bc34228 (clipboard-yank, clipboard-kill-ring-save)
Richard M. Stallman <rms@gnu.org>
parents: 6513
diff changeset
285 "Kill the region, and save it in the X clipboard."
59e74bc34228 (clipboard-yank, clipboard-kill-ring-save)
Richard M. Stallman <rms@gnu.org>
parents: 6513
diff changeset
286 (interactive "r")
59e74bc34228 (clipboard-yank, clipboard-kill-ring-save)
Richard M. Stallman <rms@gnu.org>
parents: 6513
diff changeset
287 (let ((x-select-enable-clipboard t))
59e74bc34228 (clipboard-yank, clipboard-kill-ring-save)
Richard M. Stallman <rms@gnu.org>
parents: 6513
diff changeset
288 (kill-region beg end)))
59e74bc34228 (clipboard-yank, clipboard-kill-ring-save)
Richard M. Stallman <rms@gnu.org>
parents: 6513
diff changeset
289
59e74bc34228 (clipboard-yank, clipboard-kill-ring-save)
Richard M. Stallman <rms@gnu.org>
parents: 6513
diff changeset
290 (defun menu-bar-enable-clipboard ()
8391
bb9718e6e844 (menu-bar-enable-clipboard): Moved here the
Richard M. Stallman <rms@gnu.org>
parents: 8347
diff changeset
291 "Make CUT, PASTE and COPY (keys and menu bar items) use the clipboard.
bb9718e6e844 (menu-bar-enable-clipboard): Moved here the
Richard M. Stallman <rms@gnu.org>
parents: 8347
diff changeset
292 Do the same for the keys of the same name."
6699
59e74bc34228 (clipboard-yank, clipboard-kill-ring-save)
Richard M. Stallman <rms@gnu.org>
parents: 6513
diff changeset
293 (interactive)
6948
54b252f540ea (menu-bar-enable-clipboard): Construct new cons cells.
Richard M. Stallman <rms@gnu.org>
parents: 6843
diff changeset
294 ;; We can't use constant list structure here because it becomes pure,
54b252f540ea (menu-bar-enable-clipboard): Construct new cons cells.
Richard M. Stallman <rms@gnu.org>
parents: 6843
diff changeset
295 ;; and because it gets modified with cache data.
54b252f540ea (menu-bar-enable-clipboard): Construct new cons cells.
Richard M. Stallman <rms@gnu.org>
parents: 6843
diff changeset
296 (define-key menu-bar-edit-menu [paste]
54b252f540ea (menu-bar-enable-clipboard): Construct new cons cells.
Richard M. Stallman <rms@gnu.org>
parents: 6843
diff changeset
297 (cons "Paste" 'clipboard-yank))
54b252f540ea (menu-bar-enable-clipboard): Construct new cons cells.
Richard M. Stallman <rms@gnu.org>
parents: 6843
diff changeset
298 (define-key menu-bar-edit-menu [copy]
54b252f540ea (menu-bar-enable-clipboard): Construct new cons cells.
Richard M. Stallman <rms@gnu.org>
parents: 6843
diff changeset
299 (cons "Copy" 'clipboard-kill-ring-save))
54b252f540ea (menu-bar-enable-clipboard): Construct new cons cells.
Richard M. Stallman <rms@gnu.org>
parents: 6843
diff changeset
300 (define-key menu-bar-edit-menu [cut]
8391
bb9718e6e844 (menu-bar-enable-clipboard): Moved here the
Richard M. Stallman <rms@gnu.org>
parents: 8347
diff changeset
301 (cons "Cut" 'clipboard-kill-region))
6745
469d679ca338 (global-map): Bind function keys f16, f18 and f20,
Richard M. Stallman <rms@gnu.org>
parents: 6699
diff changeset
302
8391
bb9718e6e844 (menu-bar-enable-clipboard): Moved here the
Richard M. Stallman <rms@gnu.org>
parents: 8347
diff changeset
303 (define-key global-map [f20] 'clipboard-kill-region)
bb9718e6e844 (menu-bar-enable-clipboard): Moved here the
Richard M. Stallman <rms@gnu.org>
parents: 8347
diff changeset
304 (define-key global-map [f16] 'clipboard-kill-ring-save)
bb9718e6e844 (menu-bar-enable-clipboard): Moved here the
Richard M. Stallman <rms@gnu.org>
parents: 8347
diff changeset
305 (define-key global-map [f18] 'clipboard-yank)
bb9718e6e844 (menu-bar-enable-clipboard): Moved here the
Richard M. Stallman <rms@gnu.org>
parents: 8347
diff changeset
306 ;; X11R6 versions
bb9718e6e844 (menu-bar-enable-clipboard): Moved here the
Richard M. Stallman <rms@gnu.org>
parents: 8347
diff changeset
307 (define-key global-map [cut] 'clipboard-kill-region)
bb9718e6e844 (menu-bar-enable-clipboard): Moved here the
Richard M. Stallman <rms@gnu.org>
parents: 8347
diff changeset
308 (define-key global-map [copy] 'clipboard-kill-ring-save)
bb9718e6e844 (menu-bar-enable-clipboard): Moved here the
Richard M. Stallman <rms@gnu.org>
parents: 8347
diff changeset
309 (define-key global-map [paste] 'clipboard-yank))
6699
59e74bc34228 (clipboard-yank, clipboard-kill-ring-save)
Richard M. Stallman <rms@gnu.org>
parents: 6513
diff changeset
310
7153
4e0683b070f8 (menu-bar-help-menu): Add item for emacs-version.
Richard M. Stallman <rms@gnu.org>
parents: 7150
diff changeset
311 (define-key menu-bar-help-menu [emacs-version]
4e0683b070f8 (menu-bar-help-menu): Add item for emacs-version.
Richard M. Stallman <rms@gnu.org>
parents: 7150
diff changeset
312 '("Show Version" . emacs-version))
7154
47987d8aba3d (menu-bar-help-menu): Add item for report-emacs-bug.
Richard M. Stallman <rms@gnu.org>
parents: 7153
diff changeset
313 (define-key menu-bar-help-menu [report-emacs-bug]
12041
b0970a642589 (menu-bar-help-menu): Add "..."
Karl Heuer <kwzh@gnu.org>
parents: 11891
diff changeset
314 '("Send Bug Report..." . report-emacs-bug))
12558
98c9ac60aa20 (menu-bar-help-menu): Add finder-by-keyword.
Karl Heuer <kwzh@gnu.org>
parents: 12434
diff changeset
315 (define-key menu-bar-help-menu [finder-by-keyword]
98c9ac60aa20 (menu-bar-help-menu): Add finder-by-keyword.
Karl Heuer <kwzh@gnu.org>
parents: 12434
diff changeset
316 '("Find Lisp Packages..." . finder-by-keyword))
2178
76da020d14f8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 2177
diff changeset
317 (define-key menu-bar-help-menu [emacs-tutorial]
76da020d14f8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 2177
diff changeset
318 '("Emacs Tutorial" . help-with-tutorial))
12558
98c9ac60aa20 (menu-bar-help-menu): Add finder-by-keyword.
Karl Heuer <kwzh@gnu.org>
parents: 12434
diff changeset
319 (define-key menu-bar-help-menu [man]
98c9ac60aa20 (menu-bar-help-menu): Add finder-by-keyword.
Karl Heuer <kwzh@gnu.org>
parents: 12434
diff changeset
320 '("Man..." . manual-entry))
2178
76da020d14f8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 2177
diff changeset
321 (define-key menu-bar-help-menu [describe-variable]
76da020d14f8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 2177
diff changeset
322 '("Describe Variable..." . describe-variable))
76da020d14f8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 2177
diff changeset
323 (define-key menu-bar-help-menu [describe-function]
76da020d14f8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 2177
diff changeset
324 '("Describe Function..." . describe-function))
76da020d14f8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 2177
diff changeset
325 (define-key menu-bar-help-menu [describe-key]
76da020d14f8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 2177
diff changeset
326 '("Describe Key..." . describe-key))
76da020d14f8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 2177
diff changeset
327 (define-key menu-bar-help-menu [list-keybindings]
76da020d14f8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 2177
diff changeset
328 '("List Keybindings" . describe-bindings))
2177
942a63709e37 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 2175
diff changeset
329 (define-key menu-bar-help-menu [command-apropos]
2175
61d3483521d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
330 '("Command Apropos..." . command-apropos))
2178
76da020d14f8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 2177
diff changeset
331 (define-key menu-bar-help-menu [describe-mode]
76da020d14f8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 2177
diff changeset
332 '("Describe Mode" . describe-mode))
11182
9fdd7498250f (menu-bar-edit-menu): Capitalize an item name.
Richard M. Stallman <rms@gnu.org>
parents: 11118
diff changeset
333 (define-key menu-bar-help-menu [info] '("Browse Manuals" . info))
10924
0d6841b9a132 (menu-bar-help-menu): Binding for view-emacs-FAQ.
Richard M. Stallman <rms@gnu.org>
parents: 10721
diff changeset
334 (define-key menu-bar-help-menu [emacs-faq] '("Emacs FAQ" . view-emacs-FAQ))
0d6841b9a132 (menu-bar-help-menu): Binding for view-emacs-FAQ.
Richard M. Stallman <rms@gnu.org>
parents: 10721
diff changeset
335 (define-key menu-bar-help-menu [emacs-news] '("Emacs News" . view-emacs-news))
2178
76da020d14f8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 2177
diff changeset
336
2175
61d3483521d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
337 (defun kill-this-buffer () ; for the menubar
61d3483521d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
338 "Kills the current buffer."
61d3483521d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
339 (interactive)
61d3483521d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
340 (kill-buffer (current-buffer)))
61d3483521d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
341
2178
76da020d14f8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 2177
diff changeset
342 (defun kill-this-buffer-enabled-p ()
76da020d14f8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 2177
diff changeset
343 (let ((count 0)
76da020d14f8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 2177
diff changeset
344 (buffers (buffer-list)))
76da020d14f8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 2177
diff changeset
345 (while buffers
76da020d14f8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 2177
diff changeset
346 (or (string-match "^ " (buffer-name (car buffers)))
76da020d14f8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 2177
diff changeset
347 (setq count (1+ count)))
76da020d14f8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 2177
diff changeset
348 (setq buffers (cdr buffers)))
11525
3bd7735bba9b Disable many Files menu items in minibuffer.
Richard M. Stallman <rms@gnu.org>
parents: 11325
diff changeset
349 (and (not (window-minibuffer-p (selected-window)))
3bd7735bba9b Disable many Files menu items in minibuffer.
Richard M. Stallman <rms@gnu.org>
parents: 11325
diff changeset
350 (> count 1))))
3bd7735bba9b Disable many Files menu items in minibuffer.
Richard M. Stallman <rms@gnu.org>
parents: 11325
diff changeset
351
3bd7735bba9b Disable many Files menu items in minibuffer.
Richard M. Stallman <rms@gnu.org>
parents: 11325
diff changeset
352 (put 'kill-this-buffer 'menu-enable '(kill-this-buffer-enabled-p))
3bd7735bba9b Disable many Files menu items in minibuffer.
Richard M. Stallman <rms@gnu.org>
parents: 11325
diff changeset
353
3bd7735bba9b Disable many Files menu items in minibuffer.
Richard M. Stallman <rms@gnu.org>
parents: 11325
diff changeset
354 (put 'save-buffer 'menu-enable
3bd7735bba9b Disable many Files menu items in minibuffer.
Richard M. Stallman <rms@gnu.org>
parents: 11325
diff changeset
355 '(and (buffer-modified-p)
3bd7735bba9b Disable many Files menu items in minibuffer.
Richard M. Stallman <rms@gnu.org>
parents: 11325
diff changeset
356 (not (window-minibuffer-p (selected-window)))))
2178
76da020d14f8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 2177
diff changeset
357
11525
3bd7735bba9b Disable many Files menu items in minibuffer.
Richard M. Stallman <rms@gnu.org>
parents: 11325
diff changeset
358 (put 'write-file 'menu-enable
3bd7735bba9b Disable many Files menu items in minibuffer.
Richard M. Stallman <rms@gnu.org>
parents: 11325
diff changeset
359 '(not (window-minibuffer-p (selected-window))))
3bd7735bba9b Disable many Files menu items in minibuffer.
Richard M. Stallman <rms@gnu.org>
parents: 11325
diff changeset
360
3bd7735bba9b Disable many Files menu items in minibuffer.
Richard M. Stallman <rms@gnu.org>
parents: 11325
diff changeset
361 (put 'find-file 'menu-enable
3bd7735bba9b Disable many Files menu items in minibuffer.
Richard M. Stallman <rms@gnu.org>
parents: 11325
diff changeset
362 '(not (window-minibuffer-p (selected-window))))
3bd7735bba9b Disable many Files menu items in minibuffer.
Richard M. Stallman <rms@gnu.org>
parents: 11325
diff changeset
363
3bd7735bba9b Disable many Files menu items in minibuffer.
Richard M. Stallman <rms@gnu.org>
parents: 11325
diff changeset
364 (put 'dired 'menu-enable
3bd7735bba9b Disable many Files menu items in minibuffer.
Richard M. Stallman <rms@gnu.org>
parents: 11325
diff changeset
365 '(not (window-minibuffer-p (selected-window))))
3bd7735bba9b Disable many Files menu items in minibuffer.
Richard M. Stallman <rms@gnu.org>
parents: 11325
diff changeset
366
3bd7735bba9b Disable many Files menu items in minibuffer.
Richard M. Stallman <rms@gnu.org>
parents: 11325
diff changeset
367 (put 'insert-file 'menu-enable
3bd7735bba9b Disable many Files menu items in minibuffer.
Richard M. Stallman <rms@gnu.org>
parents: 11325
diff changeset
368 '(not (window-minibuffer-p (selected-window))))
3bd7735bba9b Disable many Files menu items in minibuffer.
Richard M. Stallman <rms@gnu.org>
parents: 11325
diff changeset
369
4114
5746e25610f8 (revert-buffer): Make menu-enable form more accurate
Richard M. Stallman <rms@gnu.org>
parents: 4101
diff changeset
370 (put 'revert-buffer 'menu-enable
5746e25610f8 (revert-buffer): Make menu-enable form more accurate
Richard M. Stallman <rms@gnu.org>
parents: 4101
diff changeset
371 '(or revert-buffer-function revert-buffer-insert-file-contents-function
5746e25610f8 (revert-buffer): Make menu-enable form more accurate
Richard M. Stallman <rms@gnu.org>
parents: 4101
diff changeset
372 (and (buffer-file-name)
4742
cafb372921c3 (revert-buffer): Enable menu item when the buffer is modified.
Roland McGrath <roland@gnu.org>
parents: 4668
diff changeset
373 (or (buffer-modified-p)
cafb372921c3 (revert-buffer): Enable menu item when the buffer is modified.
Roland McGrath <roland@gnu.org>
parents: 4668
diff changeset
374 (not (verify-visited-file-modtime (current-buffer)))))))
11891
937c7fced6ee (delete-frame-enabled-p): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents: 11753
diff changeset
375
4337
cda282328afd (delete-frame): Permit it, if > 1 frame is vis or iconic.
Richard M. Stallman <rms@gnu.org>
parents: 4160
diff changeset
376 ;; Permit deleting frame if it would leave a visible or iconified frame.
cda282328afd (delete-frame): Permit it, if > 1 frame is vis or iconic.
Richard M. Stallman <rms@gnu.org>
parents: 4160
diff changeset
377 (put 'delete-frame 'menu-enable
11891
937c7fced6ee (delete-frame-enabled-p): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents: 11753
diff changeset
378 '(delete-frame-enabled-p))
937c7fced6ee (delete-frame-enabled-p): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents: 11753
diff changeset
379
937c7fced6ee (delete-frame-enabled-p): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents: 11753
diff changeset
380 (defun delete-frame-enabled-p ()
937c7fced6ee (delete-frame-enabled-p): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents: 11753
diff changeset
381 "Return non-nil if `delete-frame' should be enabled in the menu bar."
937c7fced6ee (delete-frame-enabled-p): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents: 11753
diff changeset
382 (let ((frames (frame-list))
937c7fced6ee (delete-frame-enabled-p): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents: 11753
diff changeset
383 (count 0))
937c7fced6ee (delete-frame-enabled-p): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents: 11753
diff changeset
384 (while frames
937c7fced6ee (delete-frame-enabled-p): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents: 11753
diff changeset
385 (if (frame-visible-p (car frames))
937c7fced6ee (delete-frame-enabled-p): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents: 11753
diff changeset
386 (setq count (1+ count)))
937c7fced6ee (delete-frame-enabled-p): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents: 11753
diff changeset
387 (setq frames (cdr frames)))
937c7fced6ee (delete-frame-enabled-p): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents: 11753
diff changeset
388 (> count 1)))
2178
76da020d14f8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 2177
diff changeset
389
2175
61d3483521d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
390 (put 'advertised-undo 'menu-enable
61d3483521d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
391 '(and (not (eq t buffer-undo-list))
61d3483521d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
392 (if (eq last-command 'undo)
2178
76da020d14f8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 2177
diff changeset
393 (and (boundp 'pending-undo-list)
76da020d14f8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 2177
diff changeset
394 pending-undo-list)
76da020d14f8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 2177
diff changeset
395 buffer-undo-list)))
3795
d59af8c9bc65 (mouse-menu-choose-yank): New function. Put it in the edit menu.
Richard M. Stallman <rms@gnu.org>
parents: 3504
diff changeset
396
10590
9f68d8d6357b (menu-bar-update-yank-menu): If string is too long,
Richard M. Stallman <rms@gnu.org>
parents: 9667
diff changeset
397 (defvar yank-menu-length 20
8767
441af4b664ac (yank-menu): New variable; kill-ring in menu format.
Karl Heuer <kwzh@gnu.org>
parents: 8525
diff changeset
398 "*Maximum length to display in the yank-menu.")
3795
d59af8c9bc65 (mouse-menu-choose-yank): New function. Put it in the edit menu.
Richard M. Stallman <rms@gnu.org>
parents: 3504
diff changeset
399
8767
441af4b664ac (yank-menu): New variable; kill-ring in menu format.
Karl Heuer <kwzh@gnu.org>
parents: 8525
diff changeset
400 (defun menu-bar-update-yank-menu (string old)
441af4b664ac (yank-menu): New variable; kill-ring in menu format.
Karl Heuer <kwzh@gnu.org>
parents: 8525
diff changeset
401 (let ((front (car (cdr yank-menu)))
441af4b664ac (yank-menu): New variable; kill-ring in menu format.
Karl Heuer <kwzh@gnu.org>
parents: 8525
diff changeset
402 (menu-string (if (<= (length string) yank-menu-length)
441af4b664ac (yank-menu): New variable; kill-ring in menu format.
Karl Heuer <kwzh@gnu.org>
parents: 8525
diff changeset
403 string
10590
9f68d8d6357b (menu-bar-update-yank-menu): If string is too long,
Richard M. Stallman <rms@gnu.org>
parents: 9667
diff changeset
404 (concat
9f68d8d6357b (menu-bar-update-yank-menu): If string is too long,
Richard M. Stallman <rms@gnu.org>
parents: 9667
diff changeset
405 (substring string 0 (/ yank-menu-length 2))
9f68d8d6357b (menu-bar-update-yank-menu): If string is too long,
Richard M. Stallman <rms@gnu.org>
parents: 9667
diff changeset
406 "..."
9f68d8d6357b (menu-bar-update-yank-menu): If string is too long,
Richard M. Stallman <rms@gnu.org>
parents: 9667
diff changeset
407 (substring string (- (/ yank-menu-length 2)))))))
12610
2e1cc7fae2ba (menu-bar-update-yank-menu): Treat all-dashes specially.
Richard M. Stallman <rms@gnu.org>
parents: 12588
diff changeset
408 ;; Don't let the menu string be all dashes
2e1cc7fae2ba (menu-bar-update-yank-menu): Treat all-dashes specially.
Richard M. Stallman <rms@gnu.org>
parents: 12588
diff changeset
409 ;; because that has a special meaning in a menu.
2e1cc7fae2ba (menu-bar-update-yank-menu): Treat all-dashes specially.
Richard M. Stallman <rms@gnu.org>
parents: 12588
diff changeset
410 (if (string-match "\\`-+\\'" menu-string)
2e1cc7fae2ba (menu-bar-update-yank-menu): Treat all-dashes specially.
Richard M. Stallman <rms@gnu.org>
parents: 12588
diff changeset
411 (setq menu-string (concat menu-string " ")))
8767
441af4b664ac (yank-menu): New variable; kill-ring in menu format.
Karl Heuer <kwzh@gnu.org>
parents: 8525
diff changeset
412 ;; If we're supposed to be extending an existing string, and that
441af4b664ac (yank-menu): New variable; kill-ring in menu format.
Karl Heuer <kwzh@gnu.org>
parents: 8525
diff changeset
413 ;; string really is at the front of the menu, then update it in place.
441af4b664ac (yank-menu): New variable; kill-ring in menu format.
Karl Heuer <kwzh@gnu.org>
parents: 8525
diff changeset
414 (if (and old (or (eq old (car front))
441af4b664ac (yank-menu): New variable; kill-ring in menu format.
Karl Heuer <kwzh@gnu.org>
parents: 8525
diff changeset
415 (string= old (car front))))
3942
877f540d9717 (mouse-menu-choose-yank): Just return when x-popup-menu returns nil.
Roland McGrath <roland@gnu.org>
parents: 3898
diff changeset
416 (progn
8767
441af4b664ac (yank-menu): New variable; kill-ring in menu format.
Karl Heuer <kwzh@gnu.org>
parents: 8525
diff changeset
417 (setcar front string)
441af4b664ac (yank-menu): New variable; kill-ring in menu format.
Karl Heuer <kwzh@gnu.org>
parents: 8525
diff changeset
418 (setcar (cdr front) menu-string))
441af4b664ac (yank-menu): New variable; kill-ring in menu format.
Karl Heuer <kwzh@gnu.org>
parents: 8525
diff changeset
419 (setcdr yank-menu
441af4b664ac (yank-menu): New variable; kill-ring in menu format.
Karl Heuer <kwzh@gnu.org>
parents: 8525
diff changeset
420 (cons
441af4b664ac (yank-menu): New variable; kill-ring in menu format.
Karl Heuer <kwzh@gnu.org>
parents: 8525
diff changeset
421 (cons string (cons menu-string 'menu-bar-select-yank))
441af4b664ac (yank-menu): New variable; kill-ring in menu format.
Karl Heuer <kwzh@gnu.org>
parents: 8525
diff changeset
422 (cdr yank-menu)))))
441af4b664ac (yank-menu): New variable; kill-ring in menu format.
Karl Heuer <kwzh@gnu.org>
parents: 8525
diff changeset
423 (if (> (length (cdr yank-menu)) kill-ring-max)
441af4b664ac (yank-menu): New variable; kill-ring in menu format.
Karl Heuer <kwzh@gnu.org>
parents: 8525
diff changeset
424 (setcdr (nthcdr kill-ring-max yank-menu) nil)))
441af4b664ac (yank-menu): New variable; kill-ring in menu format.
Karl Heuer <kwzh@gnu.org>
parents: 8525
diff changeset
425
441af4b664ac (yank-menu): New variable; kill-ring in menu format.
Karl Heuer <kwzh@gnu.org>
parents: 8525
diff changeset
426 (defun menu-bar-select-yank ()
441af4b664ac (yank-menu): New variable; kill-ring in menu format.
Karl Heuer <kwzh@gnu.org>
parents: 8525
diff changeset
427 (interactive "*")
441af4b664ac (yank-menu): New variable; kill-ring in menu format.
Karl Heuer <kwzh@gnu.org>
parents: 8525
diff changeset
428 (push-mark (point))
441af4b664ac (yank-menu): New variable; kill-ring in menu format.
Karl Heuer <kwzh@gnu.org>
parents: 8525
diff changeset
429 (insert last-command-event))
2181
5a9d9dcc4750 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 2178
diff changeset
430
12633
c05399b944ab (menu-bar-buffer-menu): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents: 12610
diff changeset
431 ;; This definition is just to show what this looks like.
c05399b944ab (menu-bar-buffer-menu): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents: 12610
diff changeset
432 ;; It gets overridden below when menu-bar-update-buffers is called.
c05399b944ab (menu-bar-buffer-menu): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents: 12610
diff changeset
433 (define-key global-map [menu-bar buffer]
c05399b944ab (menu-bar-buffer-menu): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents: 12610
diff changeset
434 (cons "Buffers" (make-sparse-keymap "Buffers")))
2178
76da020d14f8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 2177
diff changeset
435
4628
e55cc9fdaa92 (list-buffers-directory): Add declaration.
Richard M. Stallman <rms@gnu.org>
parents: 4603
diff changeset
436 (defvar list-buffers-directory nil)
e55cc9fdaa92 (list-buffers-directory): Add declaration.
Richard M. Stallman <rms@gnu.org>
parents: 4603
diff changeset
437
9667
49eee3cb0ffa (menu-bar-file-menu): Add item `Make Frame On Display'.
Richard M. Stallman <rms@gnu.org>
parents: 9518
diff changeset
438 (defvar menu-bar-update-buffers-maxbuf)
49eee3cb0ffa (menu-bar-file-menu): Add item `Make Frame On Display'.
Richard M. Stallman <rms@gnu.org>
parents: 9518
diff changeset
439
7150
b78bfe054561 Make a sub-keymap for the Buffers menu bar item.
Richard M. Stallman <rms@gnu.org>
parents: 6948
diff changeset
440 (defun menu-bar-select-buffer ()
b78bfe054561 Make a sub-keymap for the Buffers menu bar item.
Richard M. Stallman <rms@gnu.org>
parents: 6948
diff changeset
441 (interactive)
b78bfe054561 Make a sub-keymap for the Buffers menu bar item.
Richard M. Stallman <rms@gnu.org>
parents: 6948
diff changeset
442 (switch-to-buffer last-command-event))
b78bfe054561 Make a sub-keymap for the Buffers menu bar item.
Richard M. Stallman <rms@gnu.org>
parents: 6948
diff changeset
443
b78bfe054561 Make a sub-keymap for the Buffers menu bar item.
Richard M. Stallman <rms@gnu.org>
parents: 6948
diff changeset
444 (defun menu-bar-select-frame ()
b78bfe054561 Make a sub-keymap for the Buffers menu bar item.
Richard M. Stallman <rms@gnu.org>
parents: 6948
diff changeset
445 (interactive)
b78bfe054561 Make a sub-keymap for the Buffers menu bar item.
Richard M. Stallman <rms@gnu.org>
parents: 6948
diff changeset
446 (make-frame-visible last-command-event)
b78bfe054561 Make a sub-keymap for the Buffers menu bar item.
Richard M. Stallman <rms@gnu.org>
parents: 6948
diff changeset
447 (raise-frame last-command-event)
b78bfe054561 Make a sub-keymap for the Buffers menu bar item.
Richard M. Stallman <rms@gnu.org>
parents: 6948
diff changeset
448 (select-frame last-command-event))
b78bfe054561 Make a sub-keymap for the Buffers menu bar item.
Richard M. Stallman <rms@gnu.org>
parents: 6948
diff changeset
449
9518
69072971d37e (menu-bar-update-buffers-1): New subroutine
Richard M. Stallman <rms@gnu.org>
parents: 9422
diff changeset
450 (defun menu-bar-update-buffers-1 (elt)
69072971d37e (menu-bar-update-buffers-1): New subroutine
Richard M. Stallman <rms@gnu.org>
parents: 9422
diff changeset
451 (cons (format
9667
49eee3cb0ffa (menu-bar-file-menu): Add item `Make Frame On Display'.
Richard M. Stallman <rms@gnu.org>
parents: 9518
diff changeset
452 (format "%%%ds %%s%%s %%s" menu-bar-update-buffers-maxbuf)
9518
69072971d37e (menu-bar-update-buffers-1): New subroutine
Richard M. Stallman <rms@gnu.org>
parents: 9422
diff changeset
453 (cdr elt)
69072971d37e (menu-bar-update-buffers-1): New subroutine
Richard M. Stallman <rms@gnu.org>
parents: 9422
diff changeset
454 (if (buffer-modified-p (car elt))
69072971d37e (menu-bar-update-buffers-1): New subroutine
Richard M. Stallman <rms@gnu.org>
parents: 9422
diff changeset
455 "*" " ")
69072971d37e (menu-bar-update-buffers-1): New subroutine
Richard M. Stallman <rms@gnu.org>
parents: 9422
diff changeset
456 (save-excursion
69072971d37e (menu-bar-update-buffers-1): New subroutine
Richard M. Stallman <rms@gnu.org>
parents: 9422
diff changeset
457 (set-buffer (car elt))
69072971d37e (menu-bar-update-buffers-1): New subroutine
Richard M. Stallman <rms@gnu.org>
parents: 9422
diff changeset
458 (if buffer-read-only "%" " "))
69072971d37e (menu-bar-update-buffers-1): New subroutine
Richard M. Stallman <rms@gnu.org>
parents: 9422
diff changeset
459 (let ((file
69072971d37e (menu-bar-update-buffers-1): New subroutine
Richard M. Stallman <rms@gnu.org>
parents: 9422
diff changeset
460 (or (buffer-file-name (car elt))
69072971d37e (menu-bar-update-buffers-1): New subroutine
Richard M. Stallman <rms@gnu.org>
parents: 9422
diff changeset
461 (save-excursion
69072971d37e (menu-bar-update-buffers-1): New subroutine
Richard M. Stallman <rms@gnu.org>
parents: 9422
diff changeset
462 (set-buffer (car elt))
69072971d37e (menu-bar-update-buffers-1): New subroutine
Richard M. Stallman <rms@gnu.org>
parents: 9422
diff changeset
463 list-buffers-directory)
69072971d37e (menu-bar-update-buffers-1): New subroutine
Richard M. Stallman <rms@gnu.org>
parents: 9422
diff changeset
464 "")))
69072971d37e (menu-bar-update-buffers-1): New subroutine
Richard M. Stallman <rms@gnu.org>
parents: 9422
diff changeset
465 (setq file (or (file-name-directory file)
69072971d37e (menu-bar-update-buffers-1): New subroutine
Richard M. Stallman <rms@gnu.org>
parents: 9422
diff changeset
466 ""))
69072971d37e (menu-bar-update-buffers-1): New subroutine
Richard M. Stallman <rms@gnu.org>
parents: 9422
diff changeset
467 (if (> (length file) 20)
69072971d37e (menu-bar-update-buffers-1): New subroutine
Richard M. Stallman <rms@gnu.org>
parents: 9422
diff changeset
468 (setq file (concat "..." (substring file -17))))
69072971d37e (menu-bar-update-buffers-1): New subroutine
Richard M. Stallman <rms@gnu.org>
parents: 9422
diff changeset
469 file))
69072971d37e (menu-bar-update-buffers-1): New subroutine
Richard M. Stallman <rms@gnu.org>
parents: 9422
diff changeset
470 (car elt)))
69072971d37e (menu-bar-update-buffers-1): New subroutine
Richard M. Stallman <rms@gnu.org>
parents: 9422
diff changeset
471
11325
032239e758c4 (menu-bar-update-buffers): Reuse the entry for
Richard M. Stallman <rms@gnu.org>
parents: 11309
diff changeset
472 (defvar menu-bar-buffers-menu-list-buffers-entry nil)
032239e758c4 (menu-bar-update-buffers): Reuse the entry for
Richard M. Stallman <rms@gnu.org>
parents: 11309
diff changeset
473
7150
b78bfe054561 Make a sub-keymap for the Buffers menu bar item.
Richard M. Stallman <rms@gnu.org>
parents: 6948
diff changeset
474 (defun menu-bar-update-buffers ()
8316
abf26f5c67e4 (menu-bar-update-buffers): If Buffers item is gone,
Richard M. Stallman <rms@gnu.org>
parents: 8229
diff changeset
475 ;; If user discards the Buffers item, play along.
8347
0fff2106fa43 (menu-bar-update-buffers): Use (current-global-map), not global-map.
Richard M. Stallman <rms@gnu.org>
parents: 8320
diff changeset
476 (and (lookup-key (current-global-map) [menu-bar buffer])
8316
abf26f5c67e4 (menu-bar-update-buffers): If Buffers item is gone,
Richard M. Stallman <rms@gnu.org>
parents: 8229
diff changeset
477 (frame-or-buffer-changed-p)
abf26f5c67e4 (menu-bar-update-buffers): If Buffers item is gone,
Richard M. Stallman <rms@gnu.org>
parents: 8229
diff changeset
478 (let ((buffers (buffer-list))
abf26f5c67e4 (menu-bar-update-buffers): If Buffers item is gone,
Richard M. Stallman <rms@gnu.org>
parents: 8229
diff changeset
479 (frames (frame-list))
abf26f5c67e4 (menu-bar-update-buffers): If Buffers item is gone,
Richard M. Stallman <rms@gnu.org>
parents: 8229
diff changeset
480 buffers-menu frames-menu)
abf26f5c67e4 (menu-bar-update-buffers): If Buffers item is gone,
Richard M. Stallman <rms@gnu.org>
parents: 8229
diff changeset
481 ;; If requested, list only the N most recently selected buffers.
abf26f5c67e4 (menu-bar-update-buffers): If Buffers item is gone,
Richard M. Stallman <rms@gnu.org>
parents: 8229
diff changeset
482 (if (and (integerp buffers-menu-max-size)
abf26f5c67e4 (menu-bar-update-buffers): If Buffers item is gone,
Richard M. Stallman <rms@gnu.org>
parents: 8229
diff changeset
483 (> buffers-menu-max-size 1))
abf26f5c67e4 (menu-bar-update-buffers): If Buffers item is gone,
Richard M. Stallman <rms@gnu.org>
parents: 8229
diff changeset
484 (if (> (length buffers) buffers-menu-max-size)
abf26f5c67e4 (menu-bar-update-buffers): If Buffers item is gone,
Richard M. Stallman <rms@gnu.org>
parents: 8229
diff changeset
485 (setcdr (nthcdr buffers-menu-max-size buffers) nil)))
7150
b78bfe054561 Make a sub-keymap for the Buffers menu bar item.
Richard M. Stallman <rms@gnu.org>
parents: 6948
diff changeset
486
8316
abf26f5c67e4 (menu-bar-update-buffers): If Buffers item is gone,
Richard M. Stallman <rms@gnu.org>
parents: 8229
diff changeset
487 ;; Make the menu of buffers proper.
abf26f5c67e4 (menu-bar-update-buffers): If Buffers item is gone,
Richard M. Stallman <rms@gnu.org>
parents: 8229
diff changeset
488 (setq buffers-menu
abf26f5c67e4 (menu-bar-update-buffers): If Buffers item is gone,
Richard M. Stallman <rms@gnu.org>
parents: 8229
diff changeset
489 (cons "Select Buffer"
9518
69072971d37e (menu-bar-update-buffers-1): New subroutine
Richard M. Stallman <rms@gnu.org>
parents: 9422
diff changeset
490 (let* ((buffer-list
69072971d37e (menu-bar-update-buffers-1): New subroutine
Richard M. Stallman <rms@gnu.org>
parents: 9422
diff changeset
491 (mapcar 'list buffers))
69072971d37e (menu-bar-update-buffers-1): New subroutine
Richard M. Stallman <rms@gnu.org>
parents: 9422
diff changeset
492 tail
9667
49eee3cb0ffa (menu-bar-file-menu): Add item `Make Frame On Display'.
Richard M. Stallman <rms@gnu.org>
parents: 9518
diff changeset
493 (menu-bar-update-buffers-maxbuf 0)
9518
69072971d37e (menu-bar-update-buffers-1): New subroutine
Richard M. Stallman <rms@gnu.org>
parents: 9422
diff changeset
494 (maxlen 0)
69072971d37e (menu-bar-update-buffers-1): New subroutine
Richard M. Stallman <rms@gnu.org>
parents: 9422
diff changeset
495 alist
69072971d37e (menu-bar-update-buffers-1): New subroutine
Richard M. Stallman <rms@gnu.org>
parents: 9422
diff changeset
496 head)
69072971d37e (menu-bar-update-buffers-1): New subroutine
Richard M. Stallman <rms@gnu.org>
parents: 9422
diff changeset
497 ;; Put into each element of buffer-list
69072971d37e (menu-bar-update-buffers-1): New subroutine
Richard M. Stallman <rms@gnu.org>
parents: 9422
diff changeset
498 ;; the name for actual display,
69072971d37e (menu-bar-update-buffers-1): New subroutine
Richard M. Stallman <rms@gnu.org>
parents: 9422
diff changeset
499 ;; perhaps truncated in the middle.
69072971d37e (menu-bar-update-buffers-1): New subroutine
Richard M. Stallman <rms@gnu.org>
parents: 9422
diff changeset
500 (setq tail buffer-list)
8316
abf26f5c67e4 (menu-bar-update-buffers): If Buffers item is gone,
Richard M. Stallman <rms@gnu.org>
parents: 8229
diff changeset
501 (while tail
9518
69072971d37e (menu-bar-update-buffers-1): New subroutine
Richard M. Stallman <rms@gnu.org>
parents: 9422
diff changeset
502 (let ((name (buffer-name (car (car tail)))))
69072971d37e (menu-bar-update-buffers-1): New subroutine
Richard M. Stallman <rms@gnu.org>
parents: 9422
diff changeset
503 (setcdr (car tail)
69072971d37e (menu-bar-update-buffers-1): New subroutine
Richard M. Stallman <rms@gnu.org>
parents: 9422
diff changeset
504 (if (> (length name) 27)
69072971d37e (menu-bar-update-buffers-1): New subroutine
Richard M. Stallman <rms@gnu.org>
parents: 9422
diff changeset
505 (concat (substring name 0 12)
69072971d37e (menu-bar-update-buffers-1): New subroutine
Richard M. Stallman <rms@gnu.org>
parents: 9422
diff changeset
506 "..."
69072971d37e (menu-bar-update-buffers-1): New subroutine
Richard M. Stallman <rms@gnu.org>
parents: 9422
diff changeset
507 (substring name -12))
69072971d37e (menu-bar-update-buffers-1): New subroutine
Richard M. Stallman <rms@gnu.org>
parents: 9422
diff changeset
508 name)))
69072971d37e (menu-bar-update-buffers-1): New subroutine
Richard M. Stallman <rms@gnu.org>
parents: 9422
diff changeset
509 (setq tail (cdr tail)))
69072971d37e (menu-bar-update-buffers-1): New subroutine
Richard M. Stallman <rms@gnu.org>
parents: 9422
diff changeset
510 ;; Compute the maximum length of any name.
69072971d37e (menu-bar-update-buffers-1): New subroutine
Richard M. Stallman <rms@gnu.org>
parents: 9422
diff changeset
511 (setq tail buffer-list)
69072971d37e (menu-bar-update-buffers-1): New subroutine
Richard M. Stallman <rms@gnu.org>
parents: 9422
diff changeset
512 (while tail
69072971d37e (menu-bar-update-buffers-1): New subroutine
Richard M. Stallman <rms@gnu.org>
parents: 9422
diff changeset
513 (or (eq ?\ (aref (cdr (car tail)) 0))
9667
49eee3cb0ffa (menu-bar-file-menu): Add item `Make Frame On Display'.
Richard M. Stallman <rms@gnu.org>
parents: 9518
diff changeset
514 (setq menu-bar-update-buffers-maxbuf
49eee3cb0ffa (menu-bar-file-menu): Add item `Make Frame On Display'.
Richard M. Stallman <rms@gnu.org>
parents: 9518
diff changeset
515 (max menu-bar-update-buffers-maxbuf
9518
69072971d37e (menu-bar-update-buffers-1): New subroutine
Richard M. Stallman <rms@gnu.org>
parents: 9422
diff changeset
516 (length (cdr (car tail))))))
8316
abf26f5c67e4 (menu-bar-update-buffers): If Buffers item is gone,
Richard M. Stallman <rms@gnu.org>
parents: 8229
diff changeset
517 (setq tail (cdr tail)))
9518
69072971d37e (menu-bar-update-buffers-1): New subroutine
Richard M. Stallman <rms@gnu.org>
parents: 9422
diff changeset
518 ;; Set ALIST to an alist of the form
69072971d37e (menu-bar-update-buffers-1): New subroutine
Richard M. Stallman <rms@gnu.org>
parents: 9422
diff changeset
519 ;; ITEM-STRING . BUFFER
69072971d37e (menu-bar-update-buffers-1): New subroutine
Richard M. Stallman <rms@gnu.org>
parents: 9422
diff changeset
520 (setq tail buffer-list)
8316
abf26f5c67e4 (menu-bar-update-buffers): If Buffers item is gone,
Richard M. Stallman <rms@gnu.org>
parents: 8229
diff changeset
521 (while tail
abf26f5c67e4 (menu-bar-update-buffers): If Buffers item is gone,
Richard M. Stallman <rms@gnu.org>
parents: 8229
diff changeset
522 (let ((elt (car tail)))
9518
69072971d37e (menu-bar-update-buffers-1): New subroutine
Richard M. Stallman <rms@gnu.org>
parents: 9422
diff changeset
523 (or (eq ?\ (aref (cdr elt) 0))
8316
abf26f5c67e4 (menu-bar-update-buffers): If Buffers item is gone,
Richard M. Stallman <rms@gnu.org>
parents: 8229
diff changeset
524 (setq alist (cons
9518
69072971d37e (menu-bar-update-buffers-1): New subroutine
Richard M. Stallman <rms@gnu.org>
parents: 9422
diff changeset
525 (menu-bar-update-buffers-1 elt)
8316
abf26f5c67e4 (menu-bar-update-buffers): If Buffers item is gone,
Richard M. Stallman <rms@gnu.org>
parents: 8229
diff changeset
526 alist)))
abf26f5c67e4 (menu-bar-update-buffers): If Buffers item is gone,
Richard M. Stallman <rms@gnu.org>
parents: 8229
diff changeset
527 (and alist (> (length (car (car alist))) maxlen)
abf26f5c67e4 (menu-bar-update-buffers): If Buffers item is gone,
Richard M. Stallman <rms@gnu.org>
parents: 8229
diff changeset
528 (setq maxlen (length (car (car alist))))))
abf26f5c67e4 (menu-bar-update-buffers): If Buffers item is gone,
Richard M. Stallman <rms@gnu.org>
parents: 8229
diff changeset
529 (setq tail (cdr tail)))
abf26f5c67e4 (menu-bar-update-buffers): If Buffers item is gone,
Richard M. Stallman <rms@gnu.org>
parents: 8229
diff changeset
530 (setq alist (nreverse alist))
11325
032239e758c4 (menu-bar-update-buffers): Reuse the entry for
Richard M. Stallman <rms@gnu.org>
parents: 11309
diff changeset
531 ;; Make the menu item for list-buffers
032239e758c4 (menu-bar-update-buffers): Reuse the entry for
Richard M. Stallman <rms@gnu.org>
parents: 11309
diff changeset
532 ;; or reuse the one we already have.
032239e758c4 (menu-bar-update-buffers): Reuse the entry for
Richard M. Stallman <rms@gnu.org>
parents: 11309
diff changeset
533 ;; The advantage in reusing one
032239e758c4 (menu-bar-update-buffers): Reuse the entry for
Richard M. Stallman <rms@gnu.org>
parents: 11309
diff changeset
534 ;; is that it already has the keyboard equivalent
032239e758c4 (menu-bar-update-buffers): Reuse the entry for
Richard M. Stallman <rms@gnu.org>
parents: 11309
diff changeset
535 ;; cached, so we save the time to look that up again.
032239e758c4 (menu-bar-update-buffers): Reuse the entry for
Richard M. Stallman <rms@gnu.org>
parents: 11309
diff changeset
536 (or menu-bar-buffers-menu-list-buffers-entry
032239e758c4 (menu-bar-update-buffers): Reuse the entry for
Richard M. Stallman <rms@gnu.org>
parents: 11309
diff changeset
537 (setq menu-bar-buffers-menu-list-buffers-entry
032239e758c4 (menu-bar-update-buffers): Reuse the entry for
Richard M. Stallman <rms@gnu.org>
parents: 11309
diff changeset
538 (cons
032239e758c4 (menu-bar-update-buffers): Reuse the entry for
Richard M. Stallman <rms@gnu.org>
parents: 11309
diff changeset
539 'list-buffers
032239e758c4 (menu-bar-update-buffers): Reuse the entry for
Richard M. Stallman <rms@gnu.org>
parents: 11309
diff changeset
540 (cons
032239e758c4 (menu-bar-update-buffers): Reuse the entry for
Richard M. Stallman <rms@gnu.org>
parents: 11309
diff changeset
541 ""
032239e758c4 (menu-bar-update-buffers): Reuse the entry for
Richard M. Stallman <rms@gnu.org>
parents: 11309
diff changeset
542 'list-buffers))))
032239e758c4 (menu-bar-update-buffers): Reuse the entry for
Richard M. Stallman <rms@gnu.org>
parents: 11309
diff changeset
543 ;; Update the item string for menu's new width.
032239e758c4 (menu-bar-update-buffers): Reuse the entry for
Richard M. Stallman <rms@gnu.org>
parents: 11309
diff changeset
544 (setcar (cdr menu-bar-buffers-menu-list-buffers-entry)
032239e758c4 (menu-bar-update-buffers): Reuse the entry for
Richard M. Stallman <rms@gnu.org>
parents: 11309
diff changeset
545 (concat (make-string (max (- (/ maxlen 2) 8) 0)
032239e758c4 (menu-bar-update-buffers): Reuse the entry for
Richard M. Stallman <rms@gnu.org>
parents: 11309
diff changeset
546 ?\ )
032239e758c4 (menu-bar-update-buffers): Reuse the entry for
Richard M. Stallman <rms@gnu.org>
parents: 11309
diff changeset
547 "List All Buffers"))
032239e758c4 (menu-bar-update-buffers): Reuse the entry for
Richard M. Stallman <rms@gnu.org>
parents: 11309
diff changeset
548 ;; Now make the actual list of items,
032239e758c4 (menu-bar-update-buffers): Reuse the entry for
Richard M. Stallman <rms@gnu.org>
parents: 11309
diff changeset
549 ;; ending with the list-buffers item.
8316
abf26f5c67e4 (menu-bar-update-buffers): If Buffers item is gone,
Richard M. Stallman <rms@gnu.org>
parents: 8229
diff changeset
550 (nconc (mapcar '(lambda (pair)
abf26f5c67e4 (menu-bar-update-buffers): If Buffers item is gone,
Richard M. Stallman <rms@gnu.org>
parents: 8229
diff changeset
551 ;; This is somewhat risque, to use
abf26f5c67e4 (menu-bar-update-buffers): If Buffers item is gone,
Richard M. Stallman <rms@gnu.org>
parents: 8229
diff changeset
552 ;; the buffer name itself as the event
abf26f5c67e4 (menu-bar-update-buffers): If Buffers item is gone,
Richard M. Stallman <rms@gnu.org>
parents: 8229
diff changeset
553 ;; type to define, but it works.
abf26f5c67e4 (menu-bar-update-buffers): If Buffers item is gone,
Richard M. Stallman <rms@gnu.org>
parents: 8229
diff changeset
554 ;; It would not work to use the buffer
abf26f5c67e4 (menu-bar-update-buffers): If Buffers item is gone,
Richard M. Stallman <rms@gnu.org>
parents: 8229
diff changeset
555 ;; since a buffer as an event has its
abf26f5c67e4 (menu-bar-update-buffers): If Buffers item is gone,
Richard M. Stallman <rms@gnu.org>
parents: 8229
diff changeset
556 ;; own meaning.
abf26f5c67e4 (menu-bar-update-buffers): If Buffers item is gone,
Richard M. Stallman <rms@gnu.org>
parents: 8229
diff changeset
557 (nconc (list (buffer-name (cdr pair))
abf26f5c67e4 (menu-bar-update-buffers): If Buffers item is gone,
Richard M. Stallman <rms@gnu.org>
parents: 8229
diff changeset
558 (car pair)
abf26f5c67e4 (menu-bar-update-buffers): If Buffers item is gone,
Richard M. Stallman <rms@gnu.org>
parents: 8229
diff changeset
559 (cons nil nil))
abf26f5c67e4 (menu-bar-update-buffers): If Buffers item is gone,
Richard M. Stallman <rms@gnu.org>
parents: 8229
diff changeset
560 'menu-bar-select-buffer))
abf26f5c67e4 (menu-bar-update-buffers): If Buffers item is gone,
Richard M. Stallman <rms@gnu.org>
parents: 8229
diff changeset
561 alist)
11325
032239e758c4 (menu-bar-update-buffers): Reuse the entry for
Richard M. Stallman <rms@gnu.org>
parents: 11309
diff changeset
562 (list menu-bar-buffers-menu-list-buffers-entry)))))
7150
b78bfe054561 Make a sub-keymap for the Buffers menu bar item.
Richard M. Stallman <rms@gnu.org>
parents: 6948
diff changeset
563
7239
385ac6718f28 (menu-bar-update-buffers): Fix misspelled variable.
Karl Heuer <kwzh@gnu.org>
parents: 7234
diff changeset
564
8316
abf26f5c67e4 (menu-bar-update-buffers): If Buffers item is gone,
Richard M. Stallman <rms@gnu.org>
parents: 8229
diff changeset
565 ;; Make a Frames menu if we have more than one frame.
abf26f5c67e4 (menu-bar-update-buffers): If Buffers item is gone,
Richard M. Stallman <rms@gnu.org>
parents: 8229
diff changeset
566 (if (cdr frames)
abf26f5c67e4 (menu-bar-update-buffers): If Buffers item is gone,
Richard M. Stallman <rms@gnu.org>
parents: 8229
diff changeset
567 (setq frames-menu
abf26f5c67e4 (menu-bar-update-buffers): If Buffers item is gone,
Richard M. Stallman <rms@gnu.org>
parents: 8229
diff changeset
568 (cons "Select Frame"
abf26f5c67e4 (menu-bar-update-buffers): If Buffers item is gone,
Richard M. Stallman <rms@gnu.org>
parents: 8229
diff changeset
569 (mapcar '(lambda (frame)
abf26f5c67e4 (menu-bar-update-buffers): If Buffers item is gone,
Richard M. Stallman <rms@gnu.org>
parents: 8229
diff changeset
570 (nconc (list frame
abf26f5c67e4 (menu-bar-update-buffers): If Buffers item is gone,
Richard M. Stallman <rms@gnu.org>
parents: 8229
diff changeset
571 (cdr (assq 'name
abf26f5c67e4 (menu-bar-update-buffers): If Buffers item is gone,
Richard M. Stallman <rms@gnu.org>
parents: 8229
diff changeset
572 (frame-parameters frame)))
abf26f5c67e4 (menu-bar-update-buffers): If Buffers item is gone,
Richard M. Stallman <rms@gnu.org>
parents: 8229
diff changeset
573 (cons nil nil))
abf26f5c67e4 (menu-bar-update-buffers): If Buffers item is gone,
Richard M. Stallman <rms@gnu.org>
parents: 8229
diff changeset
574 'menu-bar-select-frame))
abf26f5c67e4 (menu-bar-update-buffers): If Buffers item is gone,
Richard M. Stallman <rms@gnu.org>
parents: 8229
diff changeset
575 frames))))
abf26f5c67e4 (menu-bar-update-buffers): If Buffers item is gone,
Richard M. Stallman <rms@gnu.org>
parents: 8229
diff changeset
576 (if buffers-menu
abf26f5c67e4 (menu-bar-update-buffers): If Buffers item is gone,
Richard M. Stallman <rms@gnu.org>
parents: 8229
diff changeset
577 (setq buffers-menu (cons 'keymap buffers-menu)))
abf26f5c67e4 (menu-bar-update-buffers): If Buffers item is gone,
Richard M. Stallman <rms@gnu.org>
parents: 8229
diff changeset
578 (if frames-menu
abf26f5c67e4 (menu-bar-update-buffers): If Buffers item is gone,
Richard M. Stallman <rms@gnu.org>
parents: 8229
diff changeset
579 (setq frames-menu (cons 'keymap frames-menu)))
8347
0fff2106fa43 (menu-bar-update-buffers): Use (current-global-map), not global-map.
Richard M. Stallman <rms@gnu.org>
parents: 8320
diff changeset
580 (define-key (current-global-map) [menu-bar buffer]
8316
abf26f5c67e4 (menu-bar-update-buffers): If Buffers item is gone,
Richard M. Stallman <rms@gnu.org>
parents: 8229
diff changeset
581 (cons "Buffers"
abf26f5c67e4 (menu-bar-update-buffers): If Buffers item is gone,
Richard M. Stallman <rms@gnu.org>
parents: 8229
diff changeset
582 (if (and buffers-menu frames-menu)
abf26f5c67e4 (menu-bar-update-buffers): If Buffers item is gone,
Richard M. Stallman <rms@gnu.org>
parents: 8229
diff changeset
583 (list 'keymap "Buffers and Frames"
abf26f5c67e4 (menu-bar-update-buffers): If Buffers item is gone,
Richard M. Stallman <rms@gnu.org>
parents: 8229
diff changeset
584 (cons 'buffers (cons "Buffers" buffers-menu))
abf26f5c67e4 (menu-bar-update-buffers): If Buffers item is gone,
Richard M. Stallman <rms@gnu.org>
parents: 8229
diff changeset
585 (cons 'frames (cons "Frames" frames-menu)))
abf26f5c67e4 (menu-bar-update-buffers): If Buffers item is gone,
Richard M. Stallman <rms@gnu.org>
parents: 8229
diff changeset
586 (or buffers-menu frames-menu 'undefined)))))))
2181
5a9d9dcc4750 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 2178
diff changeset
587
7150
b78bfe054561 Make a sub-keymap for the Buffers menu bar item.
Richard M. Stallman <rms@gnu.org>
parents: 6948
diff changeset
588 (add-hook 'menu-bar-update-hook 'menu-bar-update-buffers)
2181
5a9d9dcc4750 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 2178
diff changeset
589
12633
c05399b944ab (menu-bar-buffer-menu): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents: 12610
diff changeset
590 (menu-bar-update-buffers)
c05399b944ab (menu-bar-buffer-menu): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents: 12610
diff changeset
591
2181
5a9d9dcc4750 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 2178
diff changeset
592 ;; this version is too slow
5a9d9dcc4750 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 2178
diff changeset
593 ;;;(defun format-buffers-menu-line (buffer)
5a9d9dcc4750 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 2178
diff changeset
594 ;;; "Returns a string to represent the given buffer in the Buffer menu.
5a9d9dcc4750 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 2178
diff changeset
595 ;;;nil means the buffer shouldn't be listed. You can redefine this."
5a9d9dcc4750 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 2178
diff changeset
596 ;;; (if (string-match "\\` " (buffer-name buffer))
5a9d9dcc4750 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 2178
diff changeset
597 ;;; nil
5a9d9dcc4750 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 2178
diff changeset
598 ;;; (save-excursion
5a9d9dcc4750 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 2178
diff changeset
599 ;;; (set-buffer buffer)
5a9d9dcc4750 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 2178
diff changeset
600 ;;; (let ((size (buffer-size)))
5a9d9dcc4750 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 2178
diff changeset
601 ;;; (format "%s%s %-19s %6s %-15s %s"
5a9d9dcc4750 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 2178
diff changeset
602 ;;; (if (buffer-modified-p) "*" " ")
5a9d9dcc4750 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 2178
diff changeset
603 ;;; (if buffer-read-only "%" " ")
5a9d9dcc4750 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 2178
diff changeset
604 ;;; (buffer-name)
5a9d9dcc4750 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 2178
diff changeset
605 ;;; size
5a9d9dcc4750 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 2178
diff changeset
606 ;;; mode-name
5a9d9dcc4750 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 2178
diff changeset
607 ;;; (or (buffer-file-name) ""))))))
5a9d9dcc4750 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 2178
diff changeset
608
12427
04bcad1807b9 Make more menu-enables check (not buffer-read-only).
Richard M. Stallman <rms@gnu.org>
parents: 12199
diff changeset
609 ;;; Set up a menu bar menu for the minibuffer.
04bcad1807b9 Make more menu-enables check (not buffer-read-only).
Richard M. Stallman <rms@gnu.org>
parents: 12199
diff changeset
610
04bcad1807b9 Make more menu-enables check (not buffer-read-only).
Richard M. Stallman <rms@gnu.org>
parents: 12199
diff changeset
611 (mapcar
04bcad1807b9 Make more menu-enables check (not buffer-read-only).
Richard M. Stallman <rms@gnu.org>
parents: 12199
diff changeset
612 (function
04bcad1807b9 Make more menu-enables check (not buffer-read-only).
Richard M. Stallman <rms@gnu.org>
parents: 12199
diff changeset
613 (lambda (map)
04bcad1807b9 Make more menu-enables check (not buffer-read-only).
Richard M. Stallman <rms@gnu.org>
parents: 12199
diff changeset
614 (define-key map [menu-bar minibuf]
04bcad1807b9 Make more menu-enables check (not buffer-read-only).
Richard M. Stallman <rms@gnu.org>
parents: 12199
diff changeset
615 (cons "Minibuf" (make-sparse-keymap "Minibuf")))))
04bcad1807b9 Make more menu-enables check (not buffer-read-only).
Richard M. Stallman <rms@gnu.org>
parents: 12199
diff changeset
616 (list minibuffer-local-ns-map
04bcad1807b9 Make more menu-enables check (not buffer-read-only).
Richard M. Stallman <rms@gnu.org>
parents: 12199
diff changeset
617 minibuffer-local-must-match-map
04bcad1807b9 Make more menu-enables check (not buffer-read-only).
Richard M. Stallman <rms@gnu.org>
parents: 12199
diff changeset
618 minibuffer-local-isearch-map
04bcad1807b9 Make more menu-enables check (not buffer-read-only).
Richard M. Stallman <rms@gnu.org>
parents: 12199
diff changeset
619 minibuffer-local-map
04bcad1807b9 Make more menu-enables check (not buffer-read-only).
Richard M. Stallman <rms@gnu.org>
parents: 12199
diff changeset
620 minibuffer-local-completion-map))
04bcad1807b9 Make more menu-enables check (not buffer-read-only).
Richard M. Stallman <rms@gnu.org>
parents: 12199
diff changeset
621
04bcad1807b9 Make more menu-enables check (not buffer-read-only).
Richard M. Stallman <rms@gnu.org>
parents: 12199
diff changeset
622 (mapcar
04bcad1807b9 Make more menu-enables check (not buffer-read-only).
Richard M. Stallman <rms@gnu.org>
parents: 12199
diff changeset
623 (function
04bcad1807b9 Make more menu-enables check (not buffer-read-only).
Richard M. Stallman <rms@gnu.org>
parents: 12199
diff changeset
624 (lambda (map)
04bcad1807b9 Make more menu-enables check (not buffer-read-only).
Richard M. Stallman <rms@gnu.org>
parents: 12199
diff changeset
625 (define-key map [menu-bar minibuf ?\?]
04bcad1807b9 Make more menu-enables check (not buffer-read-only).
Richard M. Stallman <rms@gnu.org>
parents: 12199
diff changeset
626 '("List Completions" . minibuffer-completion-help))
04bcad1807b9 Make more menu-enables check (not buffer-read-only).
Richard M. Stallman <rms@gnu.org>
parents: 12199
diff changeset
627 (define-key map [menu-bar minibuf space]
04bcad1807b9 Make more menu-enables check (not buffer-read-only).
Richard M. Stallman <rms@gnu.org>
parents: 12199
diff changeset
628 '("Complete Word" . minibuffer-complete-word))
04bcad1807b9 Make more menu-enables check (not buffer-read-only).
Richard M. Stallman <rms@gnu.org>
parents: 12199
diff changeset
629 (define-key map [menu-bar minibuf tab]
13567
051b4ffca31f (minibuffer maps): Delete extra quote.
Richard M. Stallman <rms@gnu.org>
parents: 13506
diff changeset
630 '("Complete" . minibuffer-complete))
12427
04bcad1807b9 Make more menu-enables check (not buffer-read-only).
Richard M. Stallman <rms@gnu.org>
parents: 12199
diff changeset
631 ))
04bcad1807b9 Make more menu-enables check (not buffer-read-only).
Richard M. Stallman <rms@gnu.org>
parents: 12199
diff changeset
632 (list minibuffer-local-must-match-map
04bcad1807b9 Make more menu-enables check (not buffer-read-only).
Richard M. Stallman <rms@gnu.org>
parents: 12199
diff changeset
633 minibuffer-local-completion-map))
04bcad1807b9 Make more menu-enables check (not buffer-read-only).
Richard M. Stallman <rms@gnu.org>
parents: 12199
diff changeset
634
04bcad1807b9 Make more menu-enables check (not buffer-read-only).
Richard M. Stallman <rms@gnu.org>
parents: 12199
diff changeset
635 (mapcar
04bcad1807b9 Make more menu-enables check (not buffer-read-only).
Richard M. Stallman <rms@gnu.org>
parents: 12199
diff changeset
636 (function
04bcad1807b9 Make more menu-enables check (not buffer-read-only).
Richard M. Stallman <rms@gnu.org>
parents: 12199
diff changeset
637 (lambda (map)
04bcad1807b9 Make more menu-enables check (not buffer-read-only).
Richard M. Stallman <rms@gnu.org>
parents: 12199
diff changeset
638 (define-key map [menu-bar minibuf quit]
04bcad1807b9 Make more menu-enables check (not buffer-read-only).
Richard M. Stallman <rms@gnu.org>
parents: 12199
diff changeset
639 '("Quit" . keyboard-escape-quit))
04bcad1807b9 Make more menu-enables check (not buffer-read-only).
Richard M. Stallman <rms@gnu.org>
parents: 12199
diff changeset
640 (define-key map [menu-bar minibuf return]
04bcad1807b9 Make more menu-enables check (not buffer-read-only).
Richard M. Stallman <rms@gnu.org>
parents: 12199
diff changeset
641 '("Enter" . exit-minibuffer))
04bcad1807b9 Make more menu-enables check (not buffer-read-only).
Richard M. Stallman <rms@gnu.org>
parents: 12199
diff changeset
642 ))
04bcad1807b9 Make more menu-enables check (not buffer-read-only).
Richard M. Stallman <rms@gnu.org>
parents: 12199
diff changeset
643 (list minibuffer-local-ns-map
04bcad1807b9 Make more menu-enables check (not buffer-read-only).
Richard M. Stallman <rms@gnu.org>
parents: 12199
diff changeset
644 minibuffer-local-must-match-map
04bcad1807b9 Make more menu-enables check (not buffer-read-only).
Richard M. Stallman <rms@gnu.org>
parents: 12199
diff changeset
645 minibuffer-local-isearch-map
04bcad1807b9 Make more menu-enables check (not buffer-read-only).
Richard M. Stallman <rms@gnu.org>
parents: 12199
diff changeset
646 minibuffer-local-map
04bcad1807b9 Make more menu-enables check (not buffer-read-only).
Richard M. Stallman <rms@gnu.org>
parents: 12199
diff changeset
647 minibuffer-local-completion-map))
04bcad1807b9 Make more menu-enables check (not buffer-read-only).
Richard M. Stallman <rms@gnu.org>
parents: 12199
diff changeset
648
8055
6a0af6085c1a (menu-bar-mode): Make this a global variable.
Richard M. Stallman <rms@gnu.org>
parents: 8010
diff changeset
649 (defvar menu-bar-mode nil)
6a0af6085c1a (menu-bar-mode): Make this a global variable.
Richard M. Stallman <rms@gnu.org>
parents: 8010
diff changeset
650
2847
01a46a8f1e1b (fill-region, kill-region, delete-region)
Richard M. Stallman <rms@gnu.org>
parents: 2765
diff changeset
651 (defun menu-bar-mode (flag)
3007
e41b3dc686bb (menu-bar-mode): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 2847
diff changeset
652 "Toggle display of a menu bar on each frame.
2847
01a46a8f1e1b (fill-region, kill-region, delete-region)
Richard M. Stallman <rms@gnu.org>
parents: 2765
diff changeset
653 This command applies to all frames that exist and frames to be
01a46a8f1e1b (fill-region, kill-region, delete-region)
Richard M. Stallman <rms@gnu.org>
parents: 2765
diff changeset
654 created in the future.
01a46a8f1e1b (fill-region, kill-region, delete-region)
Richard M. Stallman <rms@gnu.org>
parents: 2765
diff changeset
655 With a numeric argument, if the argument is negative,
3007
e41b3dc686bb (menu-bar-mode): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 2847
diff changeset
656 turn off menu bars; otherwise, turn on menu bars."
4470
6dd518d1f5aa (menu-bar-mode): Defvar removed.
Roland McGrath <roland@gnu.org>
parents: 4337
diff changeset
657 (interactive "P")
6dd518d1f5aa (menu-bar-mode): Defvar removed.
Roland McGrath <roland@gnu.org>
parents: 4337
diff changeset
658
8055
6a0af6085c1a (menu-bar-mode): Make this a global variable.
Richard M. Stallman <rms@gnu.org>
parents: 8010
diff changeset
659 ;; Make menu-bar-mode and default-frame-alist consistent.
6a0af6085c1a (menu-bar-mode): Make this a global variable.
Richard M. Stallman <rms@gnu.org>
parents: 8010
diff changeset
660 (let ((default (assq 'menu-bar-lines default-frame-alist)))
6a0af6085c1a (menu-bar-mode): Make this a global variable.
Richard M. Stallman <rms@gnu.org>
parents: 8010
diff changeset
661 (if default
6a0af6085c1a (menu-bar-mode): Make this a global variable.
Richard M. Stallman <rms@gnu.org>
parents: 8010
diff changeset
662 (setq menu-bar-mode (not (eq (cdr default) 0)))
6a0af6085c1a (menu-bar-mode): Make this a global variable.
Richard M. Stallman <rms@gnu.org>
parents: 8010
diff changeset
663 (setq default-frame-alist
6a0af6085c1a (menu-bar-mode): Make this a global variable.
Richard M. Stallman <rms@gnu.org>
parents: 8010
diff changeset
664 (cons (cons 'menu-bar-lines (if menu-bar-mode 1 0))
6a0af6085c1a (menu-bar-mode): Make this a global variable.
Richard M. Stallman <rms@gnu.org>
parents: 8010
diff changeset
665 default-frame-alist))))
4470
6dd518d1f5aa (menu-bar-mode): Defvar removed.
Roland McGrath <roland@gnu.org>
parents: 4337
diff changeset
666
8055
6a0af6085c1a (menu-bar-mode): Make this a global variable.
Richard M. Stallman <rms@gnu.org>
parents: 8010
diff changeset
667 ;; Toggle or set the mode, according to FLAG.
6a0af6085c1a (menu-bar-mode): Make this a global variable.
Richard M. Stallman <rms@gnu.org>
parents: 8010
diff changeset
668 (setq menu-bar-mode (if (null flag) (not menu-bar-mode)
6a0af6085c1a (menu-bar-mode): Make this a global variable.
Richard M. Stallman <rms@gnu.org>
parents: 8010
diff changeset
669 (> (prefix-numeric-value flag) 0)))
4470
6dd518d1f5aa (menu-bar-mode): Defvar removed.
Roland McGrath <roland@gnu.org>
parents: 4337
diff changeset
670
8055
6a0af6085c1a (menu-bar-mode): Make this a global variable.
Richard M. Stallman <rms@gnu.org>
parents: 8010
diff changeset
671 ;; Apply it to default-frame-alist.
6a0af6085c1a (menu-bar-mode): Make this a global variable.
Richard M. Stallman <rms@gnu.org>
parents: 8010
diff changeset
672 (let ((parameter (assq 'menu-bar-lines default-frame-alist)))
6a0af6085c1a (menu-bar-mode): Make this a global variable.
Richard M. Stallman <rms@gnu.org>
parents: 8010
diff changeset
673 (if (consp parameter)
6a0af6085c1a (menu-bar-mode): Make this a global variable.
Richard M. Stallman <rms@gnu.org>
parents: 8010
diff changeset
674 (setcdr parameter (if menu-bar-mode 1 0))
6a0af6085c1a (menu-bar-mode): Make this a global variable.
Richard M. Stallman <rms@gnu.org>
parents: 8010
diff changeset
675 (setq default-frame-alist
6a0af6085c1a (menu-bar-mode): Make this a global variable.
Richard M. Stallman <rms@gnu.org>
parents: 8010
diff changeset
676 (cons (cons 'menu-bar-lines (if menu-bar-mode 1 0))
6a0af6085c1a (menu-bar-mode): Make this a global variable.
Richard M. Stallman <rms@gnu.org>
parents: 8010
diff changeset
677 default-frame-alist))))
4470
6dd518d1f5aa (menu-bar-mode): Defvar removed.
Roland McGrath <roland@gnu.org>
parents: 4337
diff changeset
678
8055
6a0af6085c1a (menu-bar-mode): Make this a global variable.
Richard M. Stallman <rms@gnu.org>
parents: 8010
diff changeset
679 ;; Apply it to existing frames.
6a0af6085c1a (menu-bar-mode): Make this a global variable.
Richard M. Stallman <rms@gnu.org>
parents: 8010
diff changeset
680 (let ((frames (frame-list)))
6a0af6085c1a (menu-bar-mode): Make this a global variable.
Richard M. Stallman <rms@gnu.org>
parents: 8010
diff changeset
681 (while frames
6a0af6085c1a (menu-bar-mode): Make this a global variable.
Richard M. Stallman <rms@gnu.org>
parents: 8010
diff changeset
682 (let ((height (cdr (assq 'height (frame-parameters (car frames))))))
6a0af6085c1a (menu-bar-mode): Make this a global variable.
Richard M. Stallman <rms@gnu.org>
parents: 8010
diff changeset
683 (modify-frame-parameters (car frames)
6a0af6085c1a (menu-bar-mode): Make this a global variable.
Richard M. Stallman <rms@gnu.org>
parents: 8010
diff changeset
684 (list (cons 'menu-bar-lines
6a0af6085c1a (menu-bar-mode): Make this a global variable.
Richard M. Stallman <rms@gnu.org>
parents: 8010
diff changeset
685 (if menu-bar-mode 1 0))))
6a0af6085c1a (menu-bar-mode): Make this a global variable.
Richard M. Stallman <rms@gnu.org>
parents: 8010
diff changeset
686 (modify-frame-parameters (car frames)
6a0af6085c1a (menu-bar-mode): Make this a global variable.
Richard M. Stallman <rms@gnu.org>
parents: 8010
diff changeset
687 (list (cons 'height height))))
6a0af6085c1a (menu-bar-mode): Make this a global variable.
Richard M. Stallman <rms@gnu.org>
parents: 8010
diff changeset
688 (setq frames (cdr frames)))))
2485
c34bbe650160 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 2181
diff changeset
689
2765
0eb1a195f56e Provide 'menu-bar.
Richard M. Stallman <rms@gnu.org>
parents: 2695
diff changeset
690 (provide 'menu-bar)
0eb1a195f56e Provide 'menu-bar.
Richard M. Stallman <rms@gnu.org>
parents: 2695
diff changeset
691
2488
278580be9b4a Added and corrected library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2485
diff changeset
692 ;;; menu-bar.el ends here