Mercurial > emacs
changeset 8055:6a0af6085c1a
(menu-bar-mode): Make this a global variable.
(menu-bar-mode): Make variable menu-bar-mode and default-frame-alist
consistent.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sat, 25 Jun 1994 18:20:30 +0000 |
parents | e9bc1c7ef17f |
children | 1c5fd2cdfb36 |
files | lisp/menu-bar.el |
diffstat | 1 files changed, 29 insertions(+), 24 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/menu-bar.el Sat Jun 25 17:54:57 1994 +0000 +++ b/lisp/menu-bar.el Sat Jun 25 18:20:30 1994 +0000 @@ -398,6 +398,8 @@ ;;; mode-name ;;; (or (buffer-file-name) "")))))) +(defvar menu-bar-mode nil) + (defun menu-bar-mode (flag) "Toggle display of a menu bar on each frame. This command applies to all frames that exist and frames to be @@ -406,33 +408,36 @@ turn off menu bars; otherwise, turn on menu bars." (interactive "P") - ;; Obtain the current setting by looking at default-frame-alist. - (let ((menu-bar-mode - (not (zerop (let ((assq (assq 'menu-bar-lines default-frame-alist))) - (if assq (cdr assq) 0)))))) + ;; Make menu-bar-mode and default-frame-alist consistent. + (let ((default (assq 'menu-bar-lines default-frame-alist))) + (if default + (setq menu-bar-mode (not (eq (cdr default) 0))) + (setq default-frame-alist + (cons (cons 'menu-bar-lines (if menu-bar-mode 1 0)) + default-frame-alist)))) - ;; Tweedle it according to the argument. - (setq menu-bar-mode (if (null flag) (not menu-bar-mode) - (> (prefix-numeric-value flag) 0))) + ;; Toggle or set the mode, according to FLAG. + (setq menu-bar-mode (if (null flag) (not menu-bar-mode) + (> (prefix-numeric-value flag) 0))) - ;; Apply it to default-frame-alist. - (let ((parameter (assq 'menu-bar-lines default-frame-alist))) - (if (consp parameter) - (setcdr parameter (if menu-bar-mode 1 0)) - (setq default-frame-alist - (cons (cons 'menu-bar-lines (if menu-bar-mode 1 0)) - default-frame-alist)))) + ;; Apply it to default-frame-alist. + (let ((parameter (assq 'menu-bar-lines default-frame-alist))) + (if (consp parameter) + (setcdr parameter (if menu-bar-mode 1 0)) + (setq default-frame-alist + (cons (cons 'menu-bar-lines (if menu-bar-mode 1 0)) + default-frame-alist)))) - ;; Apply it to existing frames. - (let ((frames (frame-list))) - (while frames - (let ((height (cdr (assq 'height (frame-parameters (car frames)))))) - (modify-frame-parameters (car frames) - (list (cons 'menu-bar-lines - (if menu-bar-mode 1 0)))) - (modify-frame-parameters (car frames) - (list (cons 'height height)))) - (setq frames (cdr frames)))))) + ;; Apply it to existing frames. + (let ((frames (frame-list))) + (while frames + (let ((height (cdr (assq 'height (frame-parameters (car frames)))))) + (modify-frame-parameters (car frames) + (list (cons 'menu-bar-lines + (if menu-bar-mode 1 0)))) + (modify-frame-parameters (car frames) + (list (cons 'height height)))) + (setq frames (cdr frames))))) (provide 'menu-bar)