summaryrefslogtreecommitdiff
path: root/lisp/menu-bar.el
diff options
context:
space:
mode:
authorChong Yidong <cyd@stupidchicken.com>2010-07-05 13:54:13 -0400
committerChong Yidong <cyd@stupidchicken.com>2010-07-05 13:54:13 -0400
commit4ad11f8ccbec3bda22e53f867e8ed7de0de1a085 (patch)
tree726800cb1c61402f1494cd51a89625f419b43d2f /lisp/menu-bar.el
parent81133808b8232266ce6244eae6b14ffc7dc92cbc (diff)
downloademacs-4ad11f8ccbec3bda22e53f867e8ed7de0de1a085.tar.gz
Set default-frame-alist, if necessary, in menu/tool-bar-mode.
* menu-bar.el (menu-bar-mode): * tool-bar.el (tool-bar-mode): Replace default-frame-alist element if it has been set.
Diffstat (limited to 'lisp/menu-bar.el')
-rw-r--r--lisp/menu-bar.el13
1 files changed, 9 insertions, 4 deletions
diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el
index 20ad50c9048..f94b67a6e89 100644
--- a/lisp/menu-bar.el
+++ b/lisp/menu-bar.el
@@ -1937,15 +1937,20 @@ turn on menu bars; otherwise, turn off menu bars."
;; Turn the menu-bars on all frames on or off.
(let ((val (if menu-bar-mode 1 0)))
(dolist (frame (frame-list))
- (set-frame-parameter frame 'menu-bar-lines val)))
-
+ (set-frame-parameter frame 'menu-bar-lines val))
+ ;; If the user has given `default-frame-alist' a `menu-bar-lines'
+ ;; parameter, replace it.
+ (if (assq 'menu-bar-lines default-frame-alist)
+ (setq default-frame-alist
+ (cons (cons 'menu-bar-lines val)
+ (assq-delete-all 'menu-bar-lines
+ default-frame-alist)))))
;; Make the message appear when Emacs is idle. We can not call message
;; directly. The minor-mode message "Menu-bar mode disabled" comes
;; after this function returns, overwriting any message we do here.
(when (and (called-interactively-p 'interactive) (not menu-bar-mode))
(run-with-idle-timer 0 nil 'message
- "Menu-bar mode disabled. Use M-x menu-bar-mode to make the menu bar appear."))
- menu-bar-mode)
+ "Menu-bar mode disabled. Use M-x menu-bar-mode to make the menu bar appear.")))
(defun toggle-menu-bar-mode-from-frame (&optional arg)
"Toggle menu bar on or off, based on the status of the current frame.