mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2025-02-02 20:16:25 +00:00
(delete-selection-pre-hook): 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.
This commit is contained in:
parent
60f164bdb7
commit
195d88f474
@ -87,12 +87,16 @@ any selection."
|
|||||||
(cond ((eq type 'kill)
|
(cond ((eq type 'kill)
|
||||||
(delete-active-region t))
|
(delete-active-region t))
|
||||||
((eq type 'yank)
|
((eq type 'yank)
|
||||||
;; Before a yank command,
|
;; Before a yank command, make sure we don't yank the
|
||||||
;; make sure we don't yank the same region
|
;; head of the kill-ring that really comes from the
|
||||||
;; that we are going to delete.
|
;; currently active region we are going to delete
|
||||||
;; That would make yank a no-op.
|
;; (when last-command is one that uses copy-region-as-kill
|
||||||
(when (string= (buffer-substring-no-properties (point) (mark))
|
;; or kill-new). That would make yank a no-op.
|
||||||
(car kill-ring))
|
(when (and (string= (buffer-substring-no-properties (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))
|
||||||
(delete-active-region))
|
(delete-active-region))
|
||||||
((eq type 'supersede)
|
((eq type 'supersede)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user