/[emacs]/emacs/lisp/emulation/cua-base.el
ViewVC logotype

Diff of /emacs/lisp/emulation/cua-base.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.11.2.1 by miles, Fri Apr 4 06:20:17 2003 UTC revision 1.11.2.2 by miles, Tue Oct 14 23:42:11 2003 UTC
# Line 1  Line 1 
1  ;;; cua-base.el --- emulate CUA key bindings  ;;; cua-base.el --- emulate CUA key bindings
2    
3  ;; Copyright (C) 1997-2002 Free Software Foundation, Inc.  ;; Copyright (C) 1997,98,99,200,01,02,03  Free Software Foundation, Inc.
4    
5  ;; Author: Kim F. Storm <storm@cua.dk>  ;; Author: Kim F. Storm <storm@cua.dk>
6  ;; Keywords: keyboard emulation convenience cua  ;; Keywords: keyboard emulation convenience cua
# Line 260  Line 260 
260    :link '(emacs-commentary-link :tag "Commentary" "cua-base.el")    :link '(emacs-commentary-link :tag "Commentary" "cua-base.el")
261    :link '(emacs-library-link :tag "Lisp File" "cua-base.el"))    :link '(emacs-library-link :tag "Lisp File" "cua-base.el"))
262    
 ;;;###autoload  
 (defcustom cua-mode nil  
   "Non-nil means that CUA emulation mode is enabled.  
 In CUA mode, shifted movement keys highlight and extend the region.  
 When a region is highlighted, the binding of the C-x and C-c keys are  
 temporarily changed to work as Motif, MAC or MS-Windows cut and paste.  
 Also, insertion commands first delete the region and then insert.  
 This mode enables Transient Mark mode and it provides a superset of the  
 PC Selection Mode and Delete Selection Modes.  
   
 Setting this variable directly does not take effect;  
 use either \\[customize] or the function `cua-mode'."  
   :set (lambda (symbol value)  
          (cua-mode (or value 0)))  
   :initialize 'custom-initialize-default  
   :set-after '(cua-enable-modeline-indications cua-use-hyper-key)  
   :require 'cua-base  
   :link '(emacs-commentary-link "cua-base.el")  
   :version "21.4"  
   :type 'boolean  
   :group 'cua)  
   
   
263  (defcustom cua-enable-cua-keys t  (defcustom cua-enable-cua-keys t
264    "*Enable using C-z, C-x, C-c, and C-v for undo, cut, copy, and paste.    "*Enable using C-z, C-x, C-c, and C-v for undo, cut, copy, and paste.
265  If the value is t, these mappings are always enabled.  If the value is  If the value is t, these mappings are always enabled.  If the value is
# Line 405  Can be toggled by [M-p] while the rectan Line 382  Can be toggled by [M-p] while the rectan
382    :group 'cua)    :group 'cua)
383    
384  (defface cua-global-mark-face '((((class color))  (defface cua-global-mark-face '((((class color))
385                                    (:foreground "black")                                   :foreground "black"
386                                    (:background "yellow"))                                   :background "yellow")
387                                   (t (:bold t)))                                  (t :bold t))
388    "*Font used by CUA for highlighting the global mark."    "*Font used by CUA for highlighting the global mark."
389    :group 'cua)    :group 'cua)
390    
# Line 1181  Extra commands should be added to `cua-m Line 1158  Extra commands should be added to `cua-m
1158  (defvar cua--saved-state nil)  (defvar cua--saved-state nil)
1159    
1160  ;;;###autoload  ;;;###autoload
1161  (defun cua-mode (&optional arg)  (define-minor-mode cua-mode
1162    "Toggle CUA key-binding mode.    "Toggle CUA key-binding mode.
1163  When enabled, using shifted movement keys will activate the region (and  When enabled, using shifted movement keys will activate the region (and
1164  highlight the region using `transient-mark-mode'), and typed text replaces  highlight the region using `transient-mark-mode'), and typed text replaces
1165  the active selection.  C-z, C-x, C-c, and C-v will undo, cut, copy, and  the active selection.  C-z, C-x, C-c, and C-v will undo, cut, copy, and
1166  paste (in addition to the normal emacs bindings)."  paste (in addition to the normal emacs bindings)."
1167    (interactive "P")    :global t
1168    (setq cua-mode    :set-after '(cua-enable-modeline-indications cua-use-hyper-key)
1169          (cond    :require 'cua-base
1170           ((null arg) (not cua-mode))    :link '(emacs-commentary-link "cua-base.el")
1171           ((symbolp arg) t)    :version "21.4"
          (t (> (prefix-numeric-value arg) 0))))  
   
