Mercurial > emacs
changeset 12790:afe7f3c735a3
(delete-selection-pre-hook): New type value `yank'.
(yank): Use `yank' as delete-selection property.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sun, 06 Aug 1995 07:18:06 +0000 |
parents | 6ee52fbbee75 |
children | 61bbb487bf2c |
files | lisp/delsel.el |
diffstat | 1 files changed, 10 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/delsel.el Sun Aug 06 06:27:10 1995 +0000 +++ b/lisp/delsel.el Sun Aug 06 07:18:06 1995 +0000 @@ -51,6 +51,15 @@ (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 @@ (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)