]> code.delx.au - gnu-emacs/blob - lisp/menu-bar.el
(dired-add-entry): If ange-ftp inserted the file's absolute name, fix that.
[gnu-emacs] / lisp / menu-bar.el
1 ;;; menu-bar.el --- define a default menu bar.
2
3 ;; Author: RMS
4 ;; Keywords: internal
5
6 ;; Copyright (C) 1993, 1994 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
24 ;;; Code:
25
26 ;; Don't clobber an existing menu-bar keymap, to preserve any menu-bar key
27 ;; definitions made in loaddefs.el.
28 (or (lookup-key global-map [menu-bar])
29 (define-key global-map [menu-bar] (make-sparse-keymap "menu-bar")))
30 (defvar menu-bar-help-menu (make-sparse-keymap "Help"))
31
32 ;; Force Help item to come last, after the major mode's own items.
33 (setq menu-bar-final-items '(help))
34
35 (define-key global-map [menu-bar help] (cons "Help" menu-bar-help-menu))
36 (defvar menu-bar-search-menu (make-sparse-keymap "Search"))
37 (define-key global-map [menu-bar search] (cons "Search" menu-bar-search-menu))
38 (defvar menu-bar-edit-menu (make-sparse-keymap "Edit"))
39 (define-key global-map [menu-bar edit] (cons "Edit" menu-bar-edit-menu))
40 (defvar menu-bar-tools-menu (make-sparse-keymap "Tools"))
41 (define-key global-map [menu-bar tools] (cons "Tools" menu-bar-tools-menu))
42 (defvar menu-bar-files-menu (make-sparse-keymap "Files"))
43 (define-key global-map [menu-bar files] (cons "Files" menu-bar-files-menu))
44 \f
45 (defvar vc-menu-map (make-sparse-keymap "Version Control"))
46
47 (define-key menu-bar-tools-menu [calendar] '("Calendar" . calendar))
48 (define-key menu-bar-tools-menu [rmail] '("Read Mail" . rmail))
49 (define-key menu-bar-tools-menu [gnus] '("Read Net News" . gnus))
50
51 (define-key menu-bar-tools-menu [separator-vc]
52 '("--"))
53
54 (define-key menu-bar-tools-menu [vc-menu]
55 (cons "Version Control" vc-menu-map))
56
57 (define-key menu-bar-tools-menu [separator-compare]
58 '("--"))
59
60 (define-key menu-bar-tools-menu [epatch]
61 '("Apply Patch" . menu-bar-epatch-menu))
62 (define-key menu-bar-tools-menu [ediff-merge]
63 '("Merge" . menu-bar-ediff-merge-menu))
64 (define-key menu-bar-tools-menu [ediff]
65 '("Compare" . menu-bar-ediff-menu))
66
67 (define-key menu-bar-tools-menu [separator-print]
68 '("--"))
69
70 (put 'print-region 'menu-enable 'mark-active)
71 (put 'ps-print-region-with-faces 'menu-enable 'mark-active)
72
73 (define-key menu-bar-tools-menu [ps-print-region]
74 '("Postscript Print Region" . ps-print-region-with-faces))
75 (define-key menu-bar-tools-menu [ps-print-buffer]
76 '("Postscript Print Buffer" . ps-print-buffer-with-faces))
77 (define-key menu-bar-tools-menu [print-region]
78 '("Print Region" . print-region))
79 (define-key menu-bar-tools-menu [print-buffer]
80 '("Print Buffer" . print-buffer))
81 \f
82 (define-key menu-bar-files-menu [exit-emacs]
83 '("Exit Emacs" . save-buffers-kill-emacs))
84
85 (define-key menu-bar-files-menu [separator-exit]
86 '("--"))
87
88 (define-key menu-bar-files-menu [one-window]
89 '("One Window" . delete-other-windows))
90
91 (define-key menu-bar-files-menu [split-window]
92 '("Split Window" . split-window-vertically))
93
94 (if (fboundp 'delete-frame)
95 (progn
96 (define-key menu-bar-files-menu [delete-frame]
97 '("Delete Frame" . delete-frame))
98 (define-key menu-bar-files-menu [make-frame-on-display]
99 '("Open New Display..." . make-frame-on-display))
100 (define-key menu-bar-files-menu [make-frame]
101 '("Make New Frame" . make-frame))))
102
103 (define-key menu-bar-files-menu [separator-buffers]
104 '("--"))
105
106 (define-key menu-bar-files-menu [kill-buffer]
107 '("Kill Current Buffer" . kill-this-buffer))
108 (define-key menu-bar-files-menu [insert-file]
109 '("Insert File" . insert-file))
110 (define-key menu-bar-files-menu [revert-buffer]
111 '("Revert Buffer" . revert-buffer))
112 (define-key menu-bar-files-menu [write-file]
113 '("Save Buffer As..." . write-file))
114 (define-key menu-bar-files-menu [save-buffer] '("Save Buffer" . save-buffer))
115 (define-key menu-bar-files-menu [dired] '("Open Directory..." . dired))
116 (define-key menu-bar-files-menu [open-file] '("Open File..." . find-file))
117
118 ;; This is just one element of the ediff menu--the first.
119 (define-key menu-bar-ediff-menu [window]
120 '("This Window And Next Window" . compare-windows))
121 \f
122 (defun nonincremental-search-forward (string)
123 "Read a string and search for it nonincrementally."
124 (interactive "sSearch for string: ")
125 (if (equal string "")
126 (search-forward (car search-ring))
127 (isearch-update-ring string nil)
128 (search-forward string)))
129
130 (defun nonincremental-search-backward (string)
131 "Read a string and search backward for it nonincrementally."
132 (interactive "sSearch for string: ")
133 (if (equal string "")
134 (search-backward (car search-ring))
135 (isearch-update-ring string nil)
136 (search-backward string)))
137
138 (defun nonincremental-re-search-forward (string)
139 "Read a regular expression and search for it nonincrementally."
140 (interactive "sSearch for regexp: ")
141 (if (equal string "")
142 (re-search-forward (car regexp-search-ring))
143 (isearch-update-ring string t)
144 (re-search-forward string)))
145
146 (defun nonincremental-re-search-backward (string)
147 "Read a regular expression and search backward for it nonincrementally."
148 (interactive "sSearch for regexp: ")
149 (if (equal string "")
150 (re-search-backward (car regexp-search-ring))
151 (isearch-update-ring string t)
152 (re-search-backward string)))
153
154 (defun noninteractive-repeat-search-forward ()
155 "Search forward for the previous search string."
156 (interactive)
157 (search-forward (car search-ring)))
158
159 (defun noninteractive-repeat-search-backward ()
160 "Search backward for the previous search string."
161 (interactive)
162 (search-backward (car search-ring)))
163
164 (defun noninteractive-repeat-re-search-forward ()
165 "Search forward for the previous regular expression."
166 (interactive)
167 (re-search-forward (car regexp-search-ring)))
168
169 (defun noninteractive-repeat-re-search-backward ()
170 "Search backward for the previous regular expression."
171 (interactive)
172 (re-search-backward (car regexp-search-ring)))
173
174 (define-key menu-bar-search-menu [query-replace]
175 '("Query Replace" . query-replace))
176 (define-key menu-bar-search-menu [find-tag]
177 '("Find Tag" . find-tag))
178 (put 'find-tag 'menu-enable 'tags-table-list)
179 (define-key menu-bar-search-menu [bookmark]
180 '("Bookmarks" . menu-bar-bookmark-map))
181
182 (define-key menu-bar-search-menu [separator-search]
183 '("--"))
184
185 (define-key menu-bar-search-menu [nonincremental-repeat-re-search-back]
186 '("Repeat Regexp Backwards" . nonincremental-repeat-re-search-backward))
187 (define-key menu-bar-search-menu [nonincremental-repeat-search-back]
188 '("Repeat Backwards" . nonincremental-repeat-search-backward))
189 (define-key menu-bar-search-menu [nonincremental-repeat-re-search-fwd]
190 '("Repeat Regexp" . nonincremental-repeat-re-search-forward))
191 (define-key menu-bar-search-menu [nonincremental-repeat-search-fwd]
192 '("Repeat Search" . nonincremental-repeat-search-forward))
193
194 (define-key menu-bar-search-menu [separator-repeat]
195 '("--"))
196
197 (define-key menu-bar-search-menu [re-search-back]
198 '("Regexp Search Backwards" . nonincremental-re-search-backward))
199 (define-key menu-bar-search-menu [search-back]
200 '("Search Backwards" . nonincremental-search-backward))
201 (define-key menu-bar-search-menu [re-search-fwd]
202 '("Regexp Search" . nonincremental-re-search-forward))
203 (define-key menu-bar-search-menu [search-fwd]
204 '("Search" . nonincremental-search-forward))
205 \f
206 (define-key menu-bar-edit-menu [spell] '("Spell" . ispell-menu-map))
207 (define-key menu-bar-edit-menu [fill] '("Fill" . fill-region))
208 (define-key menu-bar-edit-menu [props] '("Text Properties" . facemenu-menu))
209
210 (define-key menu-bar-edit-menu [separator-edit]
211 '("--"))
212
213 (define-key menu-bar-edit-menu [clear] '("Clear" . delete-region))
214
215 (define-key menu-bar-edit-menu [paste] '("Paste most recent" . yank))
216
217 (defvar yank-menu (cons "Select Yank" nil))
218 (fset 'yank-menu (cons 'keymap yank-menu))
219 (define-key menu-bar-edit-menu [select-paste] '("Select and Paste" . yank-menu))
220 (define-key menu-bar-edit-menu [copy] '("Copy" . menu-bar-kill-ring-save))
221 (define-key menu-bar-edit-menu [cut] '("Cut" . kill-region))
222 (define-key menu-bar-edit-menu [undo] '("Undo" . undo))
223
224 (defun menu-bar-kill-ring-save (beg end)
225 (interactive "r")
226 (if (mouse-region-match)
227 (message "Select a region with the mouse does `copy' automatically")
228 (kill-ring-save beg end)))
229
230 (put 'fill-region 'menu-enable 'mark-active)
231 (put 'kill-region 'menu-enable 'mark-active)
232 (put 'menu-bar-kill-ring-save 'menu-enable 'mark-active)
233 (put 'yank 'menu-enable '(x-selection-exists-p))
234 (put 'yank-menu 'menu-enable '(cdr yank-menu))
235 (put 'delete-region 'menu-enable '(and mark-active
236 (not (mouse-region-match))))
237 (put 'undo 'menu-enable '(if (eq last-command 'undo)
238 pending-undo-list
239 (consp buffer-undo-list)))
240 (put 'query-replace 'menu-enable '(not buffer-read-only))
241
242 (autoload 'ispell-menu-map "ispell" nil t 'keymap)
243
244 ;; These are alternative definitions for the cut, paste and copy
245 ;; menu items. Use them if your system expects these to use the clipboard.
246
247 (put 'clipboard-kill-region 'menu-enable 'mark-active)
248 (put 'clipboard-kill-ring-save 'menu-enable 'mark-active)
249 (put 'clipboard-yank 'menu-enable
250 '(or (x-selection-exists-p) (x-selection-exists-p 'CLIPBOARD)))
251
252 (defun clipboard-yank ()
253 "Reinsert the last stretch of killed text, or the clipboard contents."
254 (interactive)
255 (let ((x-select-enable-clipboard t))
256 (yank)))
257
258 (defun clipboard-kill-ring-save (beg end)
259 "Copy region to kill ring, and save in the X clipboard."
260 (interactive "r")
261 (let ((x-select-enable-clipboard t))
262 (kill-ring-save beg end)))
263
264 (defun clipboard-kill-region (beg end)
265 "Kill the region, and save it in the X clipboard."
266 (interactive "r")
267 (let ((x-select-enable-clipboard t))
268 (kill-region beg end)))
269
270 (defun menu-bar-enable-clipboard ()
271 "Make CUT, PASTE and COPY (keys and menu bar items) use the clipboard.
272 Do the same for the keys of the same name."
273 (interactive)
274 ;; We can't use constant list structure here because it becomes pure,
275 ;; and because it gets modified with cache data.
276 (define-key menu-bar-edit-menu [paste]
277 (cons "Paste" 'clipboard-yank))
278 (define-key menu-bar-edit-menu [copy]
279 (cons "Copy" 'clipboard-kill-ring-save))
280 (define-key menu-bar-edit-menu [cut]
281 (cons "Cut" 'clipboard-kill-region))
282
283 (define-key global-map [f20] 'clipboard-kill-region)
284 (define-key global-map [f16] 'clipboard-kill-ring-save)
285 (define-key global-map [f18] 'clipboard-yank)
286 ;; X11R6 versions
287 (define-key global-map [cut] 'clipboard-kill-region)
288 (define-key global-map [copy] 'clipboard-kill-ring-save)
289 (define-key global-map [paste] 'clipboard-yank))
290 \f
291 (define-key menu-bar-help-menu [emacs-version]
292 '("Show Version" . emacs-version))
293 (define-key menu-bar-help-menu [report-emacs-bug]
294 '("Send Bug Report" . report-emacs-bug))
295 (define-key menu-bar-help-menu [emacs-tutorial]
296 '("Emacs Tutorial" . help-with-tutorial))
297 (define-key menu-bar-help-menu [man] '("Man..." . manual-entry))
298 (define-key menu-bar-help-menu [describe-variable]
299 '("Describe Variable..." . describe-variable))
300 (define-key menu-bar-help-menu [describe-function]
301 '("Describe Function..." . describe-function))
302 (define-key menu-bar-help-menu [describe-key]
303 '("Describe Key..." . describe-key))
304 (define-key menu-bar-help-menu [list-keybindings]
305 '("List Keybindings" . describe-bindings))
306 (define-key menu-bar-help-menu [command-apropos]
307 '("Command Apropos..." . command-apropos))
308 (define-key menu-bar-help-menu [describe-mode]
309 '("Describe Mode" . describe-mode))
310 (define-key menu-bar-help-menu [info] '("Info" . info))
311 (define-key menu-bar-help-menu [emacs-faq] '("Emacs FAQ" . view-emacs-FAQ))
312 (define-key menu-bar-help-menu [emacs-news] '("Emacs News" . view-emacs-news))
313
314 (defun kill-this-buffer () ; for the menubar
315 "Kills the current buffer."
316 (interactive)
317 (kill-buffer (current-buffer)))
318
319 (defun kill-this-buffer-enabled-p ()
320 (let ((count 0)
321 (buffers (buffer-list)))
322 (while buffers
323 (or (string-match "^ " (buffer-name (car buffers)))
324 (setq count (1+ count)))
325 (setq buffers (cdr buffers)))
326 (> count 1)))
327
328 (put 'save-buffer 'menu-enable '(buffer-modified-p))
329 (put 'revert-buffer 'menu-enable
330 '(or revert-buffer-function revert-buffer-insert-file-contents-function
331 (and (buffer-file-name)
332 (or (buffer-modified-p)
333 (not (verify-visited-file-modtime (current-buffer)))))))
334 ;; Permit deleting frame if it would leave a visible or iconified frame.
335 (put 'delete-frame 'menu-enable
336 '(let ((frames (frame-list))
337 (count 0))
338 (while frames
339 (if (cdr (assq 'visibility (frame-parameters (car frames))))
340 (setq count (1+ count)))
341 (setq frames (cdr frames)))
342 (> count 1)))
343 (put 'kill-this-buffer 'menu-enable '(kill-this-buffer-enabled-p))
344
345 (put 'advertised-undo 'menu-enable
346 '(and (not (eq t buffer-undo-list))
347 (if (eq last-command 'undo)
348 (and (boundp 'pending-undo-list)
349 pending-undo-list)
350 buffer-undo-list)))
351
352 (defvar yank-menu-length 20
353 "*Maximum length to display in the yank-menu.")
354
355 (defun menu-bar-update-yank-menu (string old)
356 (let ((front (car (cdr yank-menu)))
357 (menu-string (if (<= (length string) yank-menu-length)
358 string
359 (concat
360 (substring string 0 (/ yank-menu-length 2))
361 "..."
362 (substring string (- (/ yank-menu-length 2)))))))
363 ;; If we're supposed to be extending an existing string, and that
364 ;; string really is at the front of the menu, then update it in place.
365 (if (and old (or (eq old (car front))
366 (string= old (car front))))
367 (progn
368 (setcar front string)
369 (setcar (cdr front) menu-string))
370 (setcdr yank-menu
371 (cons
372 (cons string (cons menu-string 'menu-bar-select-yank))
373 (cdr yank-menu)))))
374 (if (> (length (cdr yank-menu)) kill-ring-max)
375 (setcdr (nthcdr kill-ring-max yank-menu) nil)))
376
377 (defun menu-bar-select-yank ()
378 (interactive "*")
379 (push-mark (point))
380 (insert last-command-event))
381 \f
382 (define-key global-map [menu-bar buffer] '("Buffers" . menu-bar-buffers))
383
384 (defalias 'menu-bar-buffers (make-sparse-keymap "Buffers"))
385
386 (defvar buffers-menu-max-size 10
387 "*Maximum number of entries which may appear on the Buffers menu.
388 If this is 10, then only the ten most-recently-selected buffers are shown.
389 If this is nil, then all buffers are shown.
390 A large number or nil slows down menu responsiveness.")
391
392 (defvar list-buffers-directory nil)
393
394 (defvar menu-bar-update-buffers-maxbuf)
395
396 (defun menu-bar-select-buffer ()
397 (interactive)
398 (switch-to-buffer last-command-event))
399
400 (defun menu-bar-select-frame ()
401 (interactive)
402 (make-frame-visible last-command-event)
403 (raise-frame last-command-event)
404 (select-frame last-command-event))
405
406 (defun menu-bar-update-buffers-1 (elt)
407 (cons (format
408 (format "%%%ds %%s%%s %%s" menu-bar-update-buffers-maxbuf)
409 (cdr elt)
410 (if (buffer-modified-p (car elt))
411 "*" " ")
412 (save-excursion
413 (set-buffer (car elt))
414 (if buffer-read-only "%" " "))
415 (let ((file
416 (or (buffer-file-name (car elt))
417 (save-excursion
418 (set-buffer (car elt))
419 list-buffers-directory)
420 "")))
421 (setq file (or (file-name-directory file)
422 ""))
423 (if (> (length file) 20)
424 (setq file (concat "..." (substring file -17))))
425 file))
426 (car elt)))
427
428 (defun menu-bar-update-buffers ()
429 ;; If user discards the Buffers item, play along.
430 (and (lookup-key (current-global-map) [menu-bar buffer])
431 (frame-or-buffer-changed-p)
432 (let ((buffers (buffer-list))
433 (frames (frame-list))
434 buffers-menu frames-menu)
435 ;; If requested, list only the N most recently selected buffers.
436 (if (and (integerp buffers-menu-max-size)
437 (> buffers-menu-max-size 1))
438 (if (> (length buffers) buffers-menu-max-size)
439 (setcdr (nthcdr buffers-menu-max-size buffers) nil)))
440
441 ;; Make the menu of buffers proper.
442 (setq buffers-menu
443 (cons "Select Buffer"
444 (let* ((buffer-list
445 (mapcar 'list buffers))
446 tail
447 (menu-bar-update-buffers-maxbuf 0)
448 (maxlen 0)
449 alist
450 head)
451 ;; Put into each element of buffer-list
452 ;; the name for actual display,
453 ;; perhaps truncated in the middle.
454 (setq tail buffer-list)
455 (while tail
456 (let ((name (buffer-name (car (car tail)))))
457 (setcdr (car tail)
458 (if (> (length name) 27)
459 (concat (substring name 0 12)
460 "..."
461 (substring name -12))
462 name)))
463 (setq tail (cdr tail)))
464 ;; Compute the maximum length of any name.
465 (setq tail buffer-list)
466 (while tail
467 (or (eq ?\ (aref (cdr (car tail)) 0))
468 (setq menu-bar-update-buffers-maxbuf
469 (max menu-bar-update-buffers-maxbuf
470 (length (cdr (car tail))))))
471 (setq tail (cdr tail)))
472 ;; Set ALIST to an alist of the form
473 ;; ITEM-STRING . BUFFER
474 (setq tail buffer-list)
475 (while tail
476 (let ((elt (car tail)))
477 (or (eq ?\ (aref (cdr elt) 0))
478 (setq alist (cons
479 (menu-bar-update-buffers-1 elt)
480 alist)))
481 (and alist (> (length (car (car alist))) maxlen)
482 (setq maxlen (length (car (car alist))))))
483 (setq tail (cdr tail)))
484 (setq alist (nreverse alist))
485 (nconc (mapcar '(lambda (pair)
486 ;; This is somewhat risque, to use
487 ;; the buffer name itself as the event
488 ;; type to define, but it works.
489 ;; It would not work to use the buffer
490 ;; since a buffer as an event has its
491 ;; own meaning.
492 (nconc (list (buffer-name (cdr pair))
493 (car pair)
494 (cons nil nil))
495 'menu-bar-select-buffer))
496 alist)
497 (list
498 (cons
499 'list-buffers
500 (cons
501 (concat (make-string (max (- (/ maxlen 2) 8) 0)
502 ?\ )
503 "List All Buffers")
504 'list-buffers)))))))
505
506
507 ;; Make a Frames menu if we have more than one frame.
508 (if (cdr frames)
509 (setq frames-menu
510 (cons "Select Frame"
511 (mapcar '(lambda (frame)
512 (nconc (list frame
513 (cdr (assq 'name
514 (frame-parameters frame)))
515 (cons nil nil))
516 'menu-bar-select-frame))
517 frames))))
518 (if buffers-menu
519 (setq buffers-menu (cons 'keymap buffers-menu)))
520 (if frames-menu
521 (setq frames-menu (cons 'keymap frames-menu)))
522 (define-key (current-global-map) [menu-bar buffer]
523 (cons "Buffers"
524 (if (and buffers-menu frames-menu)
525 (list 'keymap "Buffers and Frames"
526 (cons 'buffers (cons "Buffers" buffers-menu))
527 (cons 'frames (cons "Frames" frames-menu)))
528 (or buffers-menu frames-menu 'undefined)))))))
529
530 (add-hook 'menu-bar-update-hook 'menu-bar-update-buffers)
531
532 ;; this version is too slow
533 ;;;(defun format-buffers-menu-line (buffer)
534 ;;; "Returns a string to represent the given buffer in the Buffer menu.
535 ;;;nil means the buffer shouldn't be listed. You can redefine this."
536 ;;; (if (string-match "\\` " (buffer-name buffer))
537 ;;; nil
538 ;;; (save-excursion
539 ;;; (set-buffer buffer)
540 ;;; (let ((size (buffer-size)))
541 ;;; (format "%s%s %-19s %6s %-15s %s"
542 ;;; (if (buffer-modified-p) "*" " ")
543 ;;; (if buffer-read-only "%" " ")
544 ;;; (buffer-name)
545 ;;; size
546 ;;; mode-name
547 ;;; (or (buffer-file-name) ""))))))
548 \f
549 (defvar menu-bar-mode nil)
550
551 (defun menu-bar-mode (flag)
552 "Toggle display of a menu bar on each frame.
553 This command applies to all frames that exist and frames to be
554 created in the future.
555 With a numeric argument, if the argument is negative,
556 turn off menu bars; otherwise, turn on menu bars."
557 (interactive "P")
558
559 ;; Make menu-bar-mode and default-frame-alist consistent.
560 (let ((default (assq 'menu-bar-lines default-frame-alist)))
561 (if default
562 (setq menu-bar-mode (not (eq (cdr default) 0)))
563 (setq default-frame-alist
564 (cons (cons 'menu-bar-lines (if menu-bar-mode 1 0))
565 default-frame-alist))))
566
567 ;; Toggle or set the mode, according to FLAG.
568 (setq menu-bar-mode (if (null flag) (not menu-bar-mode)
569 (> (prefix-numeric-value flag) 0)))
570
571 ;; Apply it to default-frame-alist.
572 (let ((parameter (assq 'menu-bar-lines default-frame-alist)))
573 (if (consp parameter)
574 (setcdr parameter (if menu-bar-mode 1 0))
575 (setq default-frame-alist
576 (cons (cons 'menu-bar-lines (if menu-bar-mode 1 0))
577 default-frame-alist))))
578
579 ;; Apply it to existing frames.
580 (let ((frames (frame-list)))
581 (while frames
582 (let ((height (cdr (assq 'height (frame-parameters (car frames))))))
583 (modify-frame-parameters (car frames)
584 (list (cons 'menu-bar-lines
585 (if menu-bar-mode 1 0))))
586 (modify-frame-parameters (car frames)
587 (list (cons 'height height))))
588 (setq frames (cdr frames)))))
589
590 (provide 'menu-bar)
591
592 ;;; menu-bar.el ends here