diff options
Diffstat (limited to 'lisp/mouse.el')
| -rw-r--r-- | lisp/mouse.el | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/lisp/mouse.el b/lisp/mouse.el index faa10e842d3..7f9d080478a 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el | |||
| @@ -42,6 +42,12 @@ | |||
| 42 | "*If non-nil, mouse yank commands yank at point instead of at click." | 42 | "*If non-nil, mouse yank commands yank at point instead of at click." |
| 43 | :type 'boolean | 43 | :type 'boolean |
| 44 | :group 'mouse) | 44 | :group 'mouse) |
| 45 | |||
| 46 | (defcustom mouse-drag-copy-region t | ||
| 47 | "*If non-nil, mouse drag copies region to kill-ring." | ||
| 48 | :type 'boolean | ||
| 49 | :group 'mouse) | ||
| 50 | |||
| 45 | 51 | ||
| 46 | ;; Provide a mode-specific menu on a mouse button. | 52 | ;; Provide a mode-specific menu on a mouse button. |
| 47 | 53 | ||
| @@ -612,11 +618,14 @@ This should be bound to a mouse drag event." | |||
| 612 | ;; Don't set this-command to kill-region, so that a following | 618 | ;; Don't set this-command to kill-region, so that a following |
| 613 | ;; C-w will not double the text in the kill ring. | 619 | ;; C-w will not double the text in the kill ring. |
| 614 | ;; Ignore last-command so we don't append to a preceding kill. | 620 | ;; Ignore last-command so we don't append to a preceding kill. |
| 615 | (let (this-command last-command deactivate-mark) | 621 | (when mouse-drag-copy-region |
| 616 | (copy-region-as-kill (mark) (point))) | 622 | (let (this-command last-command deactivate-mark) |
| 623 | (copy-region-as-kill (mark) (point)))) | ||
| 617 | (mouse-set-region-1))) | 624 | (mouse-set-region-1))) |
| 618 | 625 | ||
| 619 | (defun mouse-set-region-1 () | 626 | (defun mouse-set-region-1 () |
| 627 | ;; Set transient-mark-mode for a little while. | ||
| 628 | (setq transient-mark-mode (or transient-mark-mode 'only)) | ||
| 620 | (setq mouse-last-region-beg (region-beginning)) | 629 | (setq mouse-last-region-beg (region-beginning)) |
| 621 | (setq mouse-last-region-end (region-end)) | 630 | (setq mouse-last-region-end (region-end)) |
| 622 | (setq mouse-last-region-tick (buffer-modified-tick))) | 631 | (setq mouse-last-region-tick (buffer-modified-tick))) |
| @@ -827,8 +836,9 @@ If the click is in the echo area, display the `*Messages*' buffer." | |||
| 827 | (push-mark region-commencement t t) | 836 | (push-mark region-commencement t t) |
| 828 | (goto-char region-termination) | 837 | (goto-char region-termination) |
| 829 | ;; Don't let copy-region-as-kill set deactivate-mark. | 838 | ;; Don't let copy-region-as-kill set deactivate-mark. |
| 830 | (let (deactivate-mark) | 839 | (when mouse-drag-copy-region |
| 831 | (copy-region-as-kill (point) (mark t))) | 840 | (let (deactivate-mark) |
| 841 | (copy-region-as-kill (point) (mark t)))) | ||
| 832 | (let ((buffer (current-buffer))) | 842 | (let ((buffer (current-buffer))) |
| 833 | (mouse-show-mark) | 843 | (mouse-show-mark) |
| 834 | ;; mouse-show-mark can call read-event, | 844 | ;; mouse-show-mark can call read-event, |