1172    (setq mark-even-if-inactive t)    (setq mark-even-if-inactive t)
1173    (setq highlight-nonselected-windows nil)    (setq highlight-nonselected-windows nil)
1174    (make-variable-buffer-local 'cua--explicit-region-start)    (make-variable-buffer-local 'cua--explicit-region-start)
# Line 1229  paste (in addition to the normal emacs b Line 1204  paste (in addition to the normal emacs b
1204             (and (boundp 'delete-selection-mode) delete-selection-mode)             (and (boundp 'delete-selection-mode) delete-selection-mode)
1205             (and (boundp 'pc-selection-mode) pc-selection-mode)))             (and (boundp 'pc-selection-mode) pc-selection-mode)))
1206      (if (and (boundp 'delete-selection-mode) delete-selection-mode)      (if (and (boundp 'delete-selection-mode) delete-selection-mode)
1207          (delete-selection-mode))          (delete-selection-mode -1))
1208      (if (and (boundp 'pc-selection-mode) pc-selection-mode)      (if (and (boundp 'pc-selection-mode) pc-selection-mode)
1209          (pc-selection-mode))          (pc-selection-mode -1))
1210      (setq transient-mark-mode (and cua-mode      (setq transient-mark-mode (and cua-mode
1211                                     (if cua-highlight-region-shift-only                                     (if cua-highlight-region-shift-only
1212                                         (not cua--explicit-region-start)                                         (not cua--explicit-region-start)
1213                                       t)))                                       t))))
     (if (interactive-p)  
         (message "CUA mode enabled")))  
1214     (cua--saved-state     (cua--saved-state
1215      (setq transient-mark-mode (car cua--saved-state))      (setq transient-mark-mode (car cua--saved-state))
1216      (if (nth 1 cua--saved-state)      (if (nth 1 cua--saved-state)
# Line 1250  paste (in addition to the normal emacs b Line 1223  paste (in addition to the normal emacs b
1223                   (if (and (nth 1 cua--saved-state) (nth 2 cua--saved-state)) " and" "")                   (if (and (nth 1 cua--saved-state) (nth 2 cua--saved-state)) " and" "")
1224                   (if (nth 2 cua--saved-state) " PC-Selection" "")                   (if (nth 2 cua--saved-state) " PC-Selection" "")
1225                   (if (or (nth 1 cua--saved-state) (nth 2 cua--saved-state)) " enabled" "")))                   (if (or (nth 1 cua--saved-state) (nth 2 cua--saved-state)) " enabled" "")))
1226      (setq cua--saved-state nil))      (setq cua--saved-state nil))))
   
    (t  
     (if (interactive-p)  
         (message "CUA mode disabled")))))  
1227    
1228  (defun cua-debug ()  (defun cua-debug ()
1229    "Toggle cua debugging."    "Toggle cua debugging."
# Line 1279  paste (in addition to the normal emacs b Line 1248  paste (in addition to the normal emacs b
1248    
1249  (provide 'cua)  (provide 'cua)
1250    
1251    ;;; arch-tag: 21fb6289-ba25-4fee-bfdc-f9fb351acf05
1252  ;;; cua-base.el ends here  ;;; cua-base.el ends here

Legend:
Removed from v.1.11.2.1  
changed lines
  Added in v.1.11.2.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26