;;; 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
;; This file is part of GNU Emacs.
-;; GNU Emacs is free software; you can redistribute it and/or modify
+;; GNU Emacs is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 3, or (at your option)
-;; any later version.
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
+;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;; - 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
""))
(end-of-buffer (goto-char (point-max)))))))
(put 'cua-scroll-up 'CUA 'move)
+(put 'cua-scroll-up 'isearch-scroll t)
(defun cua-scroll-down (&optional arg)
"Scroll text of current window downward ARG lines; or near full screen if no ARG.
(beginning-of-buffer (goto-char (point-min)))))))
(put 'cua-scroll-down 'CUA 'move)
+(put 'cua-scroll-down 'isearch-scroll t)
;;; Cursor indications
(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" "")