diff options
| author | Jan Djärv | 2003-03-01 15:55:04 +0000 |
|---|---|---|
| committer | Jan Djärv | 2003-03-01 15:55:04 +0000 |
| commit | 8ab9589dfca1cbe6e32e9608ef8cfa875c28c4a2 (patch) | |
| tree | e1a9c6621f15ba5a1c04b33ee9c4aa036a86a14d | |
| parent | 884b79ec1d212607d4ce3d9f8eb827a6e30719c2 (diff) | |
| download | emacs-8ab9589dfca1cbe6e32e9608ef8cfa875c28c4a2.tar.gz emacs-8ab9589dfca1cbe6e32e9608ef8cfa875c28c4a2.zip | |
* 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.
| -rw-r--r-- | lisp/ChangeLog | 7 | ||||
| -rw-r--r-- | lisp/menu-bar.el | 81 | ||||
| -rw-r--r-- | lisp/startup.el | 2 |
3 files changed, 40 insertions, 50 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 71e9b030ffc..3ef08a44105 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,10 @@ | |||
| 1 | 2003-03-01 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> | ||
| 2 | |||
| 3 | * startup.el (command-line): Call menu-bar-mode with 1 instead of t. | ||
| 4 | |||
| 5 | * menu-bar.el (menu-bar-mode): Change to define-minor-mode | ||
| 6 | and initialize as for tool-bar-mode. | ||
| 7 | |||
| 1 | 2003-02-28 Kai Gro,A_(Bjohann <kai.grossjohann@uni-duisburg.de> | 8 | 2003-02-28 Kai Gro,A_(Bjohann <kai.grossjohann@uni-duisburg.de> |
| 2 | 9 | ||
| 3 | * lisp/net/tramp.el: Version 2.0.30 released. | 10 | * lisp/net/tramp.el: Version 2.0.30 released. |
diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el index 2c0dbd6e253..596241c08b6 100644 --- a/lisp/menu-bar.el +++ b/lisp/menu-bar.el | |||
| @@ -1611,61 +1611,44 @@ Buffers menu is regenerated." | |||
| 1611 | (list 'menu-item "Enter" 'exit-minibuffer | 1611 | (list 'menu-item "Enter" 'exit-minibuffer |
| 1612 | :help "Terminate input and exit minibuffer"))) | 1612 | :help "Terminate input and exit minibuffer"))) |
| 1613 | 1613 | ||
| 1614 | (defcustom menu-bar-mode t | 1614 | ;;;###autoload |
| 1615 | "Toggle display of a menu bar on each frame. | 1615 | ;; This comment is taken from toolbar/tool-bar.el near |
| 1616 | Setting this variable directly does not take effect; | 1616 | ;; (put 'tool-bar-mode ...) |
| 1617 | use either \\[customize] or the function `menu-bar-mode'." | 1617 | ;; We want to pretend the menu bar by standard is on, as this will make |
| 1618 | :set (lambda (symbol value) | 1618 | ;; customize consider disabling the menu bar a customization, and save |
| 1619 | (menu-bar-mode (or value 0))) | 1619 | ;; that. We could do this for real by setting :init-value below, but |
| 1620 | :initialize 'custom-initialize-default | 1620 | ;; that would overwrite disabling the tool bar from X resources. |
| 1621 | :type 'boolean | 1621 | (put 'menu-bar-mode 'standard-value '(t)) |
| 1622 | :group 'frames) | 1622 | |
| 1623 | 1623 | ;;;###autoload | |
| 1624 | (defun menu-bar-mode (&optional flag) | 1624 | (define-minor-mode menu-bar-mode |
| 1625 | "Toggle display of a menu bar on each frame. | 1625 | "Toggle display of a menu bar on each frame. |
| 1626 | This command applies to all frames that exist and frames to be | 1626 | This command applies to all frames that exist and frames to be |
| 1627 | created in the future. | 1627 | created in the future. |
| 1628 | With a numeric argument, if the argument is positive, | 1628 | With a numeric argument, if the argument is positive, |
| 1629 | turn on menu bars; otherwise, turn off menu bars." | 1629 | turn on menu bars; otherwise, turn off menu bars." |
| 1630 | (interactive "P") | 1630 | :init-value nil |
| 1631 | 1631 | :global t | |
| 1632 | :group 'frames | ||
| 1632 | ;; Make menu-bar-mode and default-frame-alist consistent. | 1633 | ;; Make menu-bar-mode and default-frame-alist consistent. |
| 1633 | (let ((default (assq 'menu-bar-lines default-frame-alist))) | 1634 | (let ((lines (if menu-bar-mode 1 0))) |
| 1634 | (if default | 1635 | ;; Alter existing frames... |
| 1635 | (setq menu-bar-mode (not (eq (cdr default) 0))) | 1636 | (mapc (lambda (frame) |
| 1636 | (setq default-frame-alist | 1637 | (modify-frame-parameters frame |
| 1637 | (cons (cons 'menu-bar-lines (if menu-bar-mode 1 0)) | 1638 | (list (cons 'menu-bar-lines lines)))) |
| 1638 | default-frame-alist)))) | 1639 | (frame-list)) |
| 1639 | 1640 | ;; ...and future ones. | |
| 1640 | ;; Toggle or set the mode, according to FLAG. | 1641 | (let ((elt (assq 'menu-bar-lines default-frame-alist))) |
| 1641 | (setq menu-bar-mode (if (null flag) (not menu-bar-mode) | 1642 | (if elt |
| 1642 | (> (prefix-numeric-value flag) 0))) | 1643 | (setcdr elt lines) |
| 1643 | 1644 | (add-to-list 'default-frame-alist (cons 'menu-bar-lines lines))))) | |
| 1644 | ;; Apply it to default-frame-alist. | 1645 | |
| 1645 | (let ((parameter (assq 'menu-bar-lines default-frame-alist))) | 1646 | ;; Make the message appear when Emacs is idle. We can not call message |
| 1646 | (if (consp parameter) | 1647 | ;; directly. The minor-mode message "Menu-bar mode disabled" comes |
| 1647 | (setcdr parameter (if menu-bar-mode 1 0)) | 1648 | ;; after this function returns, overwriting any message we do here. |
| 1648 | (setq default-frame-alist | 1649 | (when (and (interactive-p) (not menu-bar-mode)) |
| 1649 | (cons (cons 'menu-bar-lines (if menu-bar-mode 1 0)) | 1650 | (run-with-idle-timer 0 nil 'message |
| 1650 | default-frame-alist)))) | 1651 | "Menu-bar mode disabled. Use M-x menu-bar-mode to make the menu bar appear.")) |
| 1651 | |||
| 1652 | ;; Apply it to existing frames. | ||
| 1653 | (let ((frames (frame-list))) | ||
| 1654 | (while frames | ||
| 1655 | (let ((height (cdr (assq 'height (frame-parameters (car frames)))))) | ||
| 1656 | (modify-frame-parameters (car frames) | ||
| 1657 | (list (cons 'menu-bar-lines | ||
| 1658 | (if menu-bar-mode 1 0)))) | ||
| 1659 | (modify-frame-parameters (car frames) | ||
| 1660 | (list (cons 'height height)))) | ||
| 1661 | (setq frames (cdr frames)))) | ||
| 1662 | |||
| 1663 | (when (interactive-p) | ||
| 1664 | (if menu-bar-mode | ||
| 1665 | (message "Menu-bar mode enabled.") | ||
| 1666 | (message "Menu-bar mode disabled. Use M-x menu-bar-mode to make the menu bar appear.")) | ||
| 1667 | (customize-mark-as-set 'menu-bar-mode)) | ||
| 1668 | |||
| 1669 | menu-bar-mode) | 1652 | menu-bar-mode) |
| 1670 | 1653 | ||
| 1671 | (provide 'menu-bar) | 1654 | (provide 'menu-bar) |
diff --git a/lisp/startup.el b/lisp/startup.el index e4310533647..095ef413b38 100644 --- a/lisp/startup.el +++ b/lisp/startup.el | |||
| @@ -807,7 +807,7 @@ or `CVS', and any subdirectory that contains a file named `.nosearch'." | |||
| 807 | (unless (or noninteractive | 807 | (unless (or noninteractive |
| 808 | (and (memq window-system '(x w32)) | 808 | (and (memq window-system '(x w32)) |
| 809 | (<= (frame-parameter nil 'menu-bar-lines) 0))) | 809 | (<= (frame-parameter nil 'menu-bar-lines) 0))) |
| 810 | (menu-bar-mode t)) | 810 | (menu-bar-mode 1)) |
| 811 | 811 | ||
| 812 | ;; If frame was created with a tool bar, switch tool-bar-mode on. | 812 | ;; If frame was created with a tool bar, switch tool-bar-mode on. |
| 813 | (unless (or noninteractive | 813 | (unless (or noninteractive |