diff options
author | Richard M. Stallman <rms@gnu.org> | 1995-08-06 07:18:06 +0000 |
---|---|---|
committer | Richard M. Stallman <rms@gnu.org> | 1995-08-06 07:18:06 +0000 |
commit | 6b2144114876ba8eab1e3cff397f4250917c51b3 (patch) | |
tree | 42615b31cfdad3e56d2d94717480ca3d2e83e71e /lisp/delsel.el | |
parent | 81e98f1a6dbf2e0115ed1cf396188840fd5a0101 (diff) | |
download | emacs-6b2144114876ba8eab1e3cff397f4250917c51b3.tar.gz |
(delete-selection-pre-hook): New type value `yank'.
(yank): Use `yank' as delete-selection property.
Diffstat (limited to 'lisp/delsel.el')
-rw-r--r-- | lisp/delsel.el | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lisp/delsel.el b/lisp/delsel.el index 4d52ab2f7ba..4b61f8130d0 100644 --- a/lisp/delsel.el +++ b/lisp/delsel.el @@ -51,6 +51,15 @@ insertion commands first delete the region and then insert.") (get this-command 'delete-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. + (if (string= (buffer-substring (point) (mark)) + (car kill-ring)) + (current-kill 1)) + (delete-active-region nil)) ((eq type 'supersede) (if (delete-active-region nil) (setq this-command '(lambda () (interactive))))) @@ -62,7 +71,7 @@ insertion commands first delete the region and then insert.") (put 'self-insert-command 'delete-selection t) (put 'self-insert-iso 'delete-selection t) -(put 'yank 'delete-selection t) +(put 'yank 'delete-selection 'yank) (put 'insert-register 'delete-selection t) (put 'delete-backward-char 'delete-selection 'supersede) |