diff options
| author | Roland McGrath | 1993-08-06 21:06:10 +0000 |
|---|---|---|
| committer | Roland McGrath | 1993-08-06 21:06:10 +0000 |
| commit | dad8e392925b680712ecf2ce721b0318c60f25cc (patch) | |
| tree | c2d47d03b066e301abf529bb6622bb0c399a6269 | |
| parent | 6ee9f9535837446ff3e051c82653b7aef4b95331 (diff) | |
| download | emacs-dad8e392925b680712ecf2ce721b0318c60f25cc.tar.gz emacs-dad8e392925b680712ecf2ce721b0318c60f25cc.zip | |
(menu-bar-mode): Defvar removed.
(menu-bar-mode): Rewritten to parallel scroll-bar-mode.
| -rw-r--r-- | lisp/menu-bar.el | 49 |
1 files changed, 27 insertions, 22 deletions
diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el index f6150a9a31b..2b34cb96dfb 100644 --- a/lisp/menu-bar.el +++ b/lisp/menu-bar.el | |||
| @@ -281,34 +281,39 @@ and selects that window." | |||
| 281 | ;;; mode-name | 281 | ;;; mode-name |
| 282 | ;;; (or (buffer-file-name) "")))))) | 282 | ;;; (or (buffer-file-name) "")))))) |
| 283 | 283 | ||
| 284 | (defvar menu-bar-mode nil) | ||
| 285 | |||
| 286 | (defun menu-bar-mode (flag) | 284 | (defun menu-bar-mode (flag) |
| 287 | "Toggle display of a menu bar on each frame. | 285 | "Toggle display of a menu bar on each frame. |
| 288 | This command applies to all frames that exist and frames to be | 286 | This command applies to all frames that exist and frames to be |
| 289 | created in the future. | 287 | created in the future. |
| 290 | With a numeric argument, if the argument is negative, | 288 | With a numeric argument, if the argument is negative, |
| 291 | turn off menu bars; otherwise, turn on menu bars." | 289 | turn off menu bars; otherwise, turn on menu bars." |
| 292 | (interactive "P") | 290 | (interactive "P") |
| 293 | (setq menu-bar-mode (if (null flag) (not menu-bar-mode) | 291 | (if flag (setq flag (prefix-numeric-value flag))) |
| 294 | (or (not (numberp flag)) (>= flag 0)))) | 292 | |
| 295 | (let ((parameter (assq 'menu-bar-lines default-frame-alist))) | 293 | ;; Obtain the current setting by looking at default-frame-alist. |
| 296 | (if (consp parameter) | 294 | (let ((menu-bar-mode |
| 297 | (setcdr parameter (if menu-bar-mode 1 0)) | 295 | (not (zerop (let ((assq (assq 'menu-bar-lines default-frame-alist))) |
| 298 | (setq default-frame-alist | 296 | (if assq (cdr assq) 0)))))) |
| 299 | (cons (cons 'menu-bar-lines (if menu-bar-mode 1 0)) | 297 | |
| 300 | default-frame-alist)))) | 298 | ;; Tweedle it according to the argument. |
| 301 | (let ((frames (frame-list))) | 299 | (setq menu-bar-mode (if (null flag) (not menu-bar-mode) |
| 302 | (while frames | 300 | (or (not (numberp flag)) (>= flag 0)))) |
| 303 | ;; Turn menu bar on or off in existing frames. | 301 | |
| 304 | ;; (Except for minibuffer-only frames.) | 302 | ;; Apply it to default-frame-alist. |
| 305 | (or (eq 'only (cdr (assq 'minibuffer (frame-parameters (car frames))))) | 303 | (let ((parameter (assq 'menu-bar-lines default-frame-alist))) |
| 306 | (modify-frame-parameters | 304 | (if (consp parameter) |
| 307 | (car frames) | 305 | (setcdr parameter (if menu-bar-mode 1 0)) |
| 308 | (list (if menu-bar-mode | 306 | (setq default-frame-alist |
| 309 | '(menu-bar-lines . 1) | 307 | (cons (cons 'menu-bar-lines (if menu-bar-mode 1 0)) |
| 310 | '(menu-bar-lines . 0))))) | 308 | default-frame-alist)))) |
| 311 | (setq frames (cdr frames))))) | 309 | |
| 310 | ;; Apply it to existing frames. | ||
| 311 | (let ((frames (frame-list))) | ||
| 312 | (while frames | ||
| 313 | (modify-frame-parameters (car frames) | ||
| 314 | (list (cons 'menu-bar-lines | ||
| 315 | (if menu-bar-mode 1 0)))) | ||
| 316 | (setq frames (cdr frames)))))) | ||
| 312 | 317 | ||
| 313 | ;; Make frames created from now on have a menu bar. | 318 | ;; Make frames created from now on have a menu bar. |
| 314 | (if window-system | 319 | (if window-system |