comparison 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
comparison
equal deleted inserted replaced
109057:384a6f7da770 109058:2f0720afc474
1922 :help ,(purecopy "Put next minibuffer history element in the minibuffer"))) 1922 :help ,(purecopy "Put next minibuffer history element in the minibuffer")))
1923 (define-key map [menu-bar minibuf previous] 1923 (define-key map [menu-bar minibuf previous]
1924 `(menu-item ,(purecopy "Previous History Item") previous-history-element 1924 `(menu-item ,(purecopy "Previous History Item") previous-history-element
1925 :help ,(purecopy "Put previous minibuffer history element in the minibuffer")))) 1925 :help ,(purecopy "Put previous minibuffer history element in the minibuffer"))))
1926 1926
1927 ;;;###autoload
1928 ;; This comment is taken from tool-bar.el near
1929 ;; (put 'tool-bar-mode ...)
1930 ;; We want to pretend the menu bar by standard is on, as this will make
1931 ;; customize consider disabling the menu bar a customization, and save
1932 ;; that. We could do this for real by setting :init-value below, but
1933 ;; that would overwrite disabling the tool bar from X resources.
1934 (put 'menu-bar-mode 'standard-value '(t))
1935
1936 (define-minor-mode menu-bar-mode 1927 (define-minor-mode menu-bar-mode
1937 "Toggle display of a menu bar on each frame. 1928 "Toggle display of a menu bar on each frame.
1938 This command applies to all frames that exist and frames to be 1929 This command applies to all frames that exist and frames to be
1939 created in the future. 1930 created in the future.
1940 With a numeric argument, if the argument is positive, 1931 With a numeric argument, if the argument is positive,
1941 turn on menu bars; otherwise, turn off menu bars." 1932 turn on menu bars; otherwise, turn off menu bars."
1942 :init-value nil 1933 :init-value t
1943 :global t 1934 :global t
1944 :group 'frames 1935 :group 'frames
1945 1936
1946 ;; Make menu-bar-mode and default-frame-alist consistent. 1937 ;; Turn the menu-bars on all frames on or off.
1947 (modify-all-frames-parameters (list (cons 'menu-bar-lines 1938 (let ((val (if menu-bar-mode 1 0)))
1948 (if menu-bar-mode 1 0)))) 1939 (dolist (frame (frame-list))
1940 (set-frame-parameter frame 'menu-bar-lines val)))
1949 1941
1950 ;; Make the message appear when Emacs is idle. We can not call message 1942 ;; Make the message appear when Emacs is idle. We can not call message
1951 ;; directly. The minor-mode message "Menu-bar mode disabled" comes 1943 ;; directly. The minor-mode message "Menu-bar mode disabled" comes
1952 ;; after this function returns, overwriting any message we do here. 1944 ;; after this function returns, overwriting any message we do here.
1953 (when (and (called-interactively-p 'interactive) (not menu-bar-mode)) 1945 (when (and (called-interactively-p 'interactive) (not menu-bar-mode))