changeset 81895:d59242324437

(cua-paste): Before a yank command, check also whether last-command is one of mouse-save-then-kill, mouse-secondary-save-then-kill, mouse-set-region, mouse-drag-region.
author Juri Linkov <juri@jurta.org>
date Sun, 15 Jul 2007 19:55:57 +0000
parents fb5c5d1a8fe2
children 800fe7b4cac0
files lisp/emulation/cua-base.el
diffstat 1 files changed, 10 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/emulation/cua-base.el	Sun Jul 15 19:55:32 2007 +0000
+++ b/lisp/emulation/cua-base.el	Sun Jul 15 19:55:57 2007 +0000
@@ -898,9 +898,6 @@
      (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)))
@@ -908,8 +905,16 @@
 		(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