X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/fc36357836a4151a1d1b46b2ad466d417f29980d..9899d01a0ccec166e04caa60657a44e614be50cd:/lisp/emulation/cua-base.el diff --git a/lisp/emulation/cua-base.el b/lisp/emulation/cua-base.el index d90d01c787..337be13e2e 100644 --- a/lisp/emulation/cua-base.el +++ b/lisp/emulation/cua-base.el @@ -1,7 +1,7 @@ ;;; cua-base.el --- emulate CUA key bindings ;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, -;; 2005, 2006 Free Software Foundation, Inc. +;; 2005, 2006, 2007 Free Software Foundation, Inc. ;; Author: Kim F. Storm ;; Keywords: keyboard emulation convenience cua @@ -10,7 +10,7 @@ ;; 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 2, or (at your option) +;; the Free Software Foundation; either version 3, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, @@ -399,6 +399,9 @@ and after the region marked by the rectangle to search." (other :tag "Enabled" t)) :group 'cua) +(defvar cua-global-keymap) ; forward +(defvar cua--region-keymap) ; forward + (defcustom cua-rectangle-mark-key [(control return)] "Global key used to toggle the cua rectangle mark." :set #'(lambda (symbol value) @@ -895,9 +898,6 @@ If global mark is active, copy from register or one character." (t ;; Must save register here, since delete may override reg 0. (if mark-active - ;; Before a yank command, make sure we don't yank - ;; the same region that we are going to delete. - ;; That would make yank a no-op. (if cua--rectangle (progn (goto-char (min (mark) (point))) @@ -905,8 +905,16 @@ If global mark is active, copy from register or one character." (setq paste-lines (cua--delete-rectangle)) (if (= paste-lines 1) (setq paste-lines nil))) ;; paste all - (if (string= (filter-buffer-substring (point) (mark)) - (car kill-ring)) + ;; Before a yank command, make sure we don't yank the + ;; head of the kill-ring that really comes from the + ;; currently active region we are going to delete + ;; (when last-command is one that uses copy-region-as-kill + ;; or kill-new). That would make yank a no-op. + (if (and (string= (filter-buffer-substring (point) (mark)) + (car kill-ring)) + (memq last-command + '(mouse-set-region mouse-drag-region + mouse-save-then-kill mouse-secondary-save-then-kill))) (current-kill 1)) (cua-delete-region))) (cond @@ -927,6 +935,8 @@ If global mark is active, copy from register or one character." (if arg (goto-char pt)))) ((eq this-original-command 'clipboard-yank) (clipboard-yank)) + ((eq this-original-command 'x-clipboard-yank) + (x-clipboard-yank)) (t (yank arg))))))) @@ -1226,9 +1236,9 @@ If ARG is the atom `-', scroll upward by nearly full screen." (memq 'shift (event-modifiers (aref (this-single-command-keys) 0))) ;; See if raw escape sequence maps to a shifted event, e.g. S-up or C-S-home. - (and (boundp 'function-key-map) - function-key-map - (let ((ev (lookup-key function-key-map + (and (boundp 'local-function-key-map) + local-function-key-map + (let ((ev (lookup-key local-function-key-map (this-single-command-raw-keys)))) (and (vector ev) (symbolp (setq ev (aref ev 0))) @@ -1403,6 +1413,7 @@ If ARG is the atom `-', scroll upward by nearly full screen." ;; replace region with rectangle or element on kill ring (define-key cua-global-keymap [remap yank] 'cua-paste) (define-key cua-global-keymap [remap clipboard-yank] 'cua-paste) + (define-key cua-global-keymap [remap x-clipboard-yank] 'cua-paste) ;; replace current yank with previous kill ring element (define-key cua-global-keymap [remap yank-pop] 'cua-paste-pop) ;; set mark