diff lisp/menu-bar.el @ 109058:2f0720afc474

Change default-frame-alist and menu/tool-bar-mode interaction (Bug#2249). Don't add entries for `menu-bar-lines' and `tool-bar-lines' to `default-frame-alist' and `initial-frame-alist' at startup. Instead, use X resources to update the `menu-bar-mode' and `tool-bar-mode' variables at startup, and use them as defaults during frame creation. * lisp/frame.el (frame-notice-user-settings): Don't change default-frame-alist based on menu-bar-mode and tool-bar-mode, or vice versa. * lisp/menu-bar.el (menu-bar-mode): * lisp/tool-bar.el (tool-bar-mode): Don't change default-frame-alist. Set init-value to t. * lisp/startup.el (command-line): Use X resources to set the value of menu-bar-mode and tool-bar-mode, before calling frame-initialize. * src/frame.c (Vmenu_bar_mode, Vtool_bar_mode): New vars. * src/w32fns.c (Fx_create_frame): * src/nsfns.m (Fx_create_frame): Likewise. * src/xfns.c (Fx_create_frame): Don't consult X resouces when setting menu-bar-lines and tool-bar-lines. Use menu-bar-mode and tool-bar-mode, which are now set using these X resources at startup, to determine the defaults.
author Chong Yidong <cyd@stupidchicken.com>
date Sat, 26 Jun 2010 20:30:52 -0400
parents c138aa96dae8
children 783986775ee8
line wrap: on
line diff
--- a/lisp/menu-bar.el	Sat Jun 26 17:41:12 2010 +0300
+++ b/lisp/menu-bar.el	Sat Jun 26 20:30:52 2010 -0400
@@ -1924,28 +1924,20 @@
     `(menu-item ,(purecopy "Previous History Item") previous-history-element
 		:help ,(purecopy "Put previous minibuffer history element in the minibuffer"))))
 
-;;;###autoload
-;; This comment is taken from tool-bar.el near
-;; (put 'tool-bar-mode ...)
-;; We want to pretend the menu bar by standard is on, as this will make
-;; customize consider disabling the menu bar a customization, and save
-;; that.  We could do this for real by setting :init-value below, but
-;; that would overwrite disabling the tool bar from X resources.
-(put 'menu-bar-mode 'standard-value '(t))
-
 (define-minor-mode menu-bar-mode
   "Toggle display of a menu bar on each frame.
 This command applies to all frames that exist and frames to be
 created in the future.
 With a numeric argument, if the argument is positive,
 turn on menu bars; otherwise, turn off menu bars."
-  :init-value nil
+  :init-value t
   :global t
   :group 'frames
 
-  ;; Make menu-bar-mode and default-frame-alist consistent.
-  (modify-all-frames-parameters (list (cons 'menu-bar-lines
-					    (if menu-bar-mode 1 0))))
+  ;; 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)))
 
   ;; Make the message appear when Emacs is idle.  We can not call message
   ;; directly.  The minor-mode message "Menu-bar mode disabled" comes