Mercurial > emacs
annotate lisp/menu-bar.el @ 4122:82f0b478a551
(face-equal): Don't mess with face-background-pixmap.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sun, 18 Jul 1993 04:44:27 +0000 |
parents | 5746e25610f8 |
children | 4c4910d66232 |
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 |
278580be9b4a
Added and corrected library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2485
diff
changeset
|
3 ;; Author: RMS |
278580be9b4a
Added and corrected library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2485
diff
changeset
|
4 ;; Keywords: internals |
278580be9b4a
Added and corrected library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2485
diff
changeset
|
5 |
2485 | 6 ;; Copyright (C) 1993 Free Software Foundation, Inc. |
7 | |
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 | |
21 ;; along with GNU Emacs; see the file COPYING. If not, write to | |
22 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | |
23 | |
2488
278580be9b4a
Added and corrected library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2485
diff
changeset
|
24 ;;; Code: |
2485 | 25 |
2175 | 26 (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
|
27 (defvar menu-bar-help-menu (make-sparse-keymap "Help")) |
4114
5746e25610f8
(revert-buffer): Make menu-enable form more accurate
Richard M. Stallman <rms@gnu.org>
parents:
4101
diff
changeset
|
28 ;; Put Help item last. |
5746e25610f8
(revert-buffer): Make menu-enable form more accurate
Richard M. Stallman <rms@gnu.org>
parents:
4101
diff
changeset
|
29 (setq menu-bar-final-items '(help)) |
5746e25610f8
(revert-buffer): Make menu-enable form more accurate
Richard M. Stallman <rms@gnu.org>
parents:
4101
diff
changeset
|
30 (define-key global-map [menu-bar help] (cons "Help" menu-bar-help-menu)) |
3504
5fb4eefbd7ac
(menu-bar-help-menu): Add defvar.
Richard M. Stallman <rms@gnu.org>
parents:
3500
diff
changeset
|
31 (defvar menu-bar-edit-menu (make-sparse-keymap "Edit")) |
2178
76da020d14f8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2177
diff
changeset
|
32 (define-key global-map [menu-bar edit] (cons "Edit" menu-bar-edit-menu)) |
3504
5fb4eefbd7ac
(menu-bar-help-menu): Add defvar.
Richard M. Stallman <rms@gnu.org>
parents:
3500
diff
changeset
|
33 (defvar menu-bar-file-menu (make-sparse-keymap "File")) |
2181
5a9d9dcc4750
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2178
diff
changeset
|
34 (define-key global-map [menu-bar file] (cons "File" menu-bar-file-menu)) |
2175 | 35 |
2177
942a63709e37
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2175
diff
changeset
|
36 (define-key menu-bar-file-menu [exit-emacs] |
2175 | 37 '("Exit Emacs" . save-buffers-kill-emacs)) |
2178
76da020d14f8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2177
diff
changeset
|
38 (define-key menu-bar-file-menu [kill-buffer] |
76da020d14f8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2177
diff
changeset
|
39 '("Kill Buffer" . kill-this-buffer)) |
76da020d14f8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2177
diff
changeset
|
40 (define-key menu-bar-file-menu [delete-frame] '("Delete Frame" . delete-frame)) |
76da020d14f8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2177
diff
changeset
|
41 (define-key menu-bar-file-menu [print-buffer] '("Print Buffer" . print-buffer)) |
76da020d14f8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2177
diff
changeset
|
42 (define-key menu-bar-file-menu [revert-buffer] |
76da020d14f8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2177
diff
changeset
|
43 '("Revert Buffer" . revert-buffer)) |
76da020d14f8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2177
diff
changeset
|
44 (define-key menu-bar-file-menu [write-file] |
76da020d14f8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2177
diff
changeset
|
45 '("Save Buffer As..." . write-file)) |
76da020d14f8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2177
diff
changeset
|
46 (define-key menu-bar-file-menu [save-buffer] '("Save Buffer" . save-buffer)) |
4069
643048c8e307
(menu-bar-file-menu): Add menu item for dired.
Richard M. Stallman <rms@gnu.org>
parents:
4061
diff
changeset
|
47 (define-key menu-bar-file-menu [dired] '("Open Directory..." . dired)) |
2178
76da020d14f8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2177
diff
changeset
|
48 (define-key menu-bar-file-menu [open-file] '("Open File..." . find-file)) |
76da020d14f8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2177
diff
changeset
|
49 (define-key menu-bar-file-menu [new-frame] '("New Frame" . new-frame)) |
2175 | 50 |
4061
7279958409fe
(ispell-menu-map): New autoload definition.
Richard M. Stallman <rms@gnu.org>
parents:
4048
diff
changeset
|
51 |
7279958409fe
(ispell-menu-map): New autoload definition.
Richard M. Stallman <rms@gnu.org>
parents:
4048
diff
changeset
|
52 (define-key menu-bar-edit-menu [spell] '("Spell..." . ispell-menu-map)) |
2847
01a46a8f1e1b
(fill-region, kill-region, delete-region)
Richard M. Stallman <rms@gnu.org>
parents:
2765
diff
changeset
|
53 (define-key menu-bar-edit-menu [fill] '("Fill" . fill-region)) |
01a46a8f1e1b
(fill-region, kill-region, delete-region)
Richard M. Stallman <rms@gnu.org>
parents:
2765
diff
changeset
|
54 (define-key menu-bar-edit-menu [clear] '("Clear" . delete-region)) |
4025
92cd14c9ea80
(mouse-menu-choose-yank): Change menu title to "Choose Next Yank".
Roland McGrath <roland@gnu.org>
parents:
3958
diff
changeset
|
55 (define-key menu-bar-edit-menu [choose-next-paste] |
3958
3112c8925d39
(menu-bar-edit-menu): Rename menu item to
Richard M. Stallman <rms@gnu.org>
parents:
3955
diff
changeset
|
56 '("Choose Next Paste" . mouse-menu-choose-yank)) |
2847
01a46a8f1e1b
(fill-region, kill-region, delete-region)
Richard M. Stallman <rms@gnu.org>
parents:
2765
diff
changeset
|
57 (define-key menu-bar-edit-menu [paste] '("Paste" . yank)) |
01a46a8f1e1b
(fill-region, kill-region, delete-region)
Richard M. Stallman <rms@gnu.org>
parents:
2765
diff
changeset
|
58 (define-key menu-bar-edit-menu [copy] '("Copy" . kill-ring-save)) |
01a46a8f1e1b
(fill-region, kill-region, delete-region)
Richard M. Stallman <rms@gnu.org>
parents:
2765
diff
changeset
|
59 (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
|
60 (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
|
61 |
01a46a8f1e1b
(fill-region, kill-region, delete-region)
Richard M. Stallman <rms@gnu.org>
parents:
2765
diff
changeset
|
62 (put 'fill-region 'menu-enable 'mark-active) |
01a46a8f1e1b
(fill-region, kill-region, delete-region)
Richard M. Stallman <rms@gnu.org>
parents:
2765
diff
changeset
|
63 (put 'kill-region 'menu-enable 'mark-active) |
01a46a8f1e1b
(fill-region, kill-region, delete-region)
Richard M. Stallman <rms@gnu.org>
parents:
2765
diff
changeset
|
64 (put 'kill-ring-save 'menu-enable 'mark-active) |
01a46a8f1e1b
(fill-region, kill-region, delete-region)
Richard M. Stallman <rms@gnu.org>
parents:
2765
diff
changeset
|
65 (put 'yank 'menu-enable '(x-selection-exists-p)) |
01a46a8f1e1b
(fill-region, kill-region, delete-region)
Richard M. Stallman <rms@gnu.org>
parents:
2765
diff
changeset
|
66 (put 'delete-region 'menu-enable 'mark-active) |
01a46a8f1e1b
(fill-region, kill-region, delete-region)
Richard M. Stallman <rms@gnu.org>
parents:
2765
diff
changeset
|
67 (put 'undo 'menu-enable '(if (eq last-command 'undo) |
01a46a8f1e1b
(fill-region, kill-region, delete-region)
Richard M. Stallman <rms@gnu.org>
parents:
2765
diff
changeset
|
68 pending-undo-list |
01a46a8f1e1b
(fill-region, kill-region, delete-region)
Richard M. Stallman <rms@gnu.org>
parents:
2765
diff
changeset
|
69 (consp buffer-undo-list))) |
2175 | 70 |
4061
7279958409fe
(ispell-menu-map): New autoload definition.
Richard M. Stallman <rms@gnu.org>
parents:
4048
diff
changeset
|
71 (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
|
72 |
2178
76da020d14f8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2177
diff
changeset
|
73 (define-key menu-bar-help-menu [emacs-tutorial] |
76da020d14f8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2177
diff
changeset
|
74 '("Emacs Tutorial" . help-with-tutorial)) |
76da020d14f8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2177
diff
changeset
|
75 (define-key menu-bar-help-menu [man] '("Man..." . manual-entry)) |
76da020d14f8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2177
diff
changeset
|
76 (define-key menu-bar-help-menu [describe-variable] |
76da020d14f8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2177
diff
changeset
|
77 '("Describe Variable..." . describe-variable)) |
76da020d14f8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2177
diff
changeset
|
78 (define-key menu-bar-help-menu [describe-function] |
76da020d14f8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2177
diff
changeset
|
79 '("Describe Function..." . describe-function)) |
76da020d14f8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2177
diff
changeset
|
80 (define-key menu-bar-help-menu [describe-key] |
76da020d14f8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2177
diff
changeset
|
81 '("Describe Key..." . describe-key)) |
76da020d14f8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2177
diff
changeset
|
82 (define-key menu-bar-help-menu [list-keybindings] |
76da020d14f8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2177
diff
changeset
|
83 '("List Keybindings" . describe-bindings)) |
2177
942a63709e37
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2175
diff
changeset
|
84 (define-key menu-bar-help-menu [command-apropos] |
2175 | 85 '("Command Apropos..." . command-apropos)) |
2178
76da020d14f8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2177
diff
changeset
|
86 (define-key menu-bar-help-menu [describe-mode] |
76da020d14f8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2177
diff
changeset
|
87 '("Describe Mode" . describe-mode)) |
76da020d14f8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2177
diff
changeset
|
88 (define-key menu-bar-help-menu [info] '("Info" . info)) |
76da020d14f8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2177
diff
changeset
|
89 |
2177
942a63709e37
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2175
diff
changeset
|
90 (define-key menu-bar-help-menu [emacs-news] '("Emacs News" . view-emacs-news)) |
2175 | 91 (defun kill-this-buffer () ; for the menubar |
92 "Kills the current buffer." | |
93 (interactive) | |
94 (kill-buffer (current-buffer))) | |
95 | |
2178
76da020d14f8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2177
diff
changeset
|
96 (defun kill-this-buffer-enabled-p () |
76da020d14f8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2177
diff
changeset
|
97 (let ((count 0) |
76da020d14f8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2177
diff
changeset
|
98 (buffers (buffer-list))) |
76da020d14f8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2177
diff
changeset
|
99 (while buffers |
76da020d14f8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2177
diff
changeset
|
100 (or (string-match "^ " (buffer-name (car buffers))) |
76da020d14f8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2177
diff
changeset
|
101 (setq count (1+ count))) |
76da020d14f8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2177
diff
changeset
|
102 (setq buffers (cdr buffers))) |
76da020d14f8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2177
diff
changeset
|
103 (> count 1))) |
76da020d14f8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2177
diff
changeset
|
104 |
2175 | 105 (put 'save-buffer 'menu-enable '(buffer-modified-p)) |
4114
5746e25610f8
(revert-buffer): Make menu-enable form more accurate
Richard M. Stallman <rms@gnu.org>
parents:
4101
diff
changeset
|
106 (put 'revert-buffer 'menu-enable |
5746e25610f8
(revert-buffer): Make menu-enable form more accurate
Richard M. Stallman <rms@gnu.org>
parents:
4101
diff
changeset
|
107 '(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
|
108 (and (buffer-file-name) |
5746e25610f8
(revert-buffer): Make menu-enable form more accurate
Richard M. Stallman <rms@gnu.org>
parents:
4101
diff
changeset
|
109 (not (verify-visited-file-modtime (current-buffer)))))) |
2178
76da020d14f8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2177
diff
changeset
|
110 (put 'delete-frame 'menu-enable '(cdr (visible-frame-list))) |
76da020d14f8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2177
diff
changeset
|
111 (put 'kill-this-buffer 'menu-enable '(kill-this-buffer-enabled-p)) |
76da020d14f8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2177
diff
changeset
|
112 |
2175 | 113 (put 'advertised-undo 'menu-enable |
114 '(and (not (eq t buffer-undo-list)) | |
115 (if (eq last-command 'undo) | |
2178
76da020d14f8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2177
diff
changeset
|
116 (and (boundp 'pending-undo-list) |
76da020d14f8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2177
diff
changeset
|
117 pending-undo-list) |
76da020d14f8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2177
diff
changeset
|
118 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
|
119 |
d59af8c9bc65
(mouse-menu-choose-yank): New function. Put it in the edit menu.
Richard M. Stallman <rms@gnu.org>
parents:
3504
diff
changeset
|
120 (defvar yank-menu-length 100 |
d59af8c9bc65
(mouse-menu-choose-yank): New function. Put it in the edit menu.
Richard M. Stallman <rms@gnu.org>
parents:
3504
diff
changeset
|
121 "*Maximum length of an item in the menu for \ |
d59af8c9bc65
(mouse-menu-choose-yank): New function. Put it in the edit menu.
Richard M. Stallman <rms@gnu.org>
parents:
3504
diff
changeset
|
122 \\[mouse-menu-choose-yank].") |
d59af8c9bc65
(mouse-menu-choose-yank): New function. Put it in the edit menu.
Richard M. Stallman <rms@gnu.org>
parents:
3504
diff
changeset
|
123 |
d59af8c9bc65
(mouse-menu-choose-yank): New function. Put it in the edit menu.
Richard M. Stallman <rms@gnu.org>
parents:
3504
diff
changeset
|
124 (defun mouse-menu-choose-yank (event) |
d59af8c9bc65
(mouse-menu-choose-yank): New function. Put it in the edit menu.
Richard M. Stallman <rms@gnu.org>
parents:
3504
diff
changeset
|
125 "Pop up a menu of the kill-ring for selection with the mouse. |
d59af8c9bc65
(mouse-menu-choose-yank): New function. Put it in the edit menu.
Richard M. Stallman <rms@gnu.org>
parents:
3504
diff
changeset
|
126 The kill-ring-yank-pointer is moved to the selected element. |
d59af8c9bc65
(mouse-menu-choose-yank): New function. Put it in the edit menu.
Richard M. Stallman <rms@gnu.org>
parents:
3504
diff
changeset
|
127 A subsequent \\[yank] yanks the choice just selected." |
d59af8c9bc65
(mouse-menu-choose-yank): New function. Put it in the edit menu.
Richard M. Stallman <rms@gnu.org>
parents:
3504
diff
changeset
|
128 (interactive "e") |
d59af8c9bc65
(mouse-menu-choose-yank): New function. Put it in the edit menu.
Richard M. Stallman <rms@gnu.org>
parents:
3504
diff
changeset
|
129 (let* ((count 0) |
d59af8c9bc65
(mouse-menu-choose-yank): New function. Put it in the edit menu.
Richard M. Stallman <rms@gnu.org>
parents:
3504
diff
changeset
|
130 (menu (mapcar (lambda (string) |
d59af8c9bc65
(mouse-menu-choose-yank): New function. Put it in the edit menu.
Richard M. Stallman <rms@gnu.org>
parents:
3504
diff
changeset
|
131 (if (> (length string) yank-menu-length) |
d59af8c9bc65
(mouse-menu-choose-yank): New function. Put it in the edit menu.
Richard M. Stallman <rms@gnu.org>
parents:
3504
diff
changeset
|
132 (setq string (substring string |
d59af8c9bc65
(mouse-menu-choose-yank): New function. Put it in the edit menu.
Richard M. Stallman <rms@gnu.org>
parents:
3504
diff
changeset
|
133 0 yank-menu-length))) |
d59af8c9bc65
(mouse-menu-choose-yank): New function. Put it in the edit menu.
Richard M. Stallman <rms@gnu.org>
parents:
3504
diff
changeset
|
134 (prog1 (cons string count) |
d59af8c9bc65
(mouse-menu-choose-yank): New function. Put it in the edit menu.
Richard M. Stallman <rms@gnu.org>
parents:
3504
diff
changeset
|
135 (setq count (1+ count)))) |
3942
877f540d9717
(mouse-menu-choose-yank): Just return when x-popup-menu returns nil.
Roland McGrath <roland@gnu.org>
parents:
3898
diff
changeset
|
136 kill-ring)) |
877f540d9717
(mouse-menu-choose-yank): Just return when x-popup-menu returns nil.
Roland McGrath <roland@gnu.org>
parents:
3898
diff
changeset
|
137 (arg (x-popup-menu event |
877f540d9717
(mouse-menu-choose-yank): Just return when x-popup-menu returns nil.
Roland McGrath <roland@gnu.org>
parents:
3898
diff
changeset
|
138 (list "Yank Menu" |
4025
92cd14c9ea80
(mouse-menu-choose-yank): Change menu title to "Choose Next Yank".
Roland McGrath <roland@gnu.org>
parents:
3958
diff
changeset
|
139 (cons "Choose Next Yank" menu))))) |
3942
877f540d9717
(mouse-menu-choose-yank): Just return when x-popup-menu returns nil.
Roland McGrath <roland@gnu.org>
parents:
3898
diff
changeset
|
140 ;; A mouse click outside the menu returns nil. |
877f540d9717
(mouse-menu-choose-yank): Just return when x-popup-menu returns nil.
Roland McGrath <roland@gnu.org>
parents:
3898
diff
changeset
|
141 ;; Avoid a confusing error from passing nil to rotate-yank-pointer. |
877f540d9717
(mouse-menu-choose-yank): Just return when x-popup-menu returns nil.
Roland McGrath <roland@gnu.org>
parents:
3898
diff
changeset
|
142 ;; XXX should this perhaps do something other than simply return? -rm |
877f540d9717
(mouse-menu-choose-yank): Just return when x-popup-menu returns nil.
Roland McGrath <roland@gnu.org>
parents:
3898
diff
changeset
|
143 (if arg |
877f540d9717
(mouse-menu-choose-yank): Just return when x-popup-menu returns nil.
Roland McGrath <roland@gnu.org>
parents:
3898
diff
changeset
|
144 (progn |
877f540d9717
(mouse-menu-choose-yank): Just return when x-popup-menu returns nil.
Roland McGrath <roland@gnu.org>
parents:
3898
diff
changeset
|
145 (rotate-yank-pointer arg) |
877f540d9717
(mouse-menu-choose-yank): Just return when x-popup-menu returns nil.
Roland McGrath <roland@gnu.org>
parents:
3898
diff
changeset
|
146 (if (interactive-p) |
877f540d9717
(mouse-menu-choose-yank): Just return when x-popup-menu returns nil.
Roland McGrath <roland@gnu.org>
parents:
3898
diff
changeset
|
147 (message "The next yank will insert the selected text.") |
877f540d9717
(mouse-menu-choose-yank): Just return when x-popup-menu returns nil.
Roland McGrath <roland@gnu.org>
parents:
3898
diff
changeset
|
148 (current-kill 0)))))) |
877f540d9717
(mouse-menu-choose-yank): Just return when x-popup-menu returns nil.
Roland McGrath <roland@gnu.org>
parents:
3898
diff
changeset
|
149 (put 'mouse-menu-choose-yank 'menu-enable 'kill-ring) |
2181
5a9d9dcc4750
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2178
diff
changeset
|
150 |
3412
7d9b10bea55f
(mouse-menu-bar-buffers): Renamed from mouse-buffer-menu.
Richard M. Stallman <rms@gnu.org>
parents:
3007
diff
changeset
|
151 (define-key global-map [menu-bar buffer] '("Buffers" . mouse-menu-bar-buffers)) |
2178
76da020d14f8
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2177
diff
changeset
|
152 |
2181
5a9d9dcc4750
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2178
diff
changeset
|
153 (defvar complex-buffers-menu-p nil |
5a9d9dcc4750
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2178
diff
changeset
|
154 "*Non-nil says, offer a choice of actions after you pick a buffer. |
5a9d9dcc4750
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2178
diff
changeset
|
155 This applies to the Buffers menu from the menu bar.") |
5a9d9dcc4750
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2178
diff
changeset
|
156 |
5a9d9dcc4750
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2178
diff
changeset
|
157 (defvar buffers-menu-max-size 10 |
5a9d9dcc4750
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2178
diff
changeset
|
158 "*Maximum number of entries which may appear on the Buffers menu. |
5a9d9dcc4750
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2178
diff
changeset
|
159 If this is 10, then only the ten most-recently-selected buffers are shown. |
5a9d9dcc4750
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2178
diff
changeset
|
160 If this is nil, then all buffers are shown. |
5a9d9dcc4750
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2178
diff
changeset
|
161 A large number or nil slows down menu responsiveness.") |
5a9d9dcc4750
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2178
diff
changeset
|
162 |
3412
7d9b10bea55f
(mouse-menu-bar-buffers): Renamed from mouse-buffer-menu.
Richard M. Stallman <rms@gnu.org>
parents:
3007
diff
changeset
|
163 (defun mouse-menu-bar-buffers (event) |
2181
5a9d9dcc4750
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2178
diff
changeset
|
164 "Pop up a menu of buffers for selection with the mouse. |
5a9d9dcc4750
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2178
diff
changeset
|
165 This switches buffers in the window that you clicked on, |
5a9d9dcc4750
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2178
diff
changeset
|
166 and selects that window." |
5a9d9dcc4750
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2178
diff
changeset
|
167 (interactive "e") |
5a9d9dcc4750
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2178
diff
changeset
|
168 (let ((buffers (buffer-list)) |
5a9d9dcc4750
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2178
diff
changeset
|
169 menu) |
5a9d9dcc4750
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2178
diff
changeset
|
170 ;; If requested, list only the N most recently selected buffers. |
5a9d9dcc4750
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2178
diff
changeset
|
171 (if (and (integerp buffers-menu-max-size) |
5a9d9dcc4750
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2178
diff
changeset
|
172 (> buffers-menu-max-size 1)) |
5a9d9dcc4750
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2178
diff
changeset
|
173 (if (> (length buffers) buffers-menu-max-size) |
5a9d9dcc4750
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2178
diff
changeset
|
174 (setcdr (nthcdr buffers-menu-max-size buffers) nil))) |
5a9d9dcc4750
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2178
diff
changeset
|
175 (setq menu |
5a9d9dcc4750
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2178
diff
changeset
|
176 (list "Buffer Menu" |
5a9d9dcc4750
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2178
diff
changeset
|
177 (cons "Select Buffer" |
5a9d9dcc4750
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2178
diff
changeset
|
178 (let ((tail buffers) |
3898
92d25f36e8aa
(mouse-menu-bar-buffers): Include % and * in each item.
Richard M. Stallman <rms@gnu.org>
parents:
3795
diff
changeset
|
179 (maxbuf 0) |
2181
5a9d9dcc4750
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2178
diff
changeset
|
180 (maxlen 0) |
5a9d9dcc4750
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2178
diff
changeset
|
181 head) |
5a9d9dcc4750
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2178
diff
changeset
|
182 (while tail |
3898
92d25f36e8aa
(mouse-menu-bar-buffers): Include % and * in each item.
Richard M. Stallman <rms@gnu.org>
parents:
3795
diff
changeset
|
183 (or (eq ?\ (aref (buffer-name (car tail)) 0)) |
92d25f36e8aa
(mouse-menu-bar-buffers): Include % and * in each item.
Richard M. Stallman <rms@gnu.org>
parents:
3795
diff
changeset
|
184 (setq maxbuf |
92d25f36e8aa
(mouse-menu-bar-buffers): Include % and * in each item.
Richard M. Stallman <rms@gnu.org>
parents:
3795
diff
changeset
|
185 (max maxbuf |
92d25f36e8aa
(mouse-menu-bar-buffers): Include % and * in each item.
Richard M. Stallman <rms@gnu.org>
parents:
3795
diff
changeset
|
186 (length (buffer-name (car tail)))))) |
92d25f36e8aa
(mouse-menu-bar-buffers): Include % and * in each item.
Richard M. Stallman <rms@gnu.org>
parents:
3795
diff
changeset
|
187 (setq tail (cdr tail))) |
92d25f36e8aa
(mouse-menu-bar-buffers): Include % and * in each item.
Richard M. Stallman <rms@gnu.org>
parents:
3795
diff
changeset
|
188 (setq tail buffers) |
92d25f36e8aa
(mouse-menu-bar-buffers): Include % and * in each item.
Richard M. Stallman <rms@gnu.org>
parents:
3795
diff
changeset
|
189 (while tail |
2181
5a9d9dcc4750
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2178
diff
changeset
|
190 (let ((elt (car tail))) |
5a9d9dcc4750
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2178
diff
changeset
|
191 (if (not (string-match "^ " |
5a9d9dcc4750
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2178
diff
changeset
|
192 (buffer-name elt))) |
5a9d9dcc4750
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2178
diff
changeset
|
193 (setq head (cons |
5a9d9dcc4750
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2178
diff
changeset
|
194 (cons |
5a9d9dcc4750
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2178
diff
changeset
|
195 (format |
3898
92d25f36e8aa
(mouse-menu-bar-buffers): Include % and * in each item.
Richard M. Stallman <rms@gnu.org>
parents:
3795
diff
changeset
|
196 (format "%%%ds %%s%%s %%s" |
92d25f36e8aa
(mouse-menu-bar-buffers): Include % and * in each item.
Richard M. Stallman <rms@gnu.org>
parents:
3795
diff
changeset
|
197 maxbuf) |
2181
5a9d9dcc4750
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2178
diff
changeset
|
198 (buffer-name elt) |
3898
92d25f36e8aa
(mouse-menu-bar-buffers): Include % and * in each item.
Richard M. Stallman <rms@gnu.org>
parents:
3795
diff
changeset
|
199 (if (buffer-modified-p elt) "*" " ") |
92d25f36e8aa
(mouse-menu-bar-buffers): Include % and * in each item.
Richard M. Stallman <rms@gnu.org>
parents:
3795
diff
changeset
|
200 (save-excursion |
92d25f36e8aa
(mouse-menu-bar-buffers): Include % and * in each item.
Richard M. Stallman <rms@gnu.org>
parents:
3795
diff
changeset
|
201 (set-buffer elt) |
92d25f36e8aa
(mouse-menu-bar-buffers): Include % and * in each item.
Richard M. Stallman <rms@gnu.org>
parents:
3795
diff
changeset
|
202 (if buffer-read-only "%" " ")) |
2181
5a9d9dcc4750
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2178
diff
changeset
|
203 (or (buffer-file-name elt) "")) |
5a9d9dcc4750
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2178
diff
changeset
|
204 elt) |
5a9d9dcc4750
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2178
diff
changeset
|
205 head))) |
5a9d9dcc4750
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2178
diff
changeset
|
206 (and head (> (length (car (car head))) maxlen) |
5a9d9dcc4750
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2178
diff
changeset
|
207 (setq maxlen (length (car (car head)))))) |
5a9d9dcc4750
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2178
diff
changeset
|
208 (setq tail (cdr tail))) |
5a9d9dcc4750
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2178
diff
changeset
|
209 (nconc (reverse head) |
4048
26b434331fce
(mouse-menu-bar-buffers):
Richard M. Stallman <rms@gnu.org>
parents:
4025
diff
changeset
|
210 (list (cons (concat (make-string (max 0 (- (/ maxlen 2) 8)) ?\ ) |
2181
5a9d9dcc4750
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2178
diff
changeset
|
211 "List All Buffers") |
5a9d9dcc4750
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2178
diff
changeset
|
212 'list-buffers))))))) |
5a9d9dcc4750
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2178
diff
changeset
|
213 |
5a9d9dcc4750
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2178
diff
changeset
|
214 |
5a9d9dcc4750
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2178
diff
changeset
|
215 (let ((buf (x-popup-menu (if (listp event) event |
5a9d9dcc4750
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2178
diff
changeset
|
216 (cons '(0 0) (selected-frame))) |
5a9d9dcc4750
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2178
diff
changeset
|
217 menu)) |
5a9d9dcc4750
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2178
diff
changeset
|
218 (window (and (listp event) (posn-window (event-start event))))) |
5a9d9dcc4750
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2178
diff
changeset
|
219 (if (eq buf 'list-buffers) |
5a9d9dcc4750
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2178
diff
changeset
|
220 (list-buffers) |
5a9d9dcc4750
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2178
diff
changeset
|
221 (if buf |
5a9d9dcc4750
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2178
diff
changeset
|
222 (if complex-buffers-menu-p |
5a9d9dcc4750
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2178
diff
changeset
|
223 (let ((action (x-popup-menu (if (listp event) event |
5a9d9dcc4750
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2178
diff
changeset
|
224 (cons '(0 0) (selected-frame))) |
5a9d9dcc4750
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2178
diff
changeset
|
225 '("Buffer Action" |
5a9d9dcc4750
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2178
diff
changeset
|
226 ("" |
5a9d9dcc4750
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2178
diff
changeset
|
227 ("Save Buffer" . save-buffer) |
5a9d9dcc4750
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2178
diff
changeset
|
228 ("Kill Buffer" . kill-buffer) |
5a9d9dcc4750
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2178
diff
changeset
|
229 ("Select Buffer" . switch-to-buffer)))))) |
5a9d9dcc4750
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2178
diff
changeset
|
230 (if (eq action 'save-buffer) |
5a9d9dcc4750
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2178
diff
changeset
|
231 (save-excursion |
5a9d9dcc4750
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2178
diff
changeset
|
232 (set-buffer buf) |
5a9d9dcc4750
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2178
diff
changeset
|
233 (save-buffer)) |
5a9d9dcc4750
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2178
diff
changeset
|
234 (funcall action buf))) |
5a9d9dcc4750
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2178
diff
changeset
|
235 (and (windowp window) |
5a9d9dcc4750
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2178
diff
changeset
|
236 (select-window window)) |
5a9d9dcc4750
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2178
diff
changeset
|
237 (switch-to-buffer buf))))))) |
5a9d9dcc4750
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2178
diff
changeset
|
238 |
5a9d9dcc4750
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2178
diff
changeset
|
239 ;; this version is too slow |
5a9d9dcc4750
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2178
diff
changeset
|
240 ;;;(defun format-buffers-menu-line (buffer) |
5a9d9dcc4750
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2178
diff
changeset
|
241 ;;; "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
|
242 ;;;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
|
243 ;;; (if (string-match "\\` " (buffer-name buffer)) |
5a9d9dcc4750
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2178
diff
changeset
|
244 ;;; nil |
5a9d9dcc4750
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2178
diff
changeset
|
245 ;;; (save-excursion |
5a9d9dcc4750
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2178
diff
changeset
|
246 ;;; (set-buffer buffer) |
5a9d9dcc4750
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2178
diff
changeset
|
247 ;;; (let ((size (buffer-size))) |
5a9d9dcc4750
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2178
diff
changeset
|
248 ;;; (format "%s%s %-19s %6s %-15s %s" |
5a9d9dcc4750
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2178
diff
changeset
|
249 ;;; (if (buffer-modified-p) "*" " ") |
5a9d9dcc4750
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2178
diff
changeset
|
250 ;;; (if buffer-read-only "%" " ") |
5a9d9dcc4750
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2178
diff
changeset
|
251 ;;; (buffer-name) |
5a9d9dcc4750
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2178
diff
changeset
|
252 ;;; size |
5a9d9dcc4750
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2178
diff
changeset
|
253 ;;; mode-name |
5a9d9dcc4750
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2178
diff
changeset
|
254 ;;; (or (buffer-file-name) "")))))) |
5a9d9dcc4750
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
2178
diff
changeset
|
255 |
2847
01a46a8f1e1b
(fill-region, kill-region, delete-region)
Richard M. Stallman <rms@gnu.org>
parents:
2765
diff
changeset
|
256 (defvar menu-bar-mode nil) |
01a46a8f1e1b
(fill-region, kill-region, delete-region)
Richard M. Stallman <rms@gnu.org>
parents:
2765
diff
changeset
|
257 |
01a46a8f1e1b
(fill-region, kill-region, delete-region)
Richard M. Stallman <rms@gnu.org>
parents:
2765
diff
changeset
|
258 (defun menu-bar-mode (flag) |
3007
e41b3dc686bb
(menu-bar-mode): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
2847
diff
changeset
|
259 "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
|
260 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
|
261 created in the future. |
01a46a8f1e1b
(fill-region, kill-region, delete-region)
Richard M. Stallman <rms@gnu.org>
parents:
2765
diff
changeset
|
262 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
|
263 turn off menu bars; otherwise, turn on menu bars." |
2847
01a46a8f1e1b
(fill-region, kill-region, delete-region)
Richard M. Stallman <rms@gnu.org>
parents:
2765
diff
changeset
|
264 (interactive "P") |
01a46a8f1e1b
(fill-region, kill-region, delete-region)
Richard M. Stallman <rms@gnu.org>
parents:
2765
diff
changeset
|
265 (setq menu-bar-mode (if (null flag) (not menu-bar-mode) |
01a46a8f1e1b
(fill-region, kill-region, delete-region)
Richard M. Stallman <rms@gnu.org>
parents:
2765
diff
changeset
|
266 (or (not (numberp flag)) (>= flag 0)))) |
01a46a8f1e1b
(fill-region, kill-region, delete-region)
Richard M. Stallman <rms@gnu.org>
parents:
2765
diff
changeset
|
267 (let ((parameter (assq 'menu-bar-lines default-frame-alist))) |
01a46a8f1e1b
(fill-region, kill-region, delete-region)
Richard M. Stallman <rms@gnu.org>
parents:
2765
diff
changeset
|
268 (if (consp parameter) |
01a46a8f1e1b
(fill-region, kill-region, delete-region)
Richard M. Stallman <rms@gnu.org>
parents:
2765
diff
changeset
|
269 (setcdr parameter (if menu-bar-mode 1 0)) |
01a46a8f1e1b
(fill-region, kill-region, delete-region)
Richard M. Stallman <rms@gnu.org>
parents:
2765
diff
changeset
|
270 (setq default-frame-alist |
01a46a8f1e1b
(fill-region, kill-region, delete-region)
Richard M. Stallman <rms@gnu.org>
parents:
2765
diff
changeset
|
271 (cons (cons 'menu-bar-lines (if menu-bar-mode 1 0)) |
01a46a8f1e1b
(fill-region, kill-region, delete-region)
Richard M. Stallman <rms@gnu.org>
parents:
2765
diff
changeset
|
272 default-frame-alist)))) |
01a46a8f1e1b
(fill-region, kill-region, delete-region)
Richard M. Stallman <rms@gnu.org>
parents:
2765
diff
changeset
|
273 (let ((frames (frame-list))) |
01a46a8f1e1b
(fill-region, kill-region, delete-region)
Richard M. Stallman <rms@gnu.org>
parents:
2765
diff
changeset
|
274 (while frames |
01a46a8f1e1b
(fill-region, kill-region, delete-region)
Richard M. Stallman <rms@gnu.org>
parents:
2765
diff
changeset
|
275 ;; Turn menu bar on or off in existing frames. |
01a46a8f1e1b
(fill-region, kill-region, delete-region)
Richard M. Stallman <rms@gnu.org>
parents:
2765
diff
changeset
|
276 ;; (Except for minibuffer-only frames.) |
01a46a8f1e1b
(fill-region, kill-region, delete-region)
Richard M. Stallman <rms@gnu.org>
parents:
2765
diff
changeset
|
277 (or (eq 'only (cdr (assq 'minibuffer (frame-parameters (car frames))))) |
01a46a8f1e1b
(fill-region, kill-region, delete-region)
Richard M. Stallman <rms@gnu.org>
parents:
2765
diff
changeset
|
278 (modify-frame-parameters |
01a46a8f1e1b
(fill-region, kill-region, delete-region)
Richard M. Stallman <rms@gnu.org>
parents:
2765
diff
changeset
|
279 (car frames) |
01a46a8f1e1b
(fill-region, kill-region, delete-region)
Richard M. Stallman <rms@gnu.org>
parents:
2765
diff
changeset
|
280 (list (if menu-bar-mode |
01a46a8f1e1b
(fill-region, kill-region, delete-region)
Richard M. Stallman <rms@gnu.org>
parents:
2765
diff
changeset
|
281 '(menu-bar-lines . 1) |
01a46a8f1e1b
(fill-region, kill-region, delete-region)
Richard M. Stallman <rms@gnu.org>
parents:
2765
diff
changeset
|
282 '(menu-bar-lines . 0))))) |
01a46a8f1e1b
(fill-region, kill-region, delete-region)
Richard M. Stallman <rms@gnu.org>
parents:
2765
diff
changeset
|
283 (setq frames (cdr frames))))) |
2485 | 284 |
285 ;; Make frames created from now on have a menu bar. | |
3500
78c1c1e9f4d2
(window-system): Enable menu bars only if
Richard M. Stallman <rms@gnu.org>
parents:
3412
diff
changeset
|
286 (if window-system |
78c1c1e9f4d2
(window-system): Enable menu bars only if
Richard M. Stallman <rms@gnu.org>
parents:
3412
diff
changeset
|
287 (menu-bar-mode t)) |
2485 | 288 |
2765 | 289 (provide 'menu-bar) |
290 | |
2488
278580be9b4a
Added and corrected library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2485
diff
changeset
|
291 ;;; menu-bar.el ends here |