summaryrefslogtreecommitdiff
path: root/lisp/bindings.el
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2022-06-20 00:59:14 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2022-06-20 01:00:06 +0200
commite02ebe91379459efc9c5fc7bb9de38fcf0e59cd7 (patch)
tree676fbd4c4800fd449ac772104f3c6ebb488a5b7e /lisp/bindings.el
parent694d7984a347652bd0ff337056b9e616dc5aaee8 (diff)
downloademacs-e02ebe91379459efc9c5fc7bb9de38fcf0e59cd7.tar.gz
Allow appending to the kill ring with mouse selections
* lisp/bindings.el (ignore-preserving-kill-region): New function. (global-map): Use it. * lisp/mouse.el (mouse-set-region, mouse-drag-region) (mouse-drag-track): Allow appending to kill ring with mouse selections (bug#32747).
Diffstat (limited to 'lisp/bindings.el')
-rw-r--r--lisp/bindings.el10
1 files changed, 9 insertions, 1 deletions
diff --git a/lisp/bindings.el b/lisp/bindings.el
index ed1325e326c..c67a104b4c1 100644
--- a/lisp/bindings.el
+++ b/lisp/bindings.el
@@ -1339,7 +1339,15 @@ if `inhibit-field-text-motion' is non-nil."
;; can use S-tab instead to access that binding.
(define-key function-key-map [S-tab] [backtab])
-(define-key global-map [mouse-movement] 'ignore)
+(defun ignore-preserving-kill-region (&rest _)
+ "Like `ignore', but don't overwrite `last-event' if it's `kill-region'."
+ (declare (completion ignore))
+ (interactive)
+ (when (eq last-command 'kill-region)
+ (setq this-command 'kill-region))
+ nil)
+
+(define-key global-map [mouse-movement] #'ignore-preserving-kill-region)
(define-key global-map "\C-t" 'transpose-chars)
(define-key esc-map "t" 'transpose-words)