emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/menu-bar.el


From: Stefan Monnier
Subject: [Emacs-diffs] Changes to emacs/lisp/menu-bar.el
Date: Fri, 06 Sep 2002 16:27:59 -0400

Index: emacs/lisp/menu-bar.el
diff -c emacs/lisp/menu-bar.el:1.226 emacs/lisp/menu-bar.el:1.227
*** emacs/lisp/menu-bar.el:1.226        Fri Aug 30 11:21:22 2002
--- emacs/lisp/menu-bar.el      Fri Sep  6 16:27:59 2002
***************
*** 551,556 ****
--- 551,568 ----
  
  ;(defvar menu-bar-preferences-menu (make-sparse-keymap "Preferences"))
  
+ (defmacro menu-bar-make-mm-toggle (fname doc help &optional props)
+   "Make a menu-item for a global minor mode toggle.
+ FNAME is the minor mode's name (variable and function).
+ DOC is the text to use the menu entry.
+ HELP is the text to use for the tooltip.
+ PROPS are additional properties."
+   `'(menu-item ,doc ',fname
+      ,@(if props props)
+      :help ,help
+      :button (:toggle . (and (default-boundp ',fname)
+                            (default-value ',fname)))))
+ 
  (defmacro menu-bar-make-toggle (name variable doc message help &optional 
props &rest body)
    `(progn
       (defun ,name ()
***************
*** 775,804 ****
        :visible `(display-graphic-p)
        :help "Select scroll-bar mode"))
  
! (defun showhide-menu-bar ()
!   "Toggle whether to turn menu-bar on/off."
!   (interactive)
!   (menu-bar-mode)
!   (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))
! 
! (define-key menu-bar-showhide-menu [showhide-menu-bar]
!   '(menu-item "Menu-bar" showhide-menu-bar
              :help "Toggle menu-bar on/off"
              :button (:toggle . menu-bar-mode)))
  
- (defun showhide-toolbar ()
-   "Toggle whether to turn tool-bar on/off."
-   (interactive)
-   (if (tool-bar-mode)
-       (message "Tool-bar mode enabled.")
-     (message "Tool-bar mode disabled."))
-   (customize-mark-as-set 'tool-bar-mode))
- 
  (define-key menu-bar-showhide-menu [showhide-tool-bar]
!   (list 'menu-item "Tool-bar" 'showhide-toolbar
        :help "Turn tool-bar on/off"
        :visible `(display-graphic-p)
        :button `(:toggle . tool-bar-mode)))
--- 787,799 ----
        :visible `(display-graphic-p)
        :help "Select scroll-bar mode"))
  
! (define-key menu-bar-showhide-menu [menu-bar-mode]
!   '(menu-item "Menu-bar" menu-bar-mode
              :help "Toggle menu-bar on/off"
              :button (:toggle . menu-bar-mode)))
  
  (define-key menu-bar-showhide-menu [showhide-tool-bar]
!   (list 'menu-item "Tool-bar" 'tool-bar-mode
        :help "Turn tool-bar on/off"
        :visible `(display-graphic-p)
        :button `(:toggle . tool-bar-mode)))
***************
*** 839,857 ****
    '("--"))
  (define-key menu-bar-options-menu [toggle-auto-compression]
    '(menu-item "Automatic File De/compression"
!             menu-bar-toggle-auto-compression-mode 
              :help "Transparently decompress compressed files"
              :button (:toggle . (rassq 'jka-compr-handler
                                        file-name-handler-alist))))
  
- (defun menu-bar-toggle-auto-compression ()
-   "Toggle automatic file compression and uncompression.
- With prefix argument ARG, turn auto compression on if positive, else off.
- Returns the new status of auto compression (non-nil means on)."
-   (interactive)
-   (auto-compression-mode)
-   (customize-mark-as-set 'auto-compression-mode))
- 
  (define-key menu-bar-options-menu [save-place]
    (menu-bar-make-toggle toggle-save-place-globally save-place
                        "Save Place in Files between Sessions"
--- 834,844 ----
    '("--"))
  (define-key menu-bar-options-menu [toggle-auto-compression]
    '(menu-item "Automatic File De/compression"
!             auto-compression-mode
              :help "Transparently decompress compressed files"
              :button (:toggle . (rassq 'jka-compr-handler
                                        file-name-handler-alist))))
  
  (define-key menu-bar-options-menu [save-place]
    (menu-bar-make-toggle toggle-save-place-globally save-place
                        "Save Place in Files between Sessions"
***************
*** 919,927 ****
  (define-key menu-bar-options-menu [highlight-separator]
    '("--"))
  (define-key menu-bar-options-menu [highlight-paren-mode]
!   (menu-bar-make-toggle toggle-highlight-paren-mode show-paren-mode
!                       "Paren Match Highlighting"
!                       "Show Paren mode %s"
                        "Highlight matching/mismatched parentheses at cursor 
(Show Paren mode)"))
  (define-key menu-bar-options-menu [transient-mark-mode]
    (menu-bar-make-toggle toggle-transient-mark-mode transient-mark-mode
--- 906,913 ----
  (define-key menu-bar-options-menu [highlight-separator]
    '("--"))
  (define-key menu-bar-options-menu [highlight-paren-mode]
!   (menu-bar-make-mm-toggle show-paren-mode
!                          "Paren Match Highlighting"
                        "Highlight matching/mismatched parentheses at cursor 
(Show Paren mode)"))
  (define-key menu-bar-options-menu [transient-mark-mode]
    (menu-bar-make-toggle toggle-transient-mark-mode transient-mark-mode
***************
*** 930,939 ****
                        "Make text in active region stand out in color 
(Transient Mark mode)"
                        (:enable (not cua-mode))))
  (define-key menu-bar-options-menu [toggle-global-lazy-font-lock-mode]
!   (menu-bar-make-toggle toggle-global-lazy-font-lock-mode 
global-font-lock-mode
!                       "Syntax Highlighting"
!                       "Global Font Lock mode %s"
!                       "Colorize text based on language syntax (Global Font 
Lock mode)"))
  
  
  ;; The "Tools" menu items
--- 916,924 ----
                        "Make text in active region stand out in color 
(Transient Mark mode)"
                        (:enable (not cua-mode))))
  (define-key menu-bar-options-menu [toggle-global-lazy-font-lock-mode]
!   (menu-bar-make-mm-toggle global-font-lock-mode
!                          "Syntax Highlighting"
!                          "Colorize text based on language syntax (Global Font 
Lock mode)"))
  
  
  ;; The "Tools" menu items
***************
*** 1615,1621 ****
  created in the future.
  With a numeric argument, if the argument is positive,
  turn on menu bars; otherwise, turn off menu bars."
!  (interactive "P")
  
    ;; Make menu-bar-mode and default-frame-alist consistent.
    (let ((default (assq 'menu-bar-lines default-frame-alist)))
--- 1600,1606 ----
  created in the future.
  With a numeric argument, if the argument is positive,
  turn on menu bars; otherwise, turn off menu bars."
!   (interactive "P")
  
    ;; Make menu-bar-mode and default-frame-alist consistent.
    (let ((default (assq 'menu-bar-lines default-frame-alist)))
***************
*** 1626,1652 ****
                  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)))
  
!  ;; 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)))))
  
  (provide 'menu-bar)
  
--- 1611,1645 ----
                  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)))
! 
!   ;; 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))
  
!   menu-bar-mode)
  
  (provide 'menu-bar)
  




reply via email to

[Prev in Thread] Current Thread [Next in Thread]