Commit 0aeeaa26 authored by Juri Linkov's avatar Juri Linkov
Browse files

(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.
parent 195d88f4
2007-07-15 Juri Linkov <juri@jurta.org>
* delsel.el (delete-selection-pre-hook):
* emulation/cua-base.el (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.
2007-07-15 Michael Albinus <albinus@localhost> 2007-07-15 Michael Albinus <albinus@localhost>
* recentf.el (recentf-keep-default-predicate): New defun. * recentf.el (recentf-keep-default-predicate): New defun.
......
...@@ -898,9 +898,6 @@ If global mark is active, copy from register or one character." ...@@ -898,9 +898,6 @@ If global mark is active, copy from register or one character."
(t (t
;; Must save register here, since delete may override reg 0. ;; Must save register here, since delete may override reg 0.
(if mark-active (if mark-active
;; 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 cua--rectangle (if cua--rectangle
(progn (progn
(goto-char (min (mark) (point))) (goto-char (min (mark) (point)))
...@@ -908,8 +905,16 @@ If global mark is active, copy from register or one character." ...@@ -908,8 +905,16 @@ If global mark is active, copy from register or one character."
(setq paste-lines (cua--delete-rectangle)) (setq paste-lines (cua--delete-rectangle))
(if (= paste-lines 1) (if (= paste-lines 1)
(setq paste-lines nil))) ;; paste all (setq paste-lines nil))) ;; paste all
(if (string= (filter-buffer-substring (point) (mark)) ;; Before a yank command, make sure we don't yank the
(car kill-ring)) ;; 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.
(if (and (string= (filter-buffer-substring (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)) (current-kill 1))
(cua-delete-region))) (cua-delete-region)))
(cond (cond
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment