;;; cua-base.el --- emulate CUA key bindings
;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-;; 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+;; 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
;; Author: Kim F. Storm <storm@cua.dk>
;; Keywords: keyboard emulation convenience cua
;; - press the prefix key and the following key within 0.2 seconds, or
;; - use the SHIFT key with the prefix key, i.e. C-X or C-C
;;
-;; This behaviour can be customized via the
+;; This behavior can be customized via the
;; cua-prefix-override-inhibit-delay variable.
;; In addition to using the shifted movement keys, you can also use
(setq s (car u) e (cdr u)))))))
(cond ((and s e (<= s e) (= s (mark t)))
(setq cua--repeat-replace-text
- (filter-buffer-substring s e nil t)))
+ (filter-buffer-substring s e))
+ (set-text-properties 0 (length cua--repeat-replace-text)
+ nil cua--repeat-replace-text))
((and (null s) (eq u elt)) ;; nothing inserted
(setq cua--repeat-replace-text
""))
(set-cursor-color color))
(if (and type
(symbolp type)
- (not (eq type default-cursor-type)))
- (setq default-cursor-type type))))
+ (not (eq type (default-value 'cursor-type))))
+ (setq-default cursor-type type))))
;;; Pre-command hook
;; scrolling
(define-key cua-global-keymap [remap scroll-up] 'cua-scroll-up)
(define-key cua-global-keymap [remap scroll-down] 'cua-scroll-down)
+ (define-key cua-global-keymap [remap scroll-up-command] 'cua-scroll-up)
+ (define-key cua-global-keymap [remap scroll-down-command] 'cua-scroll-down)
(define-key cua--cua-keys-keymap [(control x) timeout] 'kill-region)
(define-key cua--cua-keys-keymap [(control c) timeout] 'copy-region-as-kill)
next-line previous-line
forward-word backward-word
end-of-line beginning-of-line
+ end-of-visual-line beginning-of-visual-line
move-end-of-line move-beginning-of-line
end-of-buffer beginning-of-buffer
scroll-up scroll-down
+ scroll-up-command scroll-down-command
up-list down-list backward-up-list
end-of-defun beginning-of-defun
forward-sexp backward-sexp
forward-list backward-list
forward-sentence backward-sentence
- forward-paragraph backward-paragraph))
+ forward-paragraph backward-paragraph
+ ;; CC mode motion commands
+ c-forward-conditional c-backward-conditional
+ c-down-conditional c-up-conditional
+ c-down-conditional-with-else c-up-conditional-with-else
+ c-beginning-of-statement c-end-of-statement))
(put cmd 'CUA 'move))
;; State prior to enabling cua-mode
(if (nth 2 cua--saved-state)
(pc-selection-mode 1))
(setq shift-select-mode (nth 3 cua--saved-state))
- (if (interactive-p)
+ (if (called-interactively-p 'interactive)
(message "CUA mode disabled.%s%s%s%s"
(if (nth 1 cua--saved-state) " Delete-Selection" "")
(if (and (nth 1 cua--saved-state) (nth 2 cua--saved-state)) " and" "")