diff options
| -rw-r--r-- | lisp/bindings.el | 10 | ||||
| -rw-r--r-- | lisp/mouse.el | 7 |
2 files changed, 14 insertions, 3 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." | |||
| 1339 | ;; can use S-tab instead to access that binding. | 1339 | ;; can use S-tab instead to access that binding. |
| 1340 | (define-key function-key-map [S-tab] [backtab]) | 1340 | (define-key function-key-map [S-tab] [backtab]) |
| 1341 | 1341 | ||
| 1342 | (define-key global-map [mouse-movement] 'ignore) | 1342 | (defun ignore-preserving-kill-region (&rest _) |
| 1343 | "Like `ignore', but don't overwrite `last-event' if it's `kill-region'." | ||
| 1344 | (declare (completion ignore)) | ||
| 1345 | (interactive) | ||
| 1346 | (when (eq last-command 'kill-region) | ||
| 1347 | (setq this-command 'kill-region)) | ||
| 1348 | nil) | ||
| 1349 | |||
| 1350 | (define-key global-map [mouse-movement] #'ignore-preserving-kill-region) | ||
| 1343 | 1351 | ||
| 1344 | (define-key global-map "\C-t" 'transpose-chars) | 1352 | (define-key global-map "\C-t" 'transpose-chars) |
| 1345 | (define-key esc-map "t" 'transpose-words) | 1353 | (define-key esc-map "t" 'transpose-words) |
diff --git a/lisp/mouse.el b/lisp/mouse.el index 14cb20c234a..82c8a146932 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el | |||
| @@ -1439,7 +1439,8 @@ command alters the kill ring or not." | |||
| 1439 | ;; Don't set this-command to `kill-region', so a following | 1439 | ;; Don't set this-command to `kill-region', so a following |
| 1440 | ;; C-w won't double the text in the kill ring. Ignore | 1440 | ;; C-w won't double the text in the kill ring. Ignore |
| 1441 | ;; `last-command' so we don't append to a preceding kill. | 1441 | ;; `last-command' so we don't append to a preceding kill. |
| 1442 | (let (this-command last-command deactivate-mark) | 1442 | (let ((last-command last-command) |
| 1443 | this-command deactivate-mark) | ||
| 1443 | (copy-region-as-kill beg end))) | 1444 | (copy-region-as-kill beg end))) |
| 1444 | (if (numberp beg) (goto-char beg)) | 1445 | (if (numberp beg) (goto-char beg)) |
| 1445 | ;; On a text terminal, bounce the cursor. | 1446 | ;; On a text terminal, bounce the cursor. |
| @@ -1542,6 +1543,7 @@ is dragged over to." | |||
| 1542 | (mouse-drag-and-drop-region start-event) | 1543 | (mouse-drag-and-drop-region start-event) |
| 1543 | ;; Give temporary modes such as isearch a chance to turn off. | 1544 | ;; Give temporary modes such as isearch a chance to turn off. |
| 1544 | (run-hooks 'mouse-leave-buffer-hook) | 1545 | (run-hooks 'mouse-leave-buffer-hook) |
| 1546 | (ignore-preserving-kill-region) | ||
| 1545 | (mouse-drag-track start-event))) | 1547 | (mouse-drag-track start-event))) |
| 1546 | 1548 | ||
| 1547 | ;; Inhibit the region-confinement when undoing mouse-drag-region | 1549 | ;; Inhibit the region-confinement when undoing mouse-drag-region |
| @@ -1751,7 +1753,8 @@ The region will be defined with mark and point." | |||
| 1751 | nil start-point)) | 1753 | nil start-point)) |
| 1752 | ((>= mouse-row bottom) | 1754 | ((>= mouse-row bottom) |
| 1753 | (mouse-scroll-subr start-window (1+ (- mouse-row bottom)) | 1755 | (mouse-scroll-subr start-window (1+ (- mouse-row bottom)) |
| 1754 | nil start-point)))))))) | 1756 | nil start-point)))))) |
| 1757 | (ignore-preserving-kill-region))) | ||
| 1755 | map) | 1758 | map) |
| 1756 | t (lambda () | 1759 | t (lambda () |
| 1757 | (funcall cleanup) | 1760 | (funcall cleanup) |