X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/51fb064bc72968e739e8dea580e58796c1a87f4c..f83483ff69287a38536a0e3b9d10d3f9d729aed2:/lisp/emulation/cua-base.el?ds=sidebyside diff --git a/lisp/emulation/cua-base.el b/lisp/emulation/cua-base.el index 992d0afd91..d8b36adf73 100644 --- a/lisp/emulation/cua-base.el +++ b/lisp/emulation/cua-base.el @@ -1,17 +1,17 @@ ;;; 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 ;; 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 @@ -19,9 +19,7 @@ ;; 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 . ;;; Commentary: @@ -65,7 +63,7 @@ ;; - 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 @@ -909,7 +907,7 @@ If global mark is active, copy from register or one character." (cua--insert-at-global-mark (filter-buffer-substring (point) (+ (point) count))) (forward-char count)))) (buffer-read-only - (message "Cannot paste into a read-only buffer")) + (error "Cannot paste into a read-only buffer")) (t ;; Must save register here, since delete may override reg 0. (if mark-active @@ -1042,7 +1040,9 @@ of text." (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 "")) @@ -1153,6 +1153,7 @@ If ARG is the atom `-', scroll downward by nearly full screen." (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. @@ -1173,6 +1174,7 @@ If ARG is the atom `-', scroll upward by nearly full screen." (beginning-of-buffer (goto-char (point-min))))))) (put 'cua-scroll-down 'CUA 'move) +(put 'cua-scroll-down 'isearch-scroll t) ;;; Cursor indications @@ -1196,8 +1198,8 @@ If ARG is the atom `-', scroll upward by nearly full screen." (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 @@ -1440,6 +1442,8 @@ If ARG is the atom `-', scroll upward by nearly full screen." ;; 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) @@ -1495,15 +1499,22 @@ If ARG is the atom `-', scroll upward by nearly full screen." 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 @@ -1579,12 +1590,14 @@ shifted movement key, set `cua-highlight-region-shift-only'." (list transient-mark-mode (and (boundp 'delete-selection-mode) delete-selection-mode) - (and (boundp 'pc-selection-mode) pc-selection-mode))) + (and (boundp 'pc-selection-mode) pc-selection-mode) + shift-select-mode)) (if (and (boundp 'delete-selection-mode) delete-selection-mode) (delete-selection-mode -1)) (if (and (boundp 'pc-selection-mode) pc-selection-mode) (pc-selection-mode -1)) (cua--deactivate) + (setq shift-select-mode nil) (setq transient-mark-mode (and cua-mode (if cua-highlight-region-shift-only (not cua--explicit-region-start) @@ -1595,7 +1608,8 @@ shifted movement key, set `cua-highlight-region-shift-only'." (delete-selection-mode 1)) (if (nth 2 cua--saved-state) (pc-selection-mode 1)) - (if (interactive-p) + (setq shift-select-mode (nth 3 cua--saved-state)) + (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" "") @@ -1620,5 +1634,5 @@ shifted movement key, set `cua-highlight-region-shift-only'." (provide 'cua-base) -;;; arch-tag: 21fb6289-ba25-4fee-bfdc-f9fb351acf05 +;; arch-tag: 21fb6289-ba25-4fee-bfdc-f9fb351acf05 ;;; cua-base.el ends here