aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorJuri Linkov2007-07-15 19:55:32 +0000
committerJuri Linkov2007-07-15 19:55:32 +0000
commit195d88f474f26dee7db29e240a5546262c97ff43 (patch)
tree5cf5916bf2fd45c951270be239081c248b9cc249 /lisp
parent60f164bdb72ae49a260cb035892f679cfb351051 (diff)
downloademacs-195d88f474f26dee7db29e240a5546262c97ff43.tar.gz
emacs-195d88f474f26dee7db29e240a5546262c97ff43.zip
(delete-selection-pre-hook): 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.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/delsel.el16
1 files changed, 10 insertions, 6 deletions
diff --git a/lisp/delsel.el b/lisp/delsel.el
index 7028bad9ad4..09b30d3e874 100644
--- a/lisp/delsel.el
+++ b/lisp/delsel.el
@@ -87,12 +87,16 @@ any selection."
87 (cond ((eq type 'kill) 87 (cond ((eq type 'kill)
88 (delete-active-region t)) 88 (delete-active-region t))
89 ((eq type 'yank) 89 ((eq type 'yank)
90 ;; Before a yank command, 90 ;; Before a yank command, make sure we don't yank the
91 ;; make sure we don't yank the same region 91 ;; head of the kill-ring that really comes from the
92 ;; that we are going to delete. 92 ;; currently active region we are going to delete
93 ;; That would make yank a no-op. 93 ;; (when last-command is one that uses copy-region-as-kill
94 (when (string= (buffer-substring-no-properties (point) (mark)) 94 ;; or kill-new). That would make yank a no-op.
95 (car kill-ring)) 95 (when (and (string= (buffer-substring-no-properties (point) (mark))
96 (car kill-ring))
97 (memq last-command
98 '(mouse-set-region mouse-drag-region
99 mouse-save-then-kill mouse-secondary-save-then-kill)))
96 (current-kill 1)) 100 (current-kill 1))
97 (delete-active-region)) 101 (delete-active-region))
98 ((eq type 'supersede) 102 ((eq type 'supersede)