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