comparison lisp/emulation/cua-base.el @ 81895:d59242324437

(cua-paste): 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.
author Juri Linkov <juri@jurta.org>
date Sun, 15 Jul 2007 19:55:57 +0000
parents 0d644f70ff05
children b98604865ea0 fd5b4a865d1d a1be62cbd32a
comparison
equal deleted inserted replaced
81894:fb5c5d1a8fe2 81895:d59242324437
896 (buffer-read-only 896 (buffer-read-only
897 (message "Cannot paste into a read-only buffer")) 897 (message "Cannot paste into a read-only buffer"))
898 (t 898 (t
899 ;; Must save register here, since delete may override reg 0. 899 ;; Must save register here, since delete may override reg 0.
900 (if mark-active 900 (if mark-active
901 ;; Before a yank command, make sure we don't yank
902 ;; the same region that we are going to delete.
903 ;; That would make yank a no-op.
904 (if cua--rectangle 901 (if cua--rectangle
905 (progn 902 (progn
906 (goto-char (min (mark) (point))) 903 (goto-char (min (mark) (point)))
907 (setq paste-column (cua--rectangle-left)) 904 (setq paste-column (cua--rectangle-left))
908 (setq paste-lines (cua--delete-rectangle)) 905 (setq paste-lines (cua--delete-rectangle))
909 (if (= paste-lines 1) 906 (if (= paste-lines 1)
910 (setq paste-lines nil))) ;; paste all 907 (setq paste-lines nil))) ;; paste all
911 (if (string= (filter-buffer-substring (point) (mark)) 908 ;; Before a yank command, make sure we don't yank the
912 (car kill-ring)) 909 ;; head of the kill-ring that really comes from the
910 ;; currently active region we are going to delete
911 ;; (when last-command is one that uses copy-region-as-kill
912 ;; or kill-new). That would make yank a no-op.
913 (if (and (string= (filter-buffer-substring (point) (mark))
914 (car kill-ring))
915 (memq last-command
916 '(mouse-set-region mouse-drag-region
917 mouse-save-then-kill mouse-secondary-save-then-kill)))
913 (current-kill 1)) 918 (current-kill 1))
914 (cua-delete-region))) 919 (cua-delete-region)))
915 (cond 920 (cond
916 (regtxt 921 (regtxt
917 (cond 922 (cond