# HG changeset patch # User Jan Dj¸«£rv # Date 1046534104 0 # Node ID afcd12db03675fa95d1de36d81693d14046a22a6 # Parent bda88bfc6c5e87230d583c904fe3bbf2ecfff826 * startup.el (command-line): Call menu-bar-mode with 1 instead of t. * menu-bar.el (menu-bar-mode): Change to define-minor-mode and initialize as for tool-bar-mode. diff -r bda88bfc6c5e -r afcd12db0367 lisp/ChangeLog --- a/lisp/ChangeLog Fri Feb 28 18:29:33 2003 +0000 +++ b/lisp/ChangeLog Sat Mar 01 15:55:04 2003 +0000 @@ -1,3 +1,10 @@ +2003-03-01 Jan Dj,Ad(Brv + + * startup.el (command-line): Call menu-bar-mode with 1 instead of t. + + * menu-bar.el (menu-bar-mode): Change to define-minor-mode + and initialize as for tool-bar-mode. + 2003-02-28 Kai Gro,A_(Bjohann * lisp/net/tramp.el: Version 2.0.30 released. diff -r bda88bfc6c5e -r afcd12db0367 lisp/menu-bar.el --- a/lisp/menu-bar.el Fri Feb 28 18:29:33 2003 +0000 +++ b/lisp/menu-bar.el Sat Mar 01 15:55:04 2003 +0000 @@ -1611,61 +1611,44 @@ (list 'menu-item "Enter" 'exit-minibuffer :help "Terminate input and exit minibuffer"))) -(defcustom menu-bar-mode t - "Toggle display of a menu bar on each frame. -Setting this variable directly does not take effect; -use either \\[customize] or the function `menu-bar-mode'." - :set (lambda (symbol value) - (menu-bar-mode (or value 0))) - :initialize 'custom-initialize-default - :type 'boolean - :group 'frames) +;;;###autoload +;; This comment is taken from toolbar/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)) -(defun menu-bar-mode (&optional flag) +;;;###autoload +(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." - (interactive "P") - + :init-value nil + :global t + :group 'frames ;; 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)))) - - ;; Toggle or set the mode, according to FLAG. - (setq menu-bar-mode (if (null flag) (not menu-bar-mode) - (> (prefix-numeric-value flag) 0))) + (let ((lines (if menu-bar-mode 1 0))) + ;; Alter existing frames... + (mapc (lambda (frame) + (modify-frame-parameters frame + (list (cons 'menu-bar-lines lines)))) + (frame-list)) + ;; ...and future ones. + (let ((elt (assq 'menu-bar-lines default-frame-alist))) + (if elt + (setcdr elt lines) + (add-to-list 'default-frame-alist (cons 'menu-bar-lines lines))))) - ;; 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)))) - - (when (interactive-p) - (if menu-bar-mode - (message "Menu-bar mode enabled.") - (message "Menu-bar mode disabled. Use M-x menu-bar-mode to make the menu bar appear.")) - (customize-mark-as-set 'menu-bar-mode)) - + ;; 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 (interactive-p) (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) (provide 'menu-bar) diff -r bda88bfc6c5e -r afcd12db0367 lisp/startup.el --- a/lisp/startup.el Fri Feb 28 18:29:33 2003 +0000 +++ b/lisp/startup.el Sat Mar 01 15:55:04 2003 +0000 @@ -807,7 +807,7 @@ (unless (or noninteractive (and (memq window-system '(x w32)) (<= (frame-parameter nil 'menu-bar-lines) 0))) - (menu-bar-mode t)) + (menu-bar-mode 1)) ;; If frame was created with a tool bar, switch tool-bar-mode on. (unless (or noninteractive