changeset 45073:c7b6259de115

(menu-bar-make-toggle): Added optional PROPS arg. (menu-bar-options-save): Added cua-mode. (menu-bar-options-menu): Added toggle for cua-mode. Disable toggle for transient-mark-mode if cua-mode is enabled.
author Kim F. Storm <storm@cua.dk>
date Wed, 01 May 2002 22:01:16 +0000
parents 42c1cb1a6fdf
children d57f600f5b7e
files lisp/menu-bar.el
diffstat 1 files changed, 16 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/menu-bar.el	Wed May 01 21:59:53 2002 +0000
+++ b/lisp/menu-bar.el	Wed May 01 22:01:16 2002 +0000
@@ -540,7 +540,7 @@
 
 ;(defvar menu-bar-preferences-menu (make-sparse-keymap "Preferences"))
 
-(defmacro menu-bar-make-toggle (name variable doc message help &rest body)
+(defmacro menu-bar-make-toggle (name variable doc message help &optional props &rest body)
   `(progn
      (defun ,name ()
        ,(concat "Toggle whether to " (downcase (substring help 0 1))
@@ -566,6 +566,7 @@
 			(interactive)
 			(,name)
 			(customize-mark-as-set ',variable))
+		 ,@(if props props)
 		 :help ,help
                  :button (:toggle . (and (default-boundp ',variable)
 					 (default-value ',variable))))))
@@ -583,7 +584,7 @@
     (dolist (elt '(line-number-mode column-number-mode scroll-bar-mode
 		   debug-on-quit debug-on-error menu-bar-mode tool-bar-mode
 		   save-place uniquify-buffer-name-style
-		   case-fold-search show-paren-mode
+		   case-fold-search cua-mode show-paren-mode
 		   transient-mark-mode global-font-lock-mode
 		   display-time-mode auto-compression-mode
 		   current-language-environment default-input-method
@@ -777,6 +778,7 @@
 			"Use Directory Names in Buffer Names"
 			"Directory name in buffer names (uniquify) %s"
 			"Uniquify buffer names by adding parent directory names"
+			() ; no props
 			(require 'uniquify)
 			(setq uniquify-buffer-name-style
 			      (if (not uniquify-buffer-name-style)
@@ -784,6 +786,16 @@
 
 (define-key menu-bar-options-menu [edit-options-separator]
   '("--"))
+(define-key menu-bar-options-menu [cua-mode]
+  '(menu-item "CUA-style cut and paste"
+	      (lambda ()
+		(interactive)
+		(cua-mode nil)
+		(customize-mark-as-set 'cua-mode)
+		(message "CUA-style cut and paste %s"
+			 (if cua-mode "enabled" "disabled")))
+	      :help "Use C-z/C-x/C-c/C-v keys for undo/cut/copy/paste"
+	      :button (:toggle . cua-mode)))
 (define-key menu-bar-options-menu [case-fold-search]
   (menu-bar-make-toggle toggle-case-fold-search case-fold-search
 			"Case-Insensitive Search"
@@ -824,7 +836,8 @@
   (menu-bar-make-toggle toggle-transient-mark-mode transient-mark-mode
 			"Active Region Highlighting (Transient Mark mode)"
 			"Transient Mark mode %s"
-			"Make text in active region stand out in color"))
+			"Make text in active region stand out in color"
+			(: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)"