diff options
author | Juri Linkov <juri@jurta.org> | 2007-07-15 19:55:32 +0000 |
---|---|---|
committer | Juri Linkov <juri@jurta.org> | 2007-07-15 19:55:32 +0000 |
commit | 195d88f474f26dee7db29e240a5546262c97ff43 (patch) | |
tree | 5cf5916bf2fd45c951270be239081c248b9cc249 /lisp | |
parent | 60f164bdb72ae49a260cb035892f679cfb351051 (diff) | |
download | emacs-195d88f474f26dee7db29e240a5546262c97ff43.tar.gz emacs-195d88f474f26dee7db29e240a5546262c97ff43.tar.bz2 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.el | 16 |
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." (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) |