summaryrefslogtreecommitdiff
path: root/lisp/delsel.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/delsel.el')
-rw-r--r--lisp/delsel.el16
1 files changed, 10 insertions, 6 deletions
diff --git a/lisp/delsel.el b/lisp/delsel.el
index e33dac6c2f..8d6e6ea97d 100644
--- a/lisp/delsel.el
+++ b/lisp/delsel.el
@@ -87,12 +87,16 @@ any selection."
(cond ((eq type 'kill)
(delete-active-region t))
((eq type 'yank)
- ;; 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.
- (when (string= (buffer-substring-no-properties (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.
+ (when (and (string= (buffer-substring-no-properties (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))
(delete-active-region))
((eq type 'supersede)