(vc-update-change-log): Use add-log-full-name and
[bpt/emacs.git] / lisp / delsel.el
index 2294df5..13a1cb5 100644 (file)
@@ -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,8 @@ 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 'clipboard-yank 'delete-selection 'yank)
 (put 'insert-register 'delete-selection t)
 
 (put 'delete-backward-char 'delete-selection 'supersede)
@@ -84,7 +94,7 @@ When OFF, typed text is just inserted at point."
   (setq delete-selection-mode
        (if (null arg) (not delete-selection-mode)
          (> (prefix-numeric-value arg) 0)))
-  (set-buffer-modified-p (buffer-modified-p))) ;No-op, but updates mode line.
+  (force-mode-line-update))
 
 ;; This is very useful for cancelling a selection in the minibuffer without 
 ;; aborting the minibuffer.