annotate lisp/menu-bar.el @ 22503:104e277d77d3

(x_list_fonts): If SIZE is zero and MAXNAMES is 1, use XLoadQueryFont instead of XListFonts. (x_load_fonts): Call x_list_fonts with MAXNAMES 1.
author Kenichi Handa <handa@m17n.org>
date Tue, 16 Jun 1998 07:32:05 +0000
parents 51847ba069f8
children 175d00eed6c7
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
17970
720d1f98ae42 Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 17696
diff changeset
6 ;; Maintainer: FSF
5140
9cde7d7fea1f Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 4941
diff changeset
7 ;; Keywords: internal
2488
278580be9b4a Added and corrected library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2485
diff changeset
8
2485
c34bbe650160 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 2181
diff changeset
9 ;; This file is part of GNU Emacs.
c34bbe650160 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 2181
diff changeset
10
c34bbe650160 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 2181
diff changeset
11 ;; 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
12 ;; 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
13 ;; 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
14 ;; any later version.
c34bbe650160 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 2181
diff changeset
15
c34bbe650160 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 2181
diff changeset
16 ;; 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
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
c34bbe650160 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 2181
diff changeset
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
c34bbe650160 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 2181
diff changeset
19 ;; GNU General Public License for more details.
c34bbe650160 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 2181
diff changeset
20
c34bbe650160 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 2181
diff changeset
21 ;; 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
22 ;; 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
23 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13871
diff changeset
24 ;; Boston, MA 02111-1307, USA.
2485
c34bbe650160 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 2181
diff changeset
25
12558
98c9ac60aa20 (menu-bar-help-menu): Add finder-by-keyword.
Karl Heuer <kwzh@gnu.org>
parents: 12434
diff changeset
26 ;; Avishai Yacobi suggested some menu rearrangements.
98c9ac60aa20 (menu-bar-help-menu): Add finder-by-keyword.
Karl Heuer <kwzh@gnu.org>
parents: 12434
diff changeset
27
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13871
diff changeset
28 ;;; Code:
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 13871
diff changeset
29
13871
4b5161e903c1 (buffers-menu-max-size): Move definition to top of file.
Richard M. Stallman <rms@gnu.org>
parents: 13567
diff changeset
30 ;;; User options:
4b5161e903c1 (buffers-menu-max-size): Move definition to top of file.
Richard M. Stallman <rms@gnu.org>
parents: 13567
diff changeset
31
17665
b11021ca3525 Use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17615
diff changeset
32 (defcustom buffers-menu-max-size 10
13871
4b5161e903c1 (buffers-menu-max-size): Move definition to top of file.
Richard M. Stallman <rms@gnu.org>
parents: 13567
diff changeset
33 "*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
34 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
35 If this is nil, then all buffers are shown.
17665
b11021ca3525 Use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17615
diff changeset
36 A large number or nil slows down menu responsiveness."
b11021ca3525 Use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17615
diff changeset
37 :type '(choice integer
b11021ca3525 Use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17615
diff changeset
38 (const :tag "All" nil))
b11021ca3525 Use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17615
diff changeset
39 :group 'mouse)
13871
4b5161e903c1 (buffers-menu-max-size): Move definition to top of file.
Richard M. Stallman <rms@gnu.org>
parents: 13567
diff changeset
40
4668
12289fa93455 Don't clobber existing binding for menu-bar in global-map.
Roland McGrath <roland@gnu.org>
parents: 4628
diff changeset
41 ;; 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
42 ;; 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
43 (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
44 (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
45 (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
46
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
47 ;; 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
48 ;; 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
49 ;; help key.
5f618eea1343 (help-menu): Symbol renamed from `help'.
Karl Heuer <kwzh@gnu.org>
parents: 12041
diff changeset
50 (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
51
12199
5f618eea1343 (help-menu): Symbol renamed from `help'.
Karl Heuer <kwzh@gnu.org>
parents: 12041
diff changeset
52 (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
53 (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
54 (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
55 (defvar menu-bar-edit-menu (make-sparse-keymap "Edit"))
2178
76da020d14f8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 2177
diff changeset
56 (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
57 (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
58 (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
59 (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
60 (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
61
d24be7d7af5d (menu-bar-file-menu): Add back as alias for menu-bar-files-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11235
diff changeset
62 ;; 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
63 (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
64
8977
c8e2c62cf851 (vc-menu-map): New menu.
Richard M. Stallman <rms@gnu.org>
parents: 8809
diff changeset
65 (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
66
16677
e5d1cfd4d29c (menu-bar-tools-menu): Add items
Richard M. Stallman <rms@gnu.org>
parents: 16619
diff changeset
67 (define-key menu-bar-tools-menu [gdb] '("Debugger..." . gdb))
e5d1cfd4d29c (menu-bar-tools-menu): Add items
Richard M. Stallman <rms@gnu.org>
parents: 16619
diff changeset
68 (define-key menu-bar-tools-menu [compile] '("Compile..." . compile))
e5d1cfd4d29c (menu-bar-tools-menu): Add items
Richard M. Stallman <rms@gnu.org>
parents: 16619
diff changeset
69 (define-key menu-bar-tools-menu [grep] '("Search Files..." . grep))
e5d1cfd4d29c (menu-bar-tools-menu): Add items
Richard M. Stallman <rms@gnu.org>
parents: 16619
diff changeset
70
e5d1cfd4d29c (menu-bar-tools-menu): Add items
Richard M. Stallman <rms@gnu.org>
parents: 16619
diff changeset
71 (define-key menu-bar-tools-menu [separator-1]
e5d1cfd4d29c (menu-bar-tools-menu): Add items
Richard M. Stallman <rms@gnu.org>
parents: 16619
diff changeset
72 '("--"))
e5d1cfd4d29c (menu-bar-tools-menu): Add items
Richard M. Stallman <rms@gnu.org>
parents: 16619
diff changeset
73
11182
9fdd7498250f (menu-bar-edit-menu): Capitalize an item name.
Richard M. Stallman <rms@gnu.org>
parents: 11118
diff changeset
74 (define-key menu-bar-tools-menu [calendar] '("Display Calendar" . calendar))
17099
6ae39e04077b (menu-bar-tools-menu): Fix typo in Send Mail item.
Karl Heuer <kwzh@gnu.org>
parents: 16759
diff changeset
75 (define-key menu-bar-tools-menu [compose-mail] '("Send Mail" . compose-mail))
11067
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 [rmail] '("Read Mail" . rmail))
13475
ddf1e34018d2 (menu-bar-tools-menu): Always define GNUS entry.
Richard M. Stallman <rms@gnu.org>
parents: 13173
diff changeset
77 (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
78
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
79 (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
80 '("--"))
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
81
14291
3eb791861e23 (menu-bar-search-menu): Clean up key symbols.
Karl Heuer <kwzh@gnu.org>
parents: 14169
diff changeset
82 (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
83 (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
84
11067
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
85 (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
86 '("--"))
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
87
18288
1e31ff4722f7 Added [ediff-misc] to menu-bar-tools-menu
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 17970
diff changeset
88 (define-key menu-bar-tools-menu [ediff-misc]
1e31ff4722f7 Added [ediff-misc] to menu-bar-tools-menu
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 17970
diff changeset
89 '("Ediff Miscellanea" . menu-bar-ediff-misc-menu))
11067
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
90 (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
91 '("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
92 (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
93 '("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
94 (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
95 '("Compare" . menu-bar-ediff-menu))
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
96
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
97 (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
98 '("--"))
e199eda519b5 Rearrange the edit and file menus, and add separators.
Richard M. Stallman <rms@gnu.org>
parents: 7811
diff changeset
99
20647
0a7d2f8874ea Added Print submenu to Edit menu.
Simon Marshall <simon@gnu.org>
parents: 20481
diff changeset
100 (defvar menu-bar-print-menu (make-sparse-keymap "Print"))
0a7d2f8874ea Added Print submenu to Edit menu.
Simon Marshall <simon@gnu.org>
parents: 20481
diff changeset
101
0a7d2f8874ea Added Print submenu to Edit menu.
Simon Marshall <simon@gnu.org>
parents: 20481
diff changeset
102 (define-key menu-bar-print-menu [ps-print-region]
0a7d2f8874ea Added Print submenu to Edit menu.
Simon Marshall <simon@gnu.org>
parents: 20481
diff changeset
103 '("Postscript Print Region" . ps-print-region-with-faces))
0a7d2f8874ea Added Print submenu to Edit menu.
Simon Marshall <simon@gnu.org>
parents: 20481
diff changeset
104 (define-key menu-bar-print-menu [ps-print-buffer]
0a7d2f8874ea Added Print submenu to Edit menu.
Simon Marshall <simon@gnu.org>
parents: 20481
diff changeset
105 '("Postscript Print Buffer" . ps-print-buffer-with-faces))
0a7d2f8874ea Added Print submenu to Edit menu.
Simon Marshall <simon@gnu.org>
parents: 20481
diff changeset
106 (define-key menu-bar-print-menu [separator-ps-print]
0a7d2f8874ea Added Print submenu to Edit menu.
Simon Marshall <simon@gnu.org>
parents: 20481
diff changeset
107 '("--"))
0a7d2f8874ea Added Print submenu to Edit menu.
Simon Marshall <simon@gnu.org>
parents: 20481
diff changeset
108 (define-key menu-bar-print-menu [print-region]
0a7d2f8874ea Added Print submenu to Edit menu.
Simon Marshall <simon@gnu.org>
parents: 20481
diff changeset
109 '("Print Region" . print-region))
0a7d2f8874ea Added Print submenu to Edit menu.
Simon Marshall <simon@gnu.org>
parents: 20481
diff changeset
110 (define-key menu-bar-print-menu [print-buffer]
0a7d2f8874ea Added Print submenu to Edit menu.
Simon Marshall <simon@gnu.org>
parents: 20481
diff changeset
111 '("Print Buffer" . print-buffer))
0a7d2f8874ea Added Print submenu to Edit menu.
Simon Marshall <simon@gnu.org>
parents: 20481
diff changeset
112
0a7d2f8874ea Added Print submenu to Edit menu.
Simon Marshall <simon@gnu.org>
parents: 20481
diff changeset
113 (define-key menu-bar-tools-menu [print]
0a7d2f8874ea Added Print submenu to Edit menu.
Simon Marshall <simon@gnu.org>
parents: 20481
diff changeset
114 (cons "Print" menu-bar-print-menu))
0a7d2f8874ea Added Print submenu to Edit menu.
Simon Marshall <simon@gnu.org>
parents: 20481
diff changeset
115
11067
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
116 (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
117 (put 'ps-print-region-with-faces 'menu-enable 'mark-active)
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
118
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
119 (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
120 '("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
121
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
122 (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
123 '("--"))
e199eda519b5 Rearrange the edit and file menus, and add separators.
Richard M. Stallman <rms@gnu.org>
parents: 7811
diff changeset
124
11067
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
125 (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
126 '("One Window" . delete-other-windows))
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
127
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 [split-window]
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
129 '("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
130
9422
669208821120 (menu-bar-file-menu): Don't include the frame
Richard M. Stallman <rms@gnu.org>
parents: 9356
diff changeset
131 (if (fboundp 'delete-frame)
669208821120 (menu-bar-file-menu): Don't include the frame
Richard M. Stallman <rms@gnu.org>
parents: 9356
diff changeset
132 (progn
13506
6360f5543071 (delete-frame): Don't use delete-frame as event name.
Richard M. Stallman <rms@gnu.org>
parents: 13475
diff changeset
133 ;; 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
134 ;; 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
135 (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
136 '("Delete Frame" . delete-frame))
11067
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
137 (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
138 '("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
139 (define-key menu-bar-files-menu [make-frame]
18637
62cf644c438b (menu-bar-files-menu): Use make-frame-command
Richard M. Stallman <rms@gnu.org>
parents: 18602
diff changeset
140 '("Make New Frame" . make-frame-command))))
8010
e199eda519b5 Rearrange the edit and file menus, and add separators.
Richard M. Stallman <rms@gnu.org>
parents: 7811
diff changeset
141
11067
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
142 (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
143 '("--"))
e199eda519b5 Rearrange the edit and file menus, and add separators.
Richard M. Stallman <rms@gnu.org>
parents: 7811
diff changeset
144
11067
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
145 (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
146 '("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
147 (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
148 '("Insert File..." . insert-file))
20762
ec3a35db5352 (menu-bar-file-menu): Add Recover Session menu item.
Richard M. Stallman <rms@gnu.org>
parents: 20647
diff changeset
149 (define-key menu-bar-files-menu [recover-session]
ec3a35db5352 (menu-bar-file-menu): Add Recover Session menu item.
Richard M. Stallman <rms@gnu.org>
parents: 20647
diff changeset
150 '("Recover Session..." . recover-session))
11067
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
151 (define-key menu-bar-files-menu [revert-buffer]
2178
76da020d14f8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 2177
diff changeset
152 '("Revert Buffer" . revert-buffer))
11067
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
153 (define-key menu-bar-files-menu [write-file]
2178
76da020d14f8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 2177
diff changeset
154 '("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
155 (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
156 (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
157 (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
158
20762
ec3a35db5352 (menu-bar-file-menu): Add Recover Session menu item.
Richard M. Stallman <rms@gnu.org>
parents: 20647
diff changeset
159 (put 'recover-session 'menu-enable
ec3a35db5352 (menu-bar-file-menu): Add Recover Session menu item.
Richard M. Stallman <rms@gnu.org>
parents: 20647
diff changeset
160 '(and auto-save-list-file-prefix
ec3a35db5352 (menu-bar-file-menu): Add Recover Session menu item.
Richard M. Stallman <rms@gnu.org>
parents: 20647
diff changeset
161 (directory-files
ec3a35db5352 (menu-bar-file-menu): Add Recover Session menu item.
Richard M. Stallman <rms@gnu.org>
parents: 20647
diff changeset
162 (file-name-directory auto-save-list-file-prefix)
ec3a35db5352 (menu-bar-file-menu): Add Recover Session menu item.
Richard M. Stallman <rms@gnu.org>
parents: 20647
diff changeset
163 nil
ec3a35db5352 (menu-bar-file-menu): Add Recover Session menu item.
Richard M. Stallman <rms@gnu.org>
parents: 20647
diff changeset
164 (concat "\\`"
ec3a35db5352 (menu-bar-file-menu): Add Recover Session menu item.
Richard M. Stallman <rms@gnu.org>
parents: 20647
diff changeset
165 (regexp-quote (file-name-nondirectory
ec3a35db5352 (menu-bar-file-menu): Add Recover Session menu item.
Richard M. Stallman <rms@gnu.org>
parents: 20647
diff changeset
166 auto-save-list-file-prefix)))
ec3a35db5352 (menu-bar-file-menu): Add Recover Session menu item.
Richard M. Stallman <rms@gnu.org>
parents: 20647
diff changeset
167 t)))
8010
e199eda519b5 Rearrange the edit and file menus, and add separators.
Richard M. Stallman <rms@gnu.org>
parents: 7811
diff changeset
168
11067
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
169 (defun nonincremental-search-forward (string)
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
170 "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
171 (interactive "sSearch for string: ")
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
172 (if (equal string "")
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
173 (search-forward (car search-ring))
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
174 (isearch-update-ring string nil)
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
175 (search-forward string)))
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
176
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
177 (defun nonincremental-search-backward (string)
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
178 "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
179 (interactive "sSearch for string: ")
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
180 (if (equal string "")
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
181 (search-backward (car search-ring))
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
182 (isearch-update-ring string nil)
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
183 (search-backward string)))
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
184
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
185 (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
186 "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
187 (interactive "sSearch for regexp: ")
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
188 (if (equal string "")
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
189 (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
190 (isearch-update-ring string t)
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
191 (re-search-forward string)))
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
192
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
193 (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
194 "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
195 (interactive "sSearch for regexp: ")
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
196 (if (equal string "")
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
197 (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
198 (isearch-update-ring string t)
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
199 (re-search-backward string)))
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
200
11525
3bd7735bba9b Disable many Files menu items in minibuffer.
Richard M. Stallman <rms@gnu.org>
parents: 11325
diff changeset
201 (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
202 "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
203 (interactive)
18483
4d66cfbc5735 (nonincremental-repeat-search-forward)
Richard M. Stallman <rms@gnu.org>
parents: 18288
diff changeset
204 (if (null search-ring)
4d66cfbc5735 (nonincremental-repeat-search-forward)
Richard M. Stallman <rms@gnu.org>
parents: 18288
diff changeset
205 (error "No previous search"))
11067
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
206 (search-forward (car search-ring)))
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
207
11525
3bd7735bba9b Disable many Files menu items in minibuffer.
Richard M. Stallman <rms@gnu.org>
parents: 11325
diff changeset
208 (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
209 "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
210 (interactive)
18483
4d66cfbc5735 (nonincremental-repeat-search-forward)
Richard M. Stallman <rms@gnu.org>
parents: 18288
diff changeset
211 (if (null search-ring)
4d66cfbc5735 (nonincremental-repeat-search-forward)
Richard M. Stallman <rms@gnu.org>
parents: 18288
diff changeset
212 (error "No previous search"))
11067
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
213 (search-backward (car search-ring)))
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
214
11525
3bd7735bba9b Disable many Files menu items in minibuffer.
Richard M. Stallman <rms@gnu.org>
parents: 11325
diff changeset
215 (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
216 "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
217 (interactive)
18484
fade5fd2fab4 Fix previous change.
Richard M. Stallman <rms@gnu.org>
parents: 18483
diff changeset
218 (if (null regexp-search-ring)
18483
4d66cfbc5735 (nonincremental-repeat-search-forward)
Richard M. Stallman <rms@gnu.org>
parents: 18288
diff changeset
219 (error "No previous search"))
11067
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
220 (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
221
11525
3bd7735bba9b Disable many Files menu items in minibuffer.
Richard M. Stallman <rms@gnu.org>
parents: 11325
diff changeset
222 (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
223 "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
224 (interactive)
18484
fade5fd2fab4 Fix previous change.
Richard M. Stallman <rms@gnu.org>
parents: 18483
diff changeset
225 (if (null regexp-search-ring)
18483
4d66cfbc5735 (nonincremental-repeat-search-forward)
Richard M. Stallman <rms@gnu.org>
parents: 18288
diff changeset
226 (error "No previous search"))
11067
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
227 (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
228
11525
3bd7735bba9b Disable many Files menu items in minibuffer.
Richard M. Stallman <rms@gnu.org>
parents: 11325
diff changeset
229 (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
230 '("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
231 (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
232 '("Query Replace..." . query-replace))
11067
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
233 (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
234 '("Find Tag..." . find-tag))
11067
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
235 (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
236 '("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
237
11067
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
238 (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
239 '("--"))
e199eda519b5 Rearrange the edit and file menus, and add separators.
Richard M. Stallman <rms@gnu.org>
parents: 7811
diff changeset
240
14291
3eb791861e23 (menu-bar-search-menu): Clean up key symbols.
Karl Heuer <kwzh@gnu.org>
parents: 14169
diff changeset
241 (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
242 '("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
243 (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
244 '("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
245 (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
246 '("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
247 (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
248 '("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
249
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
250 (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
251 '("--"))
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
252
14291
3eb791861e23 (menu-bar-search-menu): Clean up key symbols.
Karl Heuer <kwzh@gnu.org>
parents: 14169
diff changeset
253 (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
254 '("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
255 (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
256 '("Search Backwards..." . nonincremental-search-backward))
14291
3eb791861e23 (menu-bar-search-menu): Clean up key symbols.
Karl Heuer <kwzh@gnu.org>
parents: 14169
diff changeset
257 (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
258 '("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
259 (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
260 '("Search..." . nonincremental-search-forward))
11067
a73305d0a6b4 (menu-bar-files-menu): Renamed from ...-file-menu.
Richard M. Stallman <rms@gnu.org>
parents: 11044
diff changeset
261
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
262 (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
263 (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
264 (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
265 (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
266
e199eda519b5 Rearrange the edit and file menus, and add separators.
Richard M. Stallman <rms@gnu.org>
parents: 7811
diff changeset
267 (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
268 '("--"))
e199eda519b5 Rearrange the edit and file menus, and add separators.
Richard M. Stallman <rms@gnu.org>
parents: 7811
diff changeset
269
e199eda519b5 Rearrange the edit and file menus, and add separators.
Richard M. Stallman <rms@gnu.org>
parents: 7811
diff changeset
270 (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
271
11182
9fdd7498250f (menu-bar-edit-menu): Capitalize an item name.
Richard M. Stallman <rms@gnu.org>
parents: 11118
diff changeset
272 (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
273
441af4b664ac (yank-menu): New variable; kill-ring in menu format.
Karl Heuer <kwzh@gnu.org>
parents: 8525
diff changeset
274 (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
275 (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
276 (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
277 (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
278 (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
279 (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
280
10721
3d056c5a8319 (menu-bar-kill-ring-save): New function--use as `copy'.
Richard M. Stallman <rms@gnu.org>
parents: 10590
diff changeset
281 (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
282 (interactive "r")
3d056c5a8319 (menu-bar-kill-ring-save): New function--use as `copy'.
Richard M. Stallman <rms@gnu.org>
parents: 10590
diff changeset
283 (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
284 (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
285 (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
286
12427
04bcad1807b9 Make more menu-enables check (not buffer-read-only).
Richard M. Stallman <rms@gnu.org>
parents: 12199
diff changeset
287 (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
288 (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
289 (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
290 (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
291 (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
292 (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
293 (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
294 (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
295 (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
296 (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
297 pending-undo-list
04bcad1807b9 Make more menu-enables check (not buffer-read-only).
Richard M. Stallman <rms@gnu.org>
parents: 12199
diff changeset
298 (consp buffer-undo-list))))
9356
28c6c3d7efb4 (query-replace): Add missing quote.
Richard M. Stallman <rms@gnu.org>
parents: 8977
diff changeset
299 (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
300 (put 'query-replace-regexp 'menu-enable '(not buffer-read-only))
2175
61d3483521d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
301
4061
7279958409fe (ispell-menu-map): New autoload definition.
Richard M. Stallman <rms@gnu.org>
parents: 4048
diff changeset
302 (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
303
6699
59e74bc34228 (clipboard-yank, clipboard-kill-ring-save)
Richard M. Stallman <rms@gnu.org>
parents: 6513
diff changeset
304 ;; 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
305 ;; 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
306
59e74bc34228 (clipboard-yank, clipboard-kill-ring-save)
Richard M. Stallman <rms@gnu.org>
parents: 6513
diff changeset
307 (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
308 (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
309 (put 'clipboard-yank 'menu-enable
59e74bc34228 (clipboard-yank, clipboard-kill-ring-save)
Richard M. Stallman <rms@gnu.org>
parents: 6513
diff changeset
310 '(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
311
59e74bc34228 (clipboard-yank, clipboard-kill-ring-save)
Richard M. Stallman <rms@gnu.org>
parents: 6513
diff changeset
312 (defun clipboard-yank ()
59e74bc34228 (clipboard-yank, clipboard-kill-ring-save)
Richard M. Stallman <rms@gnu.org>
parents: 6513
diff changeset
313 "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
314 (interactive)
59e74bc34228 (clipboard-yank, clipboard-kill-ring-save)
Richard M. Stallman <rms@gnu.org>
parents: 6513
diff changeset
315 (let ((x-select-enable-clipboard t))
59e74bc34228 (clipboard-yank, clipboard-kill-ring-save)
Richard M. Stallman <rms@gnu.org>
parents: 6513
diff changeset
316 (yank)))
59e74bc34228 (clipboard-yank, clipboard-kill-ring-save)
Richard M. Stallman <rms@gnu.org>
parents: 6513
diff changeset
317
59e74bc34228 (clipboard-yank, clipboard-kill-ring-save)
Richard M. Stallman <rms@gnu.org>
parents: 6513
diff changeset
318 (defun clipboard-kill-ring-save (beg end)
59e74bc34228 (clipboard-yank, clipboard-kill-ring-save)
Richard M. Stallman <rms@gnu.org>
parents: 6513
diff changeset
319 "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
320 (interactive "r")
59e74bc34228 (clipboard-yank, clipboard-kill-ring-save)
Richard M. Stallman <rms@gnu.org>
parents: 6513
diff changeset
321 (let ((x-select-enable-clipboard t))
59e74bc34228 (clipboard-yank, clipboard-kill-ring-save)
Richard M. Stallman <rms@gnu.org>
parents: 6513
diff changeset
322 (kill-ring-save beg end)))
59e74bc34228 (clipboard-yank, clipboard-kill-ring-save)
Richard M. Stallman <rms@gnu.org>
parents: 6513
diff changeset
323
59e74bc34228 (clipboard-yank, clipboard-kill-ring-save)
Richard M. Stallman <rms@gnu.org>
parents: 6513
diff changeset
324 (defun clipboard-kill-region (beg end)
59e74bc34228 (clipboard-yank, clipboard-kill-ring-save)
Richard M. Stallman <rms@gnu.org>
parents: 6513
diff changeset
325 "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
326 (interactive "r")
59e74bc34228 (clipboard-yank, clipboard-kill-ring-save)
Richard M. Stallman <rms@gnu.org>
parents: 6513
diff changeset
327 (let ((x-select-enable-clipboard t))
59e74bc34228 (clipboard-yank, clipboard-kill-ring-save)
Richard M. Stallman <rms@gnu.org>
parents: 6513
diff changeset
328 (kill-region beg end)))
59e74bc34228 (clipboard-yank, clipboard-kill-ring-save)
Richard M. Stallman <rms@gnu.org>
parents: 6513
diff changeset
329
59e74bc34228 (clipboard-yank, clipboard-kill-ring-save)
Richard M. Stallman <rms@gnu.org>
parents: 6513
diff changeset
330 (defun menu-bar-enable-clipboard ()
8391
bb9718e6e844 (menu-bar-enable-clipboard): Moved here the
Richard M. Stallman <rms@gnu.org>
parents: 8347
diff changeset
331 "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
332 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
333 (interactive)
6948
54b252f540ea (menu-bar-enable-clipboard): Construct new cons cells.
Richard M. Stallman <rms@gnu.org>
parents: 6843
diff changeset
334 ;; 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
335 ;; 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
336 (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
337 (cons "Paste" 'clipboard-yank))
54b252f540ea (menu-bar-enable-clipboard): Construct new cons cells.
Richard M. Stallman <rms@gnu.org>
parents: 6843
diff changeset
338 (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
339 (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
340 (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
341 (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
342
8391
bb9718e6e844 (menu-bar-enable-clipboard): Moved here the
Richard M. Stallman <rms@gnu.org>
parents: 8347
diff changeset
343 (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
344 (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
345 (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
346 ;; X11R6 versions
bb9718e6e844 (menu-bar-enable-clipboard): Moved here the
Richard M. Stallman <rms@gnu.org>
parents: 8347
diff changeset
347 (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
348 (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
349 (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
350
17341
995c8b7bf6df (menu-bar-custom-menu): New variable; add it as a submenu of the Help menu.
Richard M. Stallman <rms@gnu.org>
parents: 17099
diff changeset
351
995c8b7bf6df (menu-bar-custom-menu): New variable; add it as a submenu of the Help menu.
Richard M. Stallman <rms@gnu.org>
parents: 17099
diff changeset
352 ;;; Menu support
995c8b7bf6df (menu-bar-custom-menu): New variable; add it as a submenu of the Help menu.
Richard M. Stallman <rms@gnu.org>
parents: 17099
diff changeset
353
995c8b7bf6df (menu-bar-custom-menu): New variable; add it as a submenu of the Help menu.
Richard M. Stallman <rms@gnu.org>
parents: 17099
diff changeset
354 (defvar menu-bar-custom-menu (make-sparse-keymap "Customize"))
995c8b7bf6df (menu-bar-custom-menu): New variable; add it as a submenu of the Help menu.
Richard M. Stallman <rms@gnu.org>
parents: 17099
diff changeset
355
18700
cb17c9cd025b (menu-bar-custom-menu): Add several more menu items.
Richard M. Stallman <rms@gnu.org>
parents: 18637
diff changeset
356 (define-key menu-bar-custom-menu [customize-apropos-groups]
cb17c9cd025b (menu-bar-custom-menu): Add several more menu items.
Richard M. Stallman <rms@gnu.org>
parents: 18637
diff changeset
357 '("Apropos Groups..." . customize-apropos-groups))
cb17c9cd025b (menu-bar-custom-menu): Add several more menu items.
Richard M. Stallman <rms@gnu.org>
parents: 18637
diff changeset
358 (define-key menu-bar-custom-menu [customize-apropos-faces]
cb17c9cd025b (menu-bar-custom-menu): Add several more menu items.
Richard M. Stallman <rms@gnu.org>
parents: 18637
diff changeset
359 '("Apropos Faces..." . customize-apropos-faces))
cb17c9cd025b (menu-bar-custom-menu): Add several more menu items.
Richard M. Stallman <rms@gnu.org>
parents: 18637
diff changeset
360 (define-key menu-bar-custom-menu [customize-apropos-options]
cb17c9cd025b (menu-bar-custom-menu): Add several more menu items.
Richard M. Stallman <rms@gnu.org>
parents: 18637
diff changeset
361 '("Apropos Options..." . customize-apropos-options))
17341
995c8b7bf6df (menu-bar-custom-menu): New variable; add it as a submenu of the Help menu.
Richard M. Stallman <rms@gnu.org>
parents: 17099
diff changeset
362 (define-key menu-bar-custom-menu [customize-apropos]
995c8b7bf6df (menu-bar-custom-menu): New variable; add it as a submenu of the Help menu.
Richard M. Stallman <rms@gnu.org>
parents: 17099
diff changeset
363 '("Apropos..." . customize-apropos))
18700
cb17c9cd025b (menu-bar-custom-menu): Add several more menu items.
Richard M. Stallman <rms@gnu.org>
parents: 18637
diff changeset
364 (define-key menu-bar-custom-menu [separator-2]
cb17c9cd025b (menu-bar-custom-menu): Add several more menu items.
Richard M. Stallman <rms@gnu.org>
parents: 18637
diff changeset
365 '("--"))
17615
32f90c43d1d2 (menu-bar-custom-menu):
Richard M. Stallman <rms@gnu.org>
parents: 17341
diff changeset
366 (define-key menu-bar-custom-menu [customize-group]
32f90c43d1d2 (menu-bar-custom-menu):
Richard M. Stallman <rms@gnu.org>
parents: 17341
diff changeset
367 '("Specific Group..." . customize-group))
17341
995c8b7bf6df (menu-bar-custom-menu): New variable; add it as a submenu of the Help menu.
Richard M. Stallman <rms@gnu.org>
parents: 17099
diff changeset
368 (define-key menu-bar-custom-menu [customize-face]
17615
32f90c43d1d2 (menu-bar-custom-menu):
Richard M. Stallman <rms@gnu.org>
parents: 17341
diff changeset
369 '("Specific Face..." . customize-face))
18700
cb17c9cd025b (menu-bar-custom-menu): Add several more menu items.
Richard M. Stallman <rms@gnu.org>
parents: 18637
diff changeset
370 (define-key menu-bar-custom-menu [customize-option]
cb17c9cd025b (menu-bar-custom-menu): Add several more menu items.
Richard M. Stallman <rms@gnu.org>
parents: 18637
diff changeset
371 '("Specific Option..." . customize-option))
21912
f485fe3e433e *** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents: 21302
diff changeset
372 (define-key menu-bar-custom-menu [customize-changed-options]
f485fe3e433e *** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents: 21302
diff changeset
373 '("Changed Options..." . customize-changed-options))
18700
cb17c9cd025b (menu-bar-custom-menu): Add several more menu items.
Richard M. Stallman <rms@gnu.org>
parents: 18637
diff changeset
374 (define-key menu-bar-custom-menu [separator-3]
cb17c9cd025b (menu-bar-custom-menu): Add several more menu items.
Richard M. Stallman <rms@gnu.org>
parents: 18637
diff changeset
375 '("--"))
18602
9b34ca7eb8ef Fix previous change.
Per Abrahamsen <abraham@dina.kvl.dk>
parents: 18601
diff changeset
376 (define-key menu-bar-custom-menu [customize-browse]
18700
cb17c9cd025b (menu-bar-custom-menu): Add several more menu items.
Richard M. Stallman <rms@gnu.org>
parents: 18637
diff changeset
377 '("Browse Customization Groups" . customize-browse))
cb17c9cd025b (menu-bar-custom-menu): Add several more menu items.
Richard M. Stallman <rms@gnu.org>
parents: 18637
diff changeset
378 (define-key menu-bar-custom-menu [customize]
cb17c9cd025b (menu-bar-custom-menu): Add several more menu items.
Richard M. Stallman <rms@gnu.org>
parents: 18637
diff changeset
379 '("Top-level Customization Group" . customize))
17341
995c8b7bf6df (menu-bar-custom-menu): New variable; add it as a submenu of the Help menu.
Richard M. Stallman <rms@gnu.org>
parents: 17099
diff changeset
380
19617
6337e9a0ed92 (menu-bar-make-toggle): New macro.
Richard M. Stallman <rms@gnu.org>
parents: 18700
diff changeset
381 ;; Options menu
19731
920d0a7b5930 (menu-bar-help-menu): Rename info item to "Info (Browse Manuals)".
Richard M. Stallman <rms@gnu.org>
parents: 19617
diff changeset
382 (defvar menu-bar-options-menu (make-sparse-keymap "Global Options"))
19617
6337e9a0ed92 (menu-bar-make-toggle): New macro.
Richard M. Stallman <rms@gnu.org>
parents: 18700
diff changeset
383
6337e9a0ed92 (menu-bar-make-toggle): New macro.
Richard M. Stallman <rms@gnu.org>
parents: 18700
diff changeset
384 (defmacro menu-bar-make-toggle (name variable doc message &rest body)
6337e9a0ed92 (menu-bar-make-toggle): New macro.
Richard M. Stallman <rms@gnu.org>
parents: 18700
diff changeset
385 `(progn
6337e9a0ed92 (menu-bar-make-toggle): New macro.
Richard M. Stallman <rms@gnu.org>
parents: 18700
diff changeset
386 (defun ,name ()
6337e9a0ed92 (menu-bar-make-toggle): New macro.
Richard M. Stallman <rms@gnu.org>
parents: 18700
diff changeset
387 ,(concat doc ".")
6337e9a0ed92 (menu-bar-make-toggle): New macro.
Richard M. Stallman <rms@gnu.org>
parents: 18700
diff changeset
388 (interactive)
6337e9a0ed92 (menu-bar-make-toggle): New macro.
Richard M. Stallman <rms@gnu.org>
parents: 18700
diff changeset
389 (if ,(if body `(progn . ,body)
6337e9a0ed92 (menu-bar-make-toggle): New macro.
Richard M. Stallman <rms@gnu.org>
parents: 18700
diff changeset
390 `(setq ,variable (not ,variable)))
6337e9a0ed92 (menu-bar-make-toggle): New macro.
Richard M. Stallman <rms@gnu.org>
parents: 18700
diff changeset
391 (message ,message "enabled")
6337e9a0ed92 (menu-bar-make-toggle): New macro.
Richard M. Stallman <rms@gnu.org>
parents: 18700
diff changeset
392 (message ,message "disabled")))
21302
77a4a1ce8d26 (menu-bar-options-menu): Remove "Toggle" from item
Richard M. Stallman <rms@gnu.org>
parents: 20762
diff changeset
393 '(menu-item ,doc ,name .
77a4a1ce8d26 (menu-bar-options-menu): Remove "Toggle" from item
Richard M. Stallman <rms@gnu.org>
parents: 20762
diff changeset
394 (:button (:toggle . (and (boundp ',variable) ,variable))))))
19617
6337e9a0ed92 (menu-bar-make-toggle): New macro.
Richard M. Stallman <rms@gnu.org>
parents: 18700
diff changeset
395
6337e9a0ed92 (menu-bar-make-toggle): New macro.
Richard M. Stallman <rms@gnu.org>
parents: 18700
diff changeset
396 (define-key menu-bar-options-menu [debug-on-quit]
6337e9a0ed92 (menu-bar-make-toggle): New macro.
Richard M. Stallman <rms@gnu.org>
parents: 18700
diff changeset
397 (menu-bar-make-toggle toggle-debug-on-quit debug-on-quit
21302
77a4a1ce8d26 (menu-bar-options-menu): Remove "Toggle" from item
Richard M. Stallman <rms@gnu.org>
parents: 20762
diff changeset
398 "Debug on Quit" "Debug on Quit %s"))
19617
6337e9a0ed92 (menu-bar-make-toggle): New macro.
Richard M. Stallman <rms@gnu.org>
parents: 18700
diff changeset
399 (define-key menu-bar-options-menu [debug-on-error]
6337e9a0ed92 (menu-bar-make-toggle): New macro.
Richard M. Stallman <rms@gnu.org>
parents: 18700
diff changeset
400 (menu-bar-make-toggle toggle-debug-on-error debug-on-error
21302
77a4a1ce8d26 (menu-bar-options-menu): Remove "Toggle" from item
Richard M. Stallman <rms@gnu.org>
parents: 20762
diff changeset
401 "Debug on Error" "Debug on Error %s"))
19617
6337e9a0ed92 (menu-bar-make-toggle): New macro.
Richard M. Stallman <rms@gnu.org>
parents: 18700
diff changeset
402 (define-key menu-bar-options-menu [options-separator]
6337e9a0ed92 (menu-bar-make-toggle): New macro.
Richard M. Stallman <rms@gnu.org>
parents: 18700
diff changeset
403 '("--"))
6337e9a0ed92 (menu-bar-make-toggle): New macro.
Richard M. Stallman <rms@gnu.org>
parents: 18700
diff changeset
404 (define-key menu-bar-options-menu [save-place]
6337e9a0ed92 (menu-bar-make-toggle): New macro.
Richard M. Stallman <rms@gnu.org>
parents: 18700
diff changeset
405 (menu-bar-make-toggle toggle-save-place-globally save-place
21302
77a4a1ce8d26 (menu-bar-options-menu): Remove "Toggle" from item
Richard M. Stallman <rms@gnu.org>
parents: 20762
diff changeset
406 "Save Place in Files between Sessions"
19617
6337e9a0ed92 (menu-bar-make-toggle): New macro.
Richard M. Stallman <rms@gnu.org>
parents: 18700
diff changeset
407 "Saving place in files %s"
21302
77a4a1ce8d26 (menu-bar-options-menu): Remove "Toggle" from item
Richard M. Stallman <rms@gnu.org>
parents: 20762
diff changeset
408 (require 'saveplace)
19617
6337e9a0ed92 (menu-bar-make-toggle): New macro.
Richard M. Stallman <rms@gnu.org>
parents: 18700
diff changeset
409 (setq-default save-place (not (default-value save-place)))))
6337e9a0ed92 (menu-bar-make-toggle): New macro.
Richard M. Stallman <rms@gnu.org>
parents: 18700
diff changeset
410 (define-key menu-bar-options-menu [uniquify]
6337e9a0ed92 (menu-bar-make-toggle): New macro.
Richard M. Stallman <rms@gnu.org>
parents: 18700
diff changeset
411 (menu-bar-make-toggle toggle-uniquify-buffer-names uniquify-buffer-name-style
21302
77a4a1ce8d26 (menu-bar-options-menu): Remove "Toggle" from item
Richard M. Stallman <rms@gnu.org>
parents: 20762
diff changeset
412 "Use Directory Names in Buffer Names"
19617
6337e9a0ed92 (menu-bar-make-toggle): New macro.
Richard M. Stallman <rms@gnu.org>
parents: 18700
diff changeset
413 "Directory name in buffer names (uniquify) %s"
6337e9a0ed92 (menu-bar-make-toggle): New macro.
Richard M. Stallman <rms@gnu.org>
parents: 18700
diff changeset
414 (require 'uniquify)
6337e9a0ed92 (menu-bar-make-toggle): New macro.
Richard M. Stallman <rms@gnu.org>
parents: 18700
diff changeset
415 (setq uniquify-buffer-name-style
6337e9a0ed92 (menu-bar-make-toggle): New macro.
Richard M. Stallman <rms@gnu.org>
parents: 18700
diff changeset
416 (if (not uniquify-buffer-name-style)
6337e9a0ed92 (menu-bar-make-toggle): New macro.
Richard M. Stallman <rms@gnu.org>
parents: 18700
diff changeset
417 'forward))))
22207
51847ba069f8 (toggle-case-fold-search): New command.
Richard M. Stallman <rms@gnu.org>
parents: 21912
diff changeset
418 (define-key menu-bar-options-menu [case-fold-search]
51847ba069f8 (toggle-case-fold-search): New command.
Richard M. Stallman <rms@gnu.org>
parents: 21912
diff changeset
419 (menu-bar-make-toggle toggle-case-fold-search case-fold-search
51847ba069f8 (toggle-case-fold-search): New command.
Richard M. Stallman <rms@gnu.org>
parents: 21912
diff changeset
420 "Case folding in searches"
51847ba069f8 (toggle-case-fold-search): New command.
Richard M. Stallman <rms@gnu.org>
parents: 21912
diff changeset
421 "Case folding in searches %s"))
19617
6337e9a0ed92 (menu-bar-make-toggle): New macro.
Richard M. Stallman <rms@gnu.org>
parents: 18700
diff changeset
422 (define-key menu-bar-options-menu [transient-mark-mode]
6337e9a0ed92 (menu-bar-make-toggle): New macro.
Richard M. Stallman <rms@gnu.org>
parents: 18700
diff changeset
423 (menu-bar-make-toggle toggle-transient-mark-mode transient-mark-mode
21302
77a4a1ce8d26 (menu-bar-options-menu): Remove "Toggle" from item
Richard M. Stallman <rms@gnu.org>
parents: 20762
diff changeset
424 "Transient Mark Mode (highlights region)"
19617
6337e9a0ed92 (menu-bar-make-toggle): New macro.
Richard M. Stallman <rms@gnu.org>
parents: 18700
diff changeset
425 "Transient Mark mode %s"))
6337e9a0ed92 (menu-bar-make-toggle): New macro.
Richard M. Stallman <rms@gnu.org>
parents: 18700
diff changeset
426 (define-key menu-bar-options-menu [toggle-auto-compression]
21302
77a4a1ce8d26 (menu-bar-options-menu): Remove "Toggle" from item
Richard M. Stallman <rms@gnu.org>
parents: 20762
diff changeset
427 '(menu-item "Automatic File De/compression"
77a4a1ce8d26 (menu-bar-options-menu): Remove "Toggle" from item
Richard M. Stallman <rms@gnu.org>
parents: 20762
diff changeset
428 auto-compression-mode .
77a4a1ce8d26 (menu-bar-options-menu): Remove "Toggle" from item
Richard M. Stallman <rms@gnu.org>
parents: 20762
diff changeset
429 (:button (:toggle . (rassq 'jka-compr-handler
77a4a1ce8d26 (menu-bar-options-menu): Remove "Toggle" from item
Richard M. Stallman <rms@gnu.org>
parents: 20762
diff changeset
430 file-name-handler-alist)))))
19617
6337e9a0ed92 (menu-bar-make-toggle): New macro.
Richard M. Stallman <rms@gnu.org>
parents: 18700
diff changeset
431 (define-key menu-bar-options-menu [auto-fill-mode]
21302
77a4a1ce8d26 (menu-bar-options-menu): Remove "Toggle" from item
Richard M. Stallman <rms@gnu.org>
parents: 20762
diff changeset
432 '(menu-item "Auto Fill (word wrap) in Text modes"
77a4a1ce8d26 (menu-bar-options-menu): Remove "Toggle" from item
Richard M. Stallman <rms@gnu.org>
parents: 20762
diff changeset
433 toggle-text-mode-auto-fill .
77a4a1ce8d26 (menu-bar-options-menu): Remove "Toggle" from item
Richard M. Stallman <rms@gnu.org>
parents: 20762
diff changeset
434 (:button (:toggle . (member 'turn-on-auto-fill text-mode-hook)))))
19793
8c5aca90861b (menu-bar-options-menu): Simplify global-font-lock-mode
Richard M. Stallman <rms@gnu.org>
parents: 19731
diff changeset
435 (define-key menu-bar-options-menu [toggle-global-lazy-font-lock-mode]
21302
77a4a1ce8d26 (menu-bar-options-menu): Remove "Toggle" from item
Richard M. Stallman <rms@gnu.org>
parents: 20762
diff changeset
436 (menu-bar-make-toggle toggle-global-lazy-font-lock-mode global-font-lock-mode
77a4a1ce8d26 (menu-bar-options-menu): Remove "Toggle" from item
Richard M. Stallman <rms@gnu.org>
parents: 20762
diff changeset
437 "Global Font Lock (highlights syntax)"
19793
8c5aca90861b (menu-bar-options-menu): Simplify global-font-lock-mode
Richard M. Stallman <rms@gnu.org>
parents: 19731
diff changeset
438 "Global Font Lock mode %s"
8c5aca90861b (menu-bar-options-menu): Simplify global-font-lock-mode
Richard M. Stallman <rms@gnu.org>
parents: 19731
diff changeset
439 ;; Make sure a support mode is used;
8c5aca90861b (menu-bar-options-menu): Simplify global-font-lock-mode
Richard M. Stallman <rms@gnu.org>
parents: 19731
diff changeset
440 ;; otherwise Font Lock will be too slow.
19731
920d0a7b5930 (menu-bar-help-menu): Rename info item to "Info (Browse Manuals)".
Richard M. Stallman <rms@gnu.org>
parents: 19617
diff changeset
441 (require 'font-lock)
19793
8c5aca90861b (menu-bar-options-menu): Simplify global-font-lock-mode
Richard M. Stallman <rms@gnu.org>
parents: 19731
diff changeset
442 (if (not global-font-lock-mode)
8c5aca90861b (menu-bar-options-menu): Simplify global-font-lock-mode
Richard M. Stallman <rms@gnu.org>
parents: 19731
diff changeset
443 (or font-lock-support-mode
8c5aca90861b (menu-bar-options-menu): Simplify global-font-lock-mode
Richard M. Stallman <rms@gnu.org>
parents: 19731
diff changeset
444 (setq font-lock-support-mode 'lazy-lock-mode)))
8c5aca90861b (menu-bar-options-menu): Simplify global-font-lock-mode
Richard M. Stallman <rms@gnu.org>
parents: 19731
diff changeset
445 (global-font-lock-mode)))
20336
6c26b3f61e02 (menu-bar-help-menu): Reorganize into more submenus.
Richard M. Stallman <rms@gnu.org>
parents: 19793
diff changeset
446
6c26b3f61e02 (menu-bar-help-menu): Reorganize into more submenus.
Richard M. Stallman <rms@gnu.org>
parents: 19793
diff changeset
447 (defvar menu-bar-describe-menu (make-sparse-keymap "Describe"))
6c26b3f61e02 (menu-bar-help-menu): Reorganize into more submenus.
Richard M. Stallman <rms@gnu.org>
parents: 19793
diff changeset
448
6c26b3f61e02 (menu-bar-help-menu): Reorganize into more submenus.
Richard M. Stallman <rms@gnu.org>
parents: 19793
diff changeset
449 (define-key menu-bar-describe-menu [describe-variable]
6c26b3f61e02 (menu-bar-help-menu): Reorganize into more submenus.
Richard M. Stallman <rms@gnu.org>
parents: 19793
diff changeset
450 '("Describe Variable..." . describe-variable))
6c26b3f61e02 (menu-bar-help-menu): Reorganize into more submenus.
Richard M. Stallman <rms@gnu.org>
parents: 19793
diff changeset
451 (define-key menu-bar-describe-menu [describe-function]
6c26b3f61e02 (menu-bar-help-menu): Reorganize into more submenus.
Richard M. Stallman <rms@gnu.org>
parents: 19793
diff changeset
452 '("Describe Function..." . describe-function))
6c26b3f61e02 (menu-bar-help-menu): Reorganize into more submenus.
Richard M. Stallman <rms@gnu.org>
parents: 19793
diff changeset
453 (define-key menu-bar-describe-menu [describe-key]
6c26b3f61e02 (menu-bar-help-menu): Reorganize into more submenus.
Richard M. Stallman <rms@gnu.org>
parents: 19793
diff changeset
454 '("Describe Key..." . describe-key))
6c26b3f61e02 (menu-bar-help-menu): Reorganize into more submenus.
Richard M. Stallman <rms@gnu.org>
parents: 19793
diff changeset
455 (define-key menu-bar-describe-menu [list-keybindings]
6c26b3f61e02 (menu-bar-help-menu): Reorganize into more submenus.
Richard M. Stallman <rms@gnu.org>
parents: 19793
diff changeset
456 '("List Key Bindings" . describe-bindings))
20342
3739e4f90a55 Fixed duplicate KEYs in menu-bar-describe-menu.
Simon Marshall <simon@gnu.org>
parents: 20336
diff changeset
457 (define-key menu-bar-describe-menu [apropos-variables]
20336
6c26b3f61e02 (menu-bar-help-menu): Reorganize into more submenus.
Richard M. Stallman <rms@gnu.org>
parents: 19793
diff changeset
458 '("Apropos Variables..." . apropos-variable))
20342
3739e4f90a55 Fixed duplicate KEYs in menu-bar-describe-menu.
Simon Marshall <simon@gnu.org>
parents: 20336
diff changeset
459 (define-key menu-bar-describe-menu [apropos-commands]
3739e4f90a55 Fixed duplicate KEYs in menu-bar-describe-menu.
Simon Marshall <simon@gnu.org>
parents: 20336
diff changeset
460 '("Apropos Commands..." . apropos-command))
20336
6c26b3f61e02 (menu-bar-help-menu): Reorganize into more submenus.
Richard M. Stallman <rms@gnu.org>
parents: 19793
diff changeset
461 (define-key menu-bar-describe-menu [describe-mode]
6c26b3f61e02 (menu-bar-help-menu): Reorganize into more submenus.
Richard M. Stallman <rms@gnu.org>
parents: 19793
diff changeset
462 '("Describe Buffer Modes" . describe-mode))
6c26b3f61e02 (menu-bar-help-menu): Reorganize into more submenus.
Richard M. Stallman <rms@gnu.org>
parents: 19793
diff changeset
463
6c26b3f61e02 (menu-bar-help-menu): Reorganize into more submenus.
Richard M. Stallman <rms@gnu.org>
parents: 19793
diff changeset
464 (defvar menu-bar-manuals-menu (make-sparse-keymap "Manuals"))
6c26b3f61e02 (menu-bar-help-menu): Reorganize into more submenus.
Richard M. Stallman <rms@gnu.org>
parents: 19793
diff changeset
465
6c26b3f61e02 (menu-bar-help-menu): Reorganize into more submenus.
Richard M. Stallman <rms@gnu.org>
parents: 19793
diff changeset
466 (define-key menu-bar-manuals-menu [man]
6c26b3f61e02 (menu-bar-help-menu): Reorganize into more submenus.
Richard M. Stallman <rms@gnu.org>
parents: 19793
diff changeset
467 '("Read Man Page..." . manual-entry))
6c26b3f61e02 (menu-bar-help-menu): Reorganize into more submenus.
Richard M. Stallman <rms@gnu.org>
parents: 19793
diff changeset
468 (define-key menu-bar-manuals-menu [sep2]
6c26b3f61e02 (menu-bar-help-menu): Reorganize into more submenus.
Richard M. Stallman <rms@gnu.org>
parents: 19793
diff changeset
469 '("--"))
6c26b3f61e02 (menu-bar-help-menu): Reorganize into more submenus.
Richard M. Stallman <rms@gnu.org>
parents: 19793
diff changeset
470 (define-key menu-bar-manuals-menu [key]
6c26b3f61e02 (menu-bar-help-menu): Reorganize into more submenus.
Richard M. Stallman <rms@gnu.org>
parents: 19793
diff changeset
471 '("Find Key in Manual" . Info-goto-emacs-key-command-node))
6c26b3f61e02 (menu-bar-help-menu): Reorganize into more submenus.
Richard M. Stallman <rms@gnu.org>
parents: 19793
diff changeset
472 (define-key menu-bar-manuals-menu [command]
6c26b3f61e02 (menu-bar-help-menu): Reorganize into more submenus.
Richard M. Stallman <rms@gnu.org>
parents: 19793
diff changeset
473 '("Find Command in Manual" . Info-goto-emacs-command-node))
6c26b3f61e02 (menu-bar-help-menu): Reorganize into more submenus.
Richard M. Stallman <rms@gnu.org>
parents: 19793
diff changeset
474 (define-key menu-bar-manuals-menu [info]
6c26b3f61e02 (menu-bar-help-menu): Reorganize into more submenus.
Richard M. Stallman <rms@gnu.org>
parents: 19793
diff changeset
475 '("Browse Manuals with Info" . info))
6c26b3f61e02 (menu-bar-help-menu): Reorganize into more submenus.
Richard M. Stallman <rms@gnu.org>
parents: 19793
diff changeset
476 (define-key menu-bar-manuals-menu [sep1]
6c26b3f61e02 (menu-bar-help-menu): Reorganize into more submenus.
Richard M. Stallman <rms@gnu.org>
parents: 19793
diff changeset
477 '("--"))
6c26b3f61e02 (menu-bar-help-menu): Reorganize into more submenus.
Richard M. Stallman <rms@gnu.org>
parents: 19793
diff changeset
478 (define-key menu-bar-manuals-menu [emacs-faq]
6c26b3f61e02 (menu-bar-help-menu): Reorganize into more submenus.
Richard M. Stallman <rms@gnu.org>
parents: 19793
diff changeset
479 '("Emacs FAQ" . view-emacs-FAQ))
6c26b3f61e02 (menu-bar-help-menu): Reorganize into more submenus.
Richard M. Stallman <rms@gnu.org>
parents: 19793
diff changeset
480 (define-key menu-bar-manuals-menu [emacs-news]
6c26b3f61e02 (menu-bar-help-menu): Reorganize into more submenus.
Richard M. Stallman <rms@gnu.org>
parents: 19793
diff changeset
481 '("Emacs News" . view-emacs-news))
19617
6337e9a0ed92 (menu-bar-make-toggle): New macro.
Richard M. Stallman <rms@gnu.org>
parents: 18700
diff changeset
482
20762
ec3a35db5352 (menu-bar-file-menu): Add Recover Session menu item.
Richard M. Stallman <rms@gnu.org>
parents: 20647
diff changeset
483 (define-key menu-bar-help-menu [describe-no-warranty]
ec3a35db5352 (menu-bar-file-menu): Add Recover Session menu item.
Richard M. Stallman <rms@gnu.org>
parents: 20647
diff changeset
484 '("(Non)Warranty" . describe-no-warranty))
ec3a35db5352 (menu-bar-file-menu): Add Recover Session menu item.
Richard M. Stallman <rms@gnu.org>
parents: 20647
diff changeset
485 (define-key menu-bar-help-menu [describe-copying]
ec3a35db5352 (menu-bar-file-menu): Add Recover Session menu item.
Richard M. Stallman <rms@gnu.org>
parents: 20647
diff changeset
486 '("Copying Conditions" . describe-copying))
ec3a35db5352 (menu-bar-file-menu): Add Recover Session menu item.
Richard M. Stallman <rms@gnu.org>
parents: 20647
diff changeset
487 (define-key menu-bar-help-menu [describe-distribution]
ec3a35db5352 (menu-bar-file-menu): Add Recover Session menu item.
Richard M. Stallman <rms@gnu.org>
parents: 20647
diff changeset
488 '("Getting New Versions" . describe-distribution))
7153
4e0683b070f8 (menu-bar-help-menu): Add item for emacs-version.
Richard M. Stallman <rms@gnu.org>
parents: 7150
diff changeset
489 (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
490 '("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
491 (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
492 '("Send Bug Report..." . report-emacs-bug))
20336
6c26b3f61e02 (menu-bar-help-menu): Reorganize into more submenus.
Richard M. Stallman <rms@gnu.org>
parents: 19793
diff changeset
493 (define-key menu-bar-help-menu [sep2]
6c26b3f61e02 (menu-bar-help-menu): Reorganize into more submenus.
Richard M. Stallman <rms@gnu.org>
parents: 19793
diff changeset
494 '("--"))
12558
98c9ac60aa20 (menu-bar-help-menu): Add finder-by-keyword.
Karl Heuer <kwzh@gnu.org>
parents: 12434
diff changeset
495 (define-key menu-bar-help-menu [finder-by-keyword]
20336
6c26b3f61e02 (menu-bar-help-menu): Reorganize into more submenus.
Richard M. Stallman <rms@gnu.org>
parents: 19793
diff changeset
496 '("Find Emacs Packages..." . finder-by-keyword))
6c26b3f61e02 (menu-bar-help-menu): Reorganize into more submenus.
Richard M. Stallman <rms@gnu.org>
parents: 19793
diff changeset
497 (define-key menu-bar-help-menu [describe]
6c26b3f61e02 (menu-bar-help-menu): Reorganize into more submenus.
Richard M. Stallman <rms@gnu.org>
parents: 19793
diff changeset
498 (cons "Describe" menu-bar-describe-menu))
6c26b3f61e02 (menu-bar-help-menu): Reorganize into more submenus.
Richard M. Stallman <rms@gnu.org>
parents: 19793
diff changeset
499 (define-key menu-bar-help-menu [manuals]
6c26b3f61e02 (menu-bar-help-menu): Reorganize into more submenus.
Richard M. Stallman <rms@gnu.org>
parents: 19793
diff changeset
500 (cons "Manuals" menu-bar-manuals-menu))
2178
76da020d14f8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 2177
diff changeset
501 (define-key menu-bar-help-menu [emacs-tutorial]
76da020d14f8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 2177
diff changeset
502 '("Emacs Tutorial" . help-with-tutorial))
20336
6c26b3f61e02 (menu-bar-help-menu): Reorganize into more submenus.
Richard M. Stallman <rms@gnu.org>
parents: 19793
diff changeset
503 (define-key menu-bar-help-menu [sep1]
6c26b3f61e02 (menu-bar-help-menu): Reorganize into more submenus.
Richard M. Stallman <rms@gnu.org>
parents: 19793
diff changeset
504 '("--"))
6c26b3f61e02 (menu-bar-help-menu): Reorganize into more submenus.
Richard M. Stallman <rms@gnu.org>
parents: 19793
diff changeset
505 (define-key menu-bar-help-menu [options]
19617
6337e9a0ed92 (menu-bar-make-toggle): New macro.
Richard M. Stallman <rms@gnu.org>
parents: 18700
diff changeset
506 (cons "Options" menu-bar-options-menu))
20336
6c26b3f61e02 (menu-bar-help-menu): Reorganize into more submenus.
Richard M. Stallman <rms@gnu.org>
parents: 19793
diff changeset
507 (define-key menu-bar-help-menu [customize]
17696
a30300999b49 (menu-bar-help-menu): Move "Customize" to the top.
Richard M. Stallman <rms@gnu.org>
parents: 17665
diff changeset
508 (cons "Customize" menu-bar-custom-menu))
2178
76da020d14f8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 2177
diff changeset
509
2175
61d3483521d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
510 (defun kill-this-buffer () ; for the menubar
61d3483521d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
511 "Kills the current buffer."
61d3483521d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
512 (interactive)
61d3483521d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
513 (kill-buffer (current-buffer)))
61d3483521d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
514
2178
76da020d14f8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 2177
diff changeset
515 (defun kill-this-buffer-enabled-p ()
76da020d14f8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 2177
diff changeset
516 (let ((count 0)
76da020d14f8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 2177
diff changeset
517 (buffers (buffer-list)))
76da020d14f8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 2177
diff changeset
518 (while buffers
76da020d14f8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 2177
diff changeset
519 (or (string-match "^ " (buffer-name (car buffers)))
76da020d14f8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 2177
diff changeset
520 (setq count (1+ count)))
76da020d14f8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 2177
diff changeset
521 (setq buffers (cdr buffers)))
16619
4f8448158c10 In enable predicates in Files menu, use menu-updating-frame.
Richard M. Stallman <rms@gnu.org>
parents: 15996
diff changeset
522 (and (not (window-minibuffer-p (frame-selected-window menu-updating-frame)))
11525
3bd7735bba9b Disable many Files menu items in minibuffer.
Richard M. Stallman <rms@gnu.org>
parents: 11325
diff changeset
523 (> count 1))))
3bd7735bba9b Disable many Files menu items in minibuffer.
Richard M. Stallman <rms@gnu.org>
parents: 11325
diff changeset
524
3bd7735bba9b Disable many Files menu items in minibuffer.
Richard M. Stallman <rms@gnu.org>
parents: 11325
diff changeset
525 (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
526
3bd7735bba9b Disable many Files menu items in minibuffer.
Richard M. Stallman <rms@gnu.org>
parents: 11325
diff changeset
527 (put 'save-buffer 'menu-enable
3bd7735bba9b Disable many Files menu items in minibuffer.
Richard M. Stallman <rms@gnu.org>
parents: 11325
diff changeset
528 '(and (buffer-modified-p)
16619
4f8448158c10 In enable predicates in Files menu, use menu-updating-frame.
Richard M. Stallman <rms@gnu.org>
parents: 15996
diff changeset
529 (not (window-minibuffer-p (frame-selected-window menu-updating-frame)))))
2178
76da020d14f8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 2177
diff changeset
530
11525
3bd7735bba9b Disable many Files menu items in minibuffer.
Richard M. Stallman <rms@gnu.org>
parents: 11325
diff changeset
531 (put 'write-file 'menu-enable
16619
4f8448158c10 In enable predicates in Files menu, use menu-updating-frame.
Richard M. Stallman <rms@gnu.org>
parents: 15996
diff changeset
532 '(not (window-minibuffer-p (frame-selected-window menu-updating-frame))))
11525
3bd7735bba9b Disable many Files menu items in minibuffer.
Richard M. Stallman <rms@gnu.org>
parents: 11325
diff changeset
533
3bd7735bba9b Disable many Files menu items in minibuffer.
Richard M. Stallman <rms@gnu.org>
parents: 11325
diff changeset
534 (put 'find-file 'menu-enable
16619
4f8448158c10 In enable predicates in Files menu, use menu-updating-frame.
Richard M. Stallman <rms@gnu.org>
parents: 15996
diff changeset
535 '(not (window-minibuffer-p (frame-selected-window menu-updating-frame))))
11525
3bd7735bba9b Disable many Files menu items in minibuffer.
Richard M. Stallman <rms@gnu.org>
parents: 11325
diff changeset
536
3bd7735bba9b Disable many Files menu items in minibuffer.
Richard M. Stallman <rms@gnu.org>
parents: 11325
diff changeset
537 (put 'dired 'menu-enable
16619
4f8448158c10 In enable predicates in Files menu, use menu-updating-frame.
Richard M. Stallman <rms@gnu.org>
parents: 15996
diff changeset
538 '(not (window-minibuffer-p (frame-selected-window menu-updating-frame))))
11525
3bd7735bba9b Disable many Files menu items in minibuffer.
Richard M. Stallman <rms@gnu.org>
parents: 11325
diff changeset
539
3bd7735bba9b Disable many Files menu items in minibuffer.
Richard M. Stallman <rms@gnu.org>
parents: 11325
diff changeset
540 (put 'insert-file 'menu-enable
16619
4f8448158c10 In enable predicates in Files menu, use menu-updating-frame.
Richard M. Stallman <rms@gnu.org>
parents: 15996
diff changeset
541 '(not (window-minibuffer-p (frame-selected-window menu-updating-frame))))
11525
3bd7735bba9b Disable many Files menu items in minibuffer.
Richard M. Stallman <rms@gnu.org>
parents: 11325
diff changeset
542
4114
5746e25610f8 (revert-buffer): Make menu-enable form more accurate
Richard M. Stallman <rms@gnu.org>
parents: 4101
diff changeset
543 (put 'revert-buffer 'menu-enable
5746e25610f8 (revert-buffer): Make menu-enable form more accurate
Richard M. Stallman <rms@gnu.org>
parents: 4101
diff changeset
544 '(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
545 (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
546 (or (buffer-modified-p)
cafb372921c3 (revert-buffer): Enable menu item when the buffer is modified.
Roland McGrath <roland@gnu.org>
parents: 4668
diff changeset
547 (not (verify-visited-file-modtime (current-buffer)))))))
11891
937c7fced6ee (delete-frame-enabled-p): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents: 11753
diff changeset
548
4337
cda282328afd (delete-frame): Permit it, if > 1 frame is vis or iconic.
Richard M. Stallman <rms@gnu.org>
parents: 4160
diff changeset
549 ;; 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
550 (put 'delete-frame 'menu-enable
11891
937c7fced6ee (delete-frame-enabled-p): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents: 11753
diff changeset
551 '(delete-frame-enabled-p))
937c7fced6ee (delete-frame-enabled-p): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents: 11753
diff changeset
552
937c7fced6ee (delete-frame-enabled-p): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents: 11753
diff changeset
553 (defun delete-frame-enabled-p ()
937c7fced6ee (delete-frame-enabled-p): New subroutine.
Karl Heuer <kwzh@gnu.org>
parents: 11753
diff changeset
554 "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
555 (let ((frames (frame-list))
15471
f0b473ee47a5 Whitespace change.
Richard M. Stallman <rms@gnu.org>
parents: 14792
diff changeset
556 (count 0))
f0b473ee47a5 Whitespace change.
Richard M. Stallman <rms@gnu.org>
parents: 14792
diff changeset
557 (while frames
f0b473ee47a5 Whitespace change.
Richard M. Stallman <rms@gnu.org>
parents: 14792
diff changeset
558 (if (frame-visible-p (car frames))
f0b473ee47a5 Whitespace change.
Richard M. Stallman <rms@gnu.org>
parents: 14792
diff changeset
559 (setq count (1+ count)))
f0b473ee47a5 Whitespace change.
Richard M. Stallman <rms@gnu.org>
parents: 14792
diff changeset
560 (setq frames (cdr frames)))
f0b473ee47a5 Whitespace change.
Richard M. Stallman <rms@gnu.org>
parents: 14792
diff changeset
561 (> count 1)))
2178
76da020d14f8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 2177
diff changeset
562
2175
61d3483521d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
563 (put 'advertised-undo 'menu-enable
61d3483521d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
564 '(and (not (eq t buffer-undo-list))
61d3483521d7 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
565 (if (eq last-command 'undo)
2178
76da020d14f8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 2177
diff changeset
566 (and (boundp 'pending-undo-list)
76da020d14f8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 2177
diff changeset
567 pending-undo-list)
76da020d14f8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 2177
diff changeset
568 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
569
17665
b11021ca3525 Use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17615
diff changeset
570 (defcustom yank-menu-length 20
b11021ca3525 Use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17615
diff changeset
571 "*Maximum length to display in the yank-menu."
b11021ca3525 Use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17615
diff changeset
572 :type 'integer
b11021ca3525 Use defcustom.
Richard M. Stallman <rms@gnu.org>
parents: 17615
diff changeset
573 :group 'mouse)
3795
d59af8c9bc65 (mouse-menu-choose-yank): New function. Put it in the edit menu.
Richard M. Stallman <rms@gnu.org>
parents: 3504
diff changeset
574
8767
441af4b664ac (yank-menu): New variable; kill-ring in menu format.
Karl Heuer <kwzh@gnu.org>
parents: 8525
diff changeset
575 (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
576 (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
577 (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
578 string
10590
9f68d8d6357b (menu-bar-update-yank-menu): If string is too long,
Richard M. Stallman <rms@gnu.org>
parents: 9667
diff changeset
579 (concat
9f68d8d6357b (menu-bar-update-yank-menu): If string is too long,
Richard M. Stallman <rms@gnu.org>
parents: 9667
diff changeset
580 (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
581 "..."
9f68d8d6357b (menu-bar-update-yank-menu): If string is too long,
Richard M. Stallman <rms@gnu.org>
parents: 9667
diff changeset
582 (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
583 ;; 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
584 ;; 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
585 (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
586 (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
587 ;; 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
588 ;; 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
589 (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
590 (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
591 (progn
8767
441af4b664ac (yank-menu): New variable; kill-ring in menu format.
Karl Heuer <kwzh@gnu.org>
parents: 8525
diff changeset
592 (setcar front string)
441af4b664ac (yank-menu): New variable; kill-ring in menu format.
Karl Heuer <kwzh@gnu.org>
parents: 8525
diff changeset
593 (setcar (cdr front) menu-string))
441af4b664ac (yank-menu): New variable; kill-ring in menu format.
Karl Heuer <kwzh@gnu.org>
parents: 8525
diff changeset
594 (setcdr yank-menu
441af4b664ac (yank-menu): New variable; kill-ring in menu format.
Karl Heuer <kwzh@gnu.org>
parents: 8525
diff changeset
595 (cons
441af4b664ac (yank-menu): New variable; kill-ring in menu format.
Karl Heuer <kwzh@gnu.org>
parents: 8525
diff changeset
596 (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
597 (cdr yank-menu)))))
441af4b664ac (yank-menu): New variable; kill-ring in menu format.
Karl Heuer <kwzh@gnu.org>
parents: 8525
diff changeset
598 (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
599 (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
600
20481
77ed0446c90a (menu-bar-select-yank): Add apropos-inhibit property.
Richard M. Stallman <rms@gnu.org>
parents: 20342
diff changeset
601 (put 'menu-bar-select-yank 'apropos-inhibit t)
8767
441af4b664ac (yank-menu): New variable; kill-ring in menu format.
Karl Heuer <kwzh@gnu.org>
parents: 8525
diff changeset
602 (defun menu-bar-select-yank ()
441af4b664ac (yank-menu): New variable; kill-ring in menu format.
Karl Heuer <kwzh@gnu.org>
parents: 8525
diff changeset
603 (interactive "*")
441af4b664ac (yank-menu): New variable; kill-ring in menu format.
Karl Heuer <kwzh@gnu.org>
parents: 8525
diff changeset
604 (push-mark (point))
441af4b664ac (yank-menu): New variable; kill-ring in menu format.
Karl Heuer <kwzh@gnu.org>
parents: 8525
diff changeset
605 (insert last-command-event))
2181
5a9d9dcc4750 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 2178
diff changeset
606
12633
c05399b944ab (menu-bar-buffer-menu): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents: 12610
diff changeset
607 ;; 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
608 ;; 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
609 (define-key global-map [menu-bar buffer]
c05399b944ab (menu-bar-buffer-menu): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents: 12610
diff changeset
610 (cons "Buffers" (make-sparse-keymap "Buffers")))
2178
76da020d14f8 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 2177
diff changeset
611
4628
e55cc9fdaa92 (list-buffers-directory): Add declaration.
Richard M. Stallman <rms@gnu.org>
parents: 4603
diff changeset
612 (defvar list-buffers-directory nil)
e55cc9fdaa92 (list-buffers-directory): Add declaration.
Richard M. Stallman <rms@gnu.org>
parents: 4603
diff changeset
613
9667
49eee3cb0ffa (menu-bar-file-menu): Add item `Make Frame On Display'.
Richard M. Stallman <rms@gnu.org>
parents: 9518
diff changeset
614 (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
615
7150
b78bfe054561 Make a sub-keymap for the Buffers menu bar item.
Richard M. Stallman <rms@gnu.org>
parents: 6948
diff changeset
616 (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
617 (interactive)
b78bfe054561 Make a sub-keymap for the Buffers menu bar item.
Richard M. Stallman <rms@gnu.org>
parents: 6948
diff changeset
618 (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
619
b78bfe054561 Make a sub-keymap for the Buffers menu bar item.
Richard M. Stallman <rms@gnu.org>
parents: 6948
diff changeset
620 (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
621 (interactive)
b78bfe054561 Make a sub-keymap for the Buffers menu bar item.
Richard M. Stallman <rms@gnu.org>
parents: 6948
diff changeset
622 (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
623 (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
624 (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
625
9518
69072971d37e (menu-bar-update-buffers-1): New subroutine
Richard M. Stallman <rms@gnu.org>
parents: 9422
diff changeset
626 (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
627 (cons (format
9667
49eee3cb0ffa (menu-bar-file-menu): Add item `Make Frame On Display'.
Richard M. Stallman <rms@gnu.org>
parents: 9518
diff changeset
628 (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
629 (cdr elt)
69072971d37e (menu-bar-update-buffers-1): New subroutine
Richard M. Stallman <rms@gnu.org>
parents: 9422
diff changeset
630 (if (buffer-modified-p (car elt))
69072971d37e (menu-bar-update-buffers-1): New subroutine
Richard M. Stallman <rms@gnu.org>
parents: 9422
diff changeset
631 "*" " ")
69072971d37e (menu-bar-update-buffers-1): New subroutine
Richard M. Stallman <rms@gnu.org>
parents: 9422
diff changeset
632 (save-excursion
69072971d37e (menu-bar-update-buffers-1): New subroutine
Richard M. Stallman <rms@gnu.org>
parents: 9422
diff changeset
633 (set-buffer (car elt))
69072971d37e (menu-bar-update-buffers-1): New subroutine
Richard M. Stallman <rms@gnu.org>
parents: 9422
diff changeset
634 (if buffer-read-only "%" " "))
69072971d37e (menu-bar-update-buffers-1): New subroutine
Richard M. Stallman <rms@gnu.org>
parents: 9422
diff changeset
635 (let ((file
69072971d37e (menu-bar-update-buffers-1): New subroutine
Richard M. Stallman <rms@gnu.org>
parents: 9422
diff changeset
636 (or (buffer-file-name (car elt))
69072971d37e (menu-bar-update-buffers-1): New subroutine
Richard M. Stallman <rms@gnu.org>
parents: 9422
diff changeset
637 (save-excursion
69072971d37e (menu-bar-update-buffers-1): New subroutine
Richard M. Stallman <rms@gnu.org>
parents: 9422
diff changeset
638 (set-buffer (car elt))
69072971d37e (menu-bar-update-buffers-1): New subroutine
Richard M. Stallman <rms@gnu.org>
parents: 9422
diff changeset
639 list-buffers-directory)
69072971d37e (menu-bar-update-buffers-1): New subroutine
Richard M. Stallman <rms@gnu.org>
parents: 9422
diff changeset
640 "")))
69072971d37e (menu-bar-update-buffers-1): New subroutine
Richard M. Stallman <rms@gnu.org>
parents: 9422
diff changeset
641 (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
642 ""))
69072971d37e (menu-bar-update-buffers-1): New subroutine
Richard M. Stallman <rms@gnu.org>
parents: 9422
diff changeset
643 (if (> (length file) 20)
69072971d37e (menu-bar-update-buffers-1): New subroutine
Richard M. Stallman <rms@gnu.org>
parents: 9422
diff changeset
644 (setq file (concat "..." (substring file -17))))
69072971d37e (menu-bar-update-buffers-1): New subroutine
Richard M. Stallman <rms@gnu.org>
parents: 9422
diff changeset
645 file))
69072971d37e (menu-bar-update-buffers-1): New subroutine
Richard M. Stallman <rms@gnu.org>
parents: 9422
diff changeset
646 (car elt)))
69072971d37e (menu-bar-update-buffers-1): New subroutine
Richard M. Stallman <rms@gnu.org>
parents: 9422
diff changeset
647
11325
032239e758c4 (menu-bar-update-buffers): Reuse the entry for
Richard M. Stallman <rms@gnu.org>
parents: 11309
diff changeset
648 (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
649
7150
b78bfe054561 Make a sub-keymap for the Buffers menu bar item.
Richard M. Stallman <rms@gnu.org>
parents: 6948
diff changeset
650 (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
651 ;; 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
652 (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
653 (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
654 (let ((buffers (buffer-list))
abf26f5c67e4 (menu-bar-update-buffers): If Buffers item is gone,
Richard M. Stallman <rms@gnu.org>
parents: 8229
diff changeset
655 (frames (frame-list))
15996
0704ccc73df8 (menu-bar-update-buffers): Make the Frames menu a submenu of the Buffers menu.
Richard M. Stallman <rms@gnu.org>
parents: 15471
diff changeset
656 (maxlen 0)
8316
abf26f5c67e4 (menu-bar-update-buffers): If Buffers item is gone,
Richard M. Stallman <rms@gnu.org>
parents: 8229
diff changeset
657 buffers-menu frames-menu)
abf26f5c67e4 (menu-bar-update-buffers): If Buffers item is gone,
Richard M. Stallman <rms@gnu.org>
parents: 8229
diff changeset
658 ;; 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
659 (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
660 (> 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
661 (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
662 (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
663
8316
abf26f5c67e4 (menu-bar-update-buffers): If Buffers item is gone,
Richard M. Stallman <rms@gnu.org>
parents: 8229
diff changeset
664 ;; 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
665 (setq buffers-menu
abf26f5c67e4 (menu-bar-update-buffers): If Buffers item is gone,
Richard M. Stallman <rms@gnu.org>
parents: 8229
diff changeset
666 (cons "Select Buffer"
9518
69072971d37e (menu-bar-update-buffers-1): New subroutine
Richard M. Stallman <rms@gnu.org>
parents: 9422
diff changeset
667 (let* ((buffer-list
69072971d37e (menu-bar-update-buffers-1): New subroutine
Richard M. Stallman <rms@gnu.org>
parents: 9422
diff changeset
668 (mapcar 'list buffers))
69072971d37e (menu-bar-update-buffers-1): New subroutine
Richard M. Stallman <rms@gnu.org>
parents: 9422
diff changeset
669 tail
9667
49eee3cb0ffa (menu-bar-file-menu): Add item `Make Frame On Display'.
Richard M. Stallman <rms@gnu.org>
parents: 9518
diff changeset
670 (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
671 alist
69072971d37e (menu-bar-update-buffers-1): New subroutine
Richard M. Stallman <rms@gnu.org>
parents: 9422
diff changeset
672 head)
69072971d37e (menu-bar-update-buffers-1): New subroutine
Richard M. Stallman <rms@gnu.org>
parents: 9422
diff changeset
673 ;; 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
674 ;; the name for actual display,
69072971d37e (menu-bar-update-buffers-1): New subroutine
Richard M. Stallman <rms@gnu.org>
parents: 9422
diff changeset
675 ;; perhaps truncated in the middle.
69072971d37e (menu-bar-update-buffers-1): New subroutine
Richard M. Stallman <rms@gnu.org>
parents: 9422
diff changeset
676 (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
677 (while tail
9518
69072971d37e (menu-bar-update-buffers-1): New subroutine
Richard M. Stallman <rms@gnu.org>
parents: 9422
diff changeset
678 (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
679 (setcdr (car tail)
69072971d37e (menu-bar-update-buffers-1): New subroutine
Richard M. Stallman <rms@gnu.org>
parents: 9422
diff changeset
680 (if (> (length name) 27)
69072971d37e (menu-bar-update-buffers-1): New subroutine
Richard M. Stallman <rms@gnu.org>
parents: 9422
diff changeset
681 (concat (substring name 0 12)
69072971d37e (menu-bar-update-buffers-1): New subroutine
Richard M. Stallman <rms@gnu.org>
parents: 9422
diff changeset
682 "..."
69072971d37e (menu-bar-update-buffers-1): New subroutine
Richard M. Stallman <rms@gnu.org>
parents: 9422
diff changeset
683 (substring name -12))
69072971d37e (menu-bar-update-buffers-1): New subroutine
Richard M. Stallman <rms@gnu.org>
parents: 9422
diff changeset
684 name)))
69072971d37e (menu-bar-update-buffers-1): New subroutine
Richard M. Stallman <rms@gnu.org>
parents: 9422
diff changeset
685 (setq tail (cdr tail)))
69072971d37e (menu-bar-update-buffers-1): New subroutine
Richard M. Stallman <rms@gnu.org>
parents: 9422
diff changeset
686 ;; 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
687 (setq tail buffer-list)
69072971d37e (menu-bar-update-buffers-1): New subroutine
Richard M. Stallman <rms@gnu.org>
parents: 9422
diff changeset
688 (while tail
69072971d37e (menu-bar-update-buffers-1): New subroutine
Richard M. Stallman <rms@gnu.org>
parents: 9422
diff changeset
689 (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
690 (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
691 (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
692 (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
693 (setq tail (cdr tail)))
9518
69072971d37e (menu-bar-update-buffers-1): New subroutine
Richard M. Stallman <rms@gnu.org>
parents: 9422
diff changeset
694 ;; 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
695 ;; ITEM-STRING . BUFFER
69072971d37e (menu-bar-update-buffers-1): New subroutine
Richard M. Stallman <rms@gnu.org>
parents: 9422
diff changeset
696 (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
697 (while tail
abf26f5c67e4 (menu-bar-update-buffers): If Buffers item is gone,
Richard M. Stallman <rms@gnu.org>
parents: 8229
diff changeset
698 (let ((elt (car tail)))
9518
69072971d37e (menu-bar-update-buffers-1): New subroutine
Richard M. Stallman <rms@gnu.org>
parents: 9422
diff changeset
699 (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
700 (setq alist (cons
9518
69072971d37e (menu-bar-update-buffers-1): New subroutine
Richard M. Stallman <rms@gnu.org>
parents: 9422
diff changeset
701 (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
702 alist)))
abf26f5c67e4 (menu-bar-update-buffers): If Buffers item is gone,
Richard M. Stallman <rms@gnu.org>
parents: 8229
diff changeset
703 (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
704 (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
705 (setq tail (cdr tail)))
abf26f5c67e4 (menu-bar-update-buffers): If Buffers item is gone,
Richard M. Stallman <rms@gnu.org>
parents: 8229
diff changeset
706 (setq alist (nreverse alist))
11325
032239e758c4 (menu-bar-update-buffers): Reuse the entry for
Richard M. Stallman <rms@gnu.org>
parents: 11309
diff changeset
707 ;; 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
708 ;; 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
709 ;; The advantage in reusing one
032239e758c4 (menu-bar-update-buffers): Reuse the entry for
Richard M. Stallman <rms@gnu.org>
parents: 11309
diff changeset
710 ;; 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
711 ;; 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
712 (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
713 (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
714 (cons
032239e758c4 (menu-bar-update-buffers): Reuse the entry for
Richard M. Stallman <rms@gnu.org>
parents: 11309
diff changeset
715 'list-buffers
032239e758c4 (menu-bar-update-buffers): Reuse the entry for
Richard M. Stallman <rms@gnu.org>
parents: 11309
diff changeset
716 (cons
032239e758c4 (menu-bar-update-buffers): Reuse the entry for
Richard M. Stallman <rms@gnu.org>
parents: 11309
diff changeset
717 ""
032239e758c4 (menu-bar-update-buffers): Reuse the entry for
Richard M. Stallman <rms@gnu.org>
parents: 11309
diff changeset
718 'list-buffers))))
032239e758c4 (menu-bar-update-buffers): Reuse the entry for
Richard M. Stallman <rms@gnu.org>
parents: 11309
diff changeset
719 ;; 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
720 (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
721 (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
722 ?\ )
032239e758c4 (menu-bar-update-buffers): Reuse the entry for
Richard M. Stallman <rms@gnu.org>
parents: 11309
diff changeset
723 "List All Buffers"))
032239e758c4 (menu-bar-update-buffers): Reuse the entry for
Richard M. Stallman <rms@gnu.org>
parents: 11309
diff changeset
724 ;; 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
725 ;; 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
726 (nconc (mapcar '(lambda (pair)
abf26f5c67e4 (menu-bar-update-buffers): If Buffers item is gone,
Richard M. Stallman <rms@gnu.org>
parents: 8229
diff changeset
727 ;; 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
728 ;; 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
729 ;; 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
730 ;; 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
731 ;; 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
732 ;; own meaning.
abf26f5c67e4 (menu-bar-update-buffers): If Buffers item is gone,
Richard M. Stallman <rms@gnu.org>
parents: 8229
diff changeset
733 (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
734 (car pair)
abf26f5c67e4 (menu-bar-update-buffers): If Buffers item is gone,
Richard M. Stallman <rms@gnu.org>
parents: 8229
diff changeset
735 (cons nil nil))
abf26f5c67e4 (menu-bar-update-buffers): If Buffers item is gone,
Richard M. Stallman <rms@gnu.org>
parents: 8229
diff changeset
736 'menu-bar-select-buffer))
abf26f5c67e4 (menu-bar-update-buffers): If Buffers item is gone,
Richard M. Stallman <rms@gnu.org>
parents: 8229
diff changeset
737 alist)
11325
032239e758c4 (menu-bar-update-buffers): Reuse the entry for
Richard M. Stallman <rms@gnu.org>
parents: 11309
diff changeset
738 (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
739
7239
385ac6718f28 (menu-bar-update-buffers): Fix misspelled variable.
Karl Heuer <kwzh@gnu.org>
parents: 7234
diff changeset
740
8316
abf26f5c67e4 (menu-bar-update-buffers): If Buffers item is gone,
Richard M. Stallman <rms@gnu.org>
parents: 8229
diff changeset
741 ;; 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
742 (if (cdr frames)
15996
0704ccc73df8 (menu-bar-update-buffers): Make the Frames menu a submenu of the Buffers menu.
Richard M. Stallman <rms@gnu.org>
parents: 15471
diff changeset
743 (let ((name (concat (make-string (max (- (/ maxlen 2) 3) 0)
0704ccc73df8 (menu-bar-update-buffers): Make the Frames menu a submenu of the Buffers menu.
Richard M. Stallman <rms@gnu.org>
parents: 15471
diff changeset
744 ?\ )
0704ccc73df8 (menu-bar-update-buffers): Make the Frames menu a submenu of the Buffers menu.
Richard M. Stallman <rms@gnu.org>
parents: 15471
diff changeset
745 "Frames"))
0704ccc73df8 (menu-bar-update-buffers): Make the Frames menu a submenu of the Buffers menu.
Richard M. Stallman <rms@gnu.org>
parents: 15471
diff changeset
746 (frames-menu
0704ccc73df8 (menu-bar-update-buffers): Make the Frames menu a submenu of the Buffers menu.
Richard M. Stallman <rms@gnu.org>
parents: 15471
diff changeset
747 (cons 'keymap
0704ccc73df8 (menu-bar-update-buffers): Make the Frames menu a submenu of the Buffers menu.
Richard M. Stallman <rms@gnu.org>
parents: 15471
diff changeset
748 (cons "Select Frame"
0704ccc73df8 (menu-bar-update-buffers): Make the Frames menu a submenu of the Buffers menu.
Richard M. Stallman <rms@gnu.org>
parents: 15471
diff changeset
749 (mapcar '(lambda (frame)
0704ccc73df8 (menu-bar-update-buffers): Make the Frames menu a submenu of the Buffers menu.
Richard M. Stallman <rms@gnu.org>
parents: 15471
diff changeset
750 (nconc (list frame
0704ccc73df8 (menu-bar-update-buffers): Make the Frames menu a submenu of the Buffers menu.
Richard M. Stallman <rms@gnu.org>
parents: 15471
diff changeset
751 (cdr (assq 'name
0704ccc73df8 (menu-bar-update-buffers): Make the Frames menu a submenu of the Buffers menu.
Richard M. Stallman <rms@gnu.org>
parents: 15471
diff changeset
752 (frame-parameters frame)))
0704ccc73df8 (menu-bar-update-buffers): Make the Frames menu a submenu of the Buffers menu.
Richard M. Stallman <rms@gnu.org>
parents: 15471
diff changeset
753 (cons nil nil))
0704ccc73df8 (menu-bar-update-buffers): Make the Frames menu a submenu of the Buffers menu.
Richard M. Stallman <rms@gnu.org>
parents: 15471
diff changeset
754 'menu-bar-select-frame))
0704ccc73df8 (menu-bar-update-buffers): Make the Frames menu a submenu of the Buffers menu.
Richard M. Stallman <rms@gnu.org>
parents: 15471
diff changeset
755 frames)))))
0704ccc73df8 (menu-bar-update-buffers): Make the Frames menu a submenu of the Buffers menu.
Richard M. Stallman <rms@gnu.org>
parents: 15471
diff changeset
756 ;; Put it underneath the Buffers menu.
0704ccc73df8 (menu-bar-update-buffers): Make the Frames menu a submenu of the Buffers menu.
Richard M. Stallman <rms@gnu.org>
parents: 15471
diff changeset
757 (setq buffers-menu (cons (cons 'frames (cons name frames-menu))
0704ccc73df8 (menu-bar-update-buffers): Make the Frames menu a submenu of the Buffers menu.
Richard M. Stallman <rms@gnu.org>
parents: 15471
diff changeset
758 buffers-menu))))
8316
abf26f5c67e4 (menu-bar-update-buffers): If Buffers item is gone,
Richard M. Stallman <rms@gnu.org>
parents: 8229
diff changeset
759 (if buffers-menu
abf26f5c67e4 (menu-bar-update-buffers): If Buffers item is gone,
Richard M. Stallman <rms@gnu.org>
parents: 8229
diff changeset
760 (setq buffers-menu (cons 'keymap buffers-menu)))
8347
0fff2106fa43 (menu-bar-update-buffers): Use (current-global-map), not global-map.
Richard M. Stallman <rms@gnu.org>
parents: 8320
diff changeset
761 (define-key (current-global-map) [menu-bar buffer]
15996
0704ccc73df8 (menu-bar-update-buffers): Make the Frames menu a submenu of the Buffers menu.
Richard M. Stallman <rms@gnu.org>
parents: 15471
diff changeset
762 (cons "Buffers" buffers-menu)))))
2181
5a9d9dcc4750 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 2178
diff changeset
763
7150
b78bfe054561 Make a sub-keymap for the Buffers menu bar item.
Richard M. Stallman <rms@gnu.org>
parents: 6948
diff changeset
764 (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
765
12633
c05399b944ab (menu-bar-buffer-menu): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents: 12610
diff changeset
766 (menu-bar-update-buffers)
c05399b944ab (menu-bar-buffer-menu): Function deleted.
Richard M. Stallman <rms@gnu.org>
parents: 12610
diff changeset
767
2181
5a9d9dcc4750 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 2178
diff changeset
768 ;; this version is too slow
5a9d9dcc4750 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 2178
diff changeset
769 ;;;(defun format-buffers-menu-line (buffer)
5a9d9dcc4750 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 2178
diff changeset
770 ;;; "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
771 ;;;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
772 ;;; (if (string-match "\\` " (buffer-name buffer))
5a9d9dcc4750 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 2178
diff changeset
773 ;;; nil
5a9d9dcc4750 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 2178
diff changeset
774 ;;; (save-excursion
5a9d9dcc4750 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 2178
diff changeset
775 ;;; (set-buffer buffer)
5a9d9dcc4750 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 2178
diff changeset
776 ;;; (let ((size (buffer-size)))
5a9d9dcc4750 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 2178
diff changeset
777 ;;; (format "%s%s %-19s %6s %-15s %s"
5a9d9dcc4750 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 2178
diff changeset
778 ;;; (if (buffer-modified-p) "*" " ")
5a9d9dcc4750 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 2178
diff changeset
779 ;;; (if buffer-read-only "%" " ")
5a9d9dcc4750 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 2178
diff changeset
780 ;;; (buffer-name)
5a9d9dcc4750 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 2178
diff changeset
781 ;;; size
5a9d9dcc4750 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 2178
diff changeset
782 ;;; mode-name
5a9d9dcc4750 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 2178
diff changeset
783 ;;; (or (buffer-file-name) ""))))))
5a9d9dcc4750 *** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents: 2178
diff changeset
784
12427
04bcad1807b9 Make more menu-enables check (not buffer-read-only).
Richard M. Stallman <rms@gnu.org>
parents: 12199
diff changeset
785 ;;; 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
786
04bcad1807b9 Make more menu-enables check (not buffer-read-only).
Richard M. Stallman <rms@gnu.org>
parents: 12199
diff changeset
787 (mapcar
04bcad1807b9 Make more menu-enables check (not buffer-read-only).
Richard M. Stallman <rms@gnu.org>
parents: 12199
diff changeset
788 (function
04bcad1807b9 Make more menu-enables check (not buffer-read-only).
Richard M. Stallman <rms@gnu.org>
parents: 12199
diff changeset
789 (lambda (map)
04bcad1807b9 Make more menu-enables check (not buffer-read-only).
Richard M. Stallman <rms@gnu.org>
parents: 12199
diff changeset
790 (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
791 (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
792 (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
793 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
794 minibuffer-local-isearch-map
04bcad1807b9 Make more menu-enables check (not buffer-read-only).
Richard M. Stallman <rms@gnu.org>
parents: 12199
diff changeset
795 minibuffer-local-map
04bcad1807b9 Make more menu-enables check (not buffer-read-only).
Richard M. Stallman <rms@gnu.org>
parents: 12199
diff changeset
796 minibuffer-local-completion-map))
04bcad1807b9 Make more menu-enables check (not buffer-read-only).
Richard M. Stallman <rms@gnu.org>
parents: 12199
diff changeset
797
04bcad1807b9 Make more menu-enables check (not buffer-read-only).
Richard M. Stallman <rms@gnu.org>
parents: 12199
diff changeset
798 (mapcar
04bcad1807b9 Make more menu-enables check (not buffer-read-only).
Richard M. Stallman <rms@gnu.org>
parents: 12199
diff changeset
799 (function
04bcad1807b9 Make more menu-enables check (not buffer-read-only).
Richard M. Stallman <rms@gnu.org>
parents: 12199
diff changeset
800 (lambda (map)
04bcad1807b9 Make more menu-enables check (not buffer-read-only).
Richard M. Stallman <rms@gnu.org>
parents: 12199
diff changeset
801 (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
802 '("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
803 (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
804 '("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
805 (define-key map [menu-bar minibuf tab]
13567
051b4ffca31f (minibuffer maps): Delete extra quote.
Richard M. Stallman <rms@gnu.org>
parents: 13506
diff changeset
806 '("Complete" . minibuffer-complete))
12427
04bcad1807b9 Make more menu-enables check (not buffer-read-only).
Richard M. Stallman <rms@gnu.org>
parents: 12199
diff changeset
807 ))
04bcad1807b9 Make more menu-enables check (not buffer-read-only).
Richard M. Stallman <rms@gnu.org>
parents: 12199
diff changeset
808 (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
809 minibuffer-local-completion-map))
04bcad1807b9 Make more menu-enables check (not buffer-read-only).
Richard M. Stallman <rms@gnu.org>
parents: 12199
diff changeset
810
04bcad1807b9 Make more menu-enables check (not buffer-read-only).
Richard M. Stallman <rms@gnu.org>
parents: 12199
diff changeset
811 (mapcar
04bcad1807b9 Make more menu-enables check (not buffer-read-only).
Richard M. Stallman <rms@gnu.org>
parents: 12199
diff changeset
812 (function
04bcad1807b9 Make more menu-enables check (not buffer-read-only).
Richard M. Stallman <rms@gnu.org>
parents: 12199
diff changeset
813 (lambda (map)
04bcad1807b9 Make more menu-enables check (not buffer-read-only).
Richard M. Stallman <rms@gnu.org>
parents: 12199
diff changeset
814 (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
815 '("Quit" . keyboard-escape-quit))
04bcad1807b9 Make more menu-enables check (not buffer-read-only).
Richard M. Stallman <rms@gnu.org>
parents: 12199
diff changeset
816 (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
817 '("Enter" . exit-minibuffer))
04bcad1807b9 Make more menu-enables check (not buffer-read-only).
Richard M. Stallman <rms@gnu.org>
parents: 12199
diff changeset
818 ))
04bcad1807b9 Make more menu-enables check (not buffer-read-only).
Richard M. Stallman <rms@gnu.org>
parents: 12199
diff changeset
819 (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
820 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
821 minibuffer-local-isearch-map
04bcad1807b9 Make more menu-enables check (not buffer-read-only).
Richard M. Stallman <rms@gnu.org>
parents: 12199
diff changeset
822 minibuffer-local-map
04bcad1807b9 Make more menu-enables check (not buffer-read-only).
Richard M. Stallman <rms@gnu.org>
parents: 12199
diff changeset
823 minibuffer-local-completion-map))
04bcad1807b9 Make more menu-enables check (not buffer-read-only).
Richard M. Stallman <rms@gnu.org>
parents: 12199
diff changeset
824
8055
6a0af6085c1a (menu-bar-mode): Make this a global variable.
Richard M. Stallman <rms@gnu.org>
parents: 8010
diff changeset
825 (defvar menu-bar-mode nil)
6a0af6085c1a (menu-bar-mode): Make this a global variable.
Richard M. Stallman <rms@gnu.org>
parents: 8010
diff changeset
826
2847
01a46a8f1e1b (fill-region, kill-region, delete-region)
Richard M. Stallman <rms@gnu.org>
parents: 2765
diff changeset
827 (defun menu-bar-mode (flag)
3007
e41b3dc686bb (menu-bar-mode): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 2847
diff changeset
828 "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
829 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
830 created in the future.
01a46a8f1e1b (fill-region, kill-region, delete-region)
Richard M. Stallman <rms@gnu.org>
parents: 2765
diff changeset
831 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
832 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
833 (interactive "P")
6dd518d1f5aa (menu-bar-mode): Defvar removed.
Roland McGrath <roland@gnu.org>
parents: 4337
diff changeset
834
8055
6a0af6085c1a (menu-bar-mode): Make this a global variable.
Richard M. Stallman <rms@gnu.org>
parents: 8010
diff changeset
835 ;; 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
836 (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
837 (if default
6a0af6085c1a (menu-bar-mode): Make this a global variable.
Richard M. Stallman <rms@gnu.org>
parents: 8010
diff changeset
838 (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
839 (setq default-frame-alist
6a0af6085c1a (menu-bar-mode): Make this a global variable.
Richard M. Stallman <rms@gnu.org>
parents: 8010
diff changeset
840 (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
841 default-frame-alist))))
4470
6dd518d1f5aa (menu-bar-mode): Defvar removed.
Roland McGrath <roland@gnu.org>
parents: 4337
diff changeset
842
8055
6a0af6085c1a (menu-bar-mode): Make this a global variable.
Richard M. Stallman <rms@gnu.org>
parents: 8010
diff changeset
843 ;; 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
844 (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
845 (> (prefix-numeric-value flag) 0)))
4470
6dd518d1f5aa (menu-bar-mode): Defvar removed.
Roland McGrath <roland@gnu.org>
parents: 4337
diff changeset
846
8055
6a0af6085c1a (menu-bar-mode): Make this a global variable.
Richard M. Stallman <rms@gnu.org>
parents: 8010
diff changeset
847 ;; 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
848 (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
849 (if (consp parameter)
6a0af6085c1a (menu-bar-mode): Make this a global variable.
Richard M. Stallman <rms@gnu.org>
parents: 8010
diff changeset
850 (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
851 (setq default-frame-alist
6a0af6085c1a (menu-bar-mode): Make this a global variable.
Richard M. Stallman <rms@gnu.org>
parents: 8010
diff changeset
852 (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
853 default-frame-alist))))
4470
6dd518d1f5aa (menu-bar-mode): Defvar removed.
Roland McGrath <roland@gnu.org>
parents: 4337
diff changeset
854
8055
6a0af6085c1a (menu-bar-mode): Make this a global variable.
Richard M. Stallman <rms@gnu.org>
parents: 8010
diff changeset
855 ;; Apply it to existing frames.
6a0af6085c1a (menu-bar-mode): Make this a global variable.
Richard M. Stallman <rms@gnu.org>
parents: 8010
diff changeset
856 (let ((frames (frame-list)))
6a0af6085c1a (menu-bar-mode): Make this a global variable.
Richard M. Stallman <rms@gnu.org>
parents: 8010
diff changeset
857 (while frames
6a0af6085c1a (menu-bar-mode): Make this a global variable.
Richard M. Stallman <rms@gnu.org>
parents: 8010
diff changeset
858 (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
859 (modify-frame-parameters (car frames)
6a0af6085c1a (menu-bar-mode): Make this a global variable.
Richard M. Stallman <rms@gnu.org>
parents: 8010
diff changeset
860 (list (cons 'menu-bar-lines
6a0af6085c1a (menu-bar-mode): Make this a global variable.
Richard M. Stallman <rms@gnu.org>
parents: 8010
diff changeset
861 (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
862 (modify-frame-parameters (car frames)
6a0af6085c1a (menu-bar-mode): Make this a global variable.
Richard M. Stallman <rms@gnu.org>
parents: 8010
diff changeset
863 (list (cons 'height height))))
6a0af6085c1a (menu-bar-mode): Make this a global variable.
Richard M. Stallman <rms@gnu.org>
parents: 8010
diff changeset
864 (setq frames (cdr frames)))))
2485
c34bbe650160 entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 2181
diff changeset
865
2765
0eb1a195f56e Provide 'menu-bar.
Richard M. Stallman <rms@gnu.org>
parents: 2695
diff changeset
866 (provide 'menu-bar)
0eb1a195f56e Provide 'menu-bar.
Richard M. Stallman <rms@gnu.org>
parents: 2695
diff changeset
867
2488
278580be9b4a Added and corrected library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2485
diff changeset
868 ;;; menu-bar.el ends here