diff options
| author | Chong Yidong | 2010-07-11 18:14:53 -0400 |
|---|---|---|
| committer | Chong Yidong | 2010-07-11 18:14:53 -0400 |
| commit | f479ef6e6f5c77ba0f1f6b60c1146f324d604e92 (patch) | |
| tree | f7d4d3b94f6b7326b47345443f7ecd3e23208835 | |
| parent | c8fc18ee03b411cf5e242af9e95fd34f90b15b0f (diff) | |
| download | emacs-f479ef6e6f5c77ba0f1f6b60c1146f324d604e92.tar.gz emacs-f479ef6e6f5c77ba0f1f6b60c1146f324d604e92.zip | |
* mouse.el (mouse-drag-track): Handle select-active-regions (Bug#6612).
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/mouse.el | 20 |
2 files changed, 21 insertions, 4 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index e01bebef0ed..e988b6bdef4 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2010-07-11 Chong Yidong <cyd@stupidchicken.com> | ||
| 2 | |||
| 3 | * mouse.el (mouse-drag-track): Handle select-active-regions | ||
| 4 | (Bug#6612). | ||
| 5 | |||
| 1 | 2010-07-11 Magnus Henoch <magnus.henoch@gmail.com> | 6 | 2010-07-11 Magnus Henoch <magnus.henoch@gmail.com> |
| 2 | 7 | ||
| 3 | * net/tramp-gvfs.el (tramp-gvfs-handle-copy-file): Do not pass | 8 | * net/tramp-gvfs.el (tramp-gvfs-handle-copy-file): Do not pass |
diff --git a/lisp/mouse.el b/lisp/mouse.el index 0b2d7fbf83b..30fd26b51fc 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el | |||
| @@ -956,9 +956,12 @@ DO-MOUSE-DRAG-REGION-POST-PROCESS should only be used by | |||
| 956 | (if (eq transient-mark-mode 'lambda) | 956 | (if (eq transient-mark-mode 'lambda) |
| 957 | '(only) | 957 | '(only) |
| 958 | (cons 'only transient-mark-mode))) | 958 | (cons 'only transient-mark-mode))) |
| 959 | (let ((range (mouse-start-end start-point start-point click-count))) | 959 | (let ((range (mouse-start-end start-point start-point click-count)) |
| 960 | ;; Prevent `push-mark' from clobbering the primary selection | ||
| 961 | ;; if the user clicks without dragging. | ||
| 962 | (select-active-regions nil)) | ||
| 960 | (goto-char (nth 0 range)) | 963 | (goto-char (nth 0 range)) |
| 961 | (push-mark nil nil t) | 964 | (push-mark nil t t) |
| 962 | (goto-char (nth 1 range))) | 965 | (goto-char (nth 1 range))) |
| 963 | 966 | ||
| 964 | ;; Track the mouse until we get a non-movement event. | 967 | ;; Track the mouse until we get a non-movement event. |
| @@ -1012,6 +1015,7 @@ DO-MOUSE-DRAG-REGION-POST-PROCESS should only be used by | |||
| 1012 | mouse-set-region)))))) | 1015 | mouse-set-region)))))) |
| 1013 | (if (and (/= (mark) (point)) | 1016 | (if (and (/= (mark) (point)) |
| 1014 | (not do-multi-click)) | 1017 | (not do-multi-click)) |
| 1018 | |||
| 1015 | ;; If point has moved, finish the drag. | 1019 | ;; If point has moved, finish the drag. |
| 1016 | (let* (last-command this-command) | 1020 | (let* (last-command this-command) |
| 1017 | ;; Copy the region so that `select-active-regions' can | 1021 | ;; Copy the region so that `select-active-regions' can |
| @@ -1019,12 +1023,20 @@ DO-MOUSE-DRAG-REGION-POST-PROCESS should only be used by | |||
| 1019 | (and mouse-drag-copy-region | 1023 | (and mouse-drag-copy-region |
| 1020 | do-mouse-drag-region-post-process | 1024 | do-mouse-drag-region-post-process |
| 1021 | (let (deactivate-mark) | 1025 | (let (deactivate-mark) |
| 1022 | (copy-region-as-kill (mark) (point))))) | 1026 | (copy-region-as-kill (mark) (point)))) |
| 1027 | ;; For `select-active-regions' non-nil, ensure that | ||
| 1028 | ;; further alterations of the region (e.g. via | ||
| 1029 | ;; shift-selection) continue to update PRIMARY. | ||
| 1030 | (and select-active-regions | ||
| 1031 | (display-selections-p) | ||
| 1032 | (x-set-selection 'PRIMARY (current-buffer)))) | ||
| 1033 | |||
| 1023 | ;; If point hasn't moved, run the binding of the | 1034 | ;; If point hasn't moved, run the binding of the |
| 1024 | ;; terminating up-event. | 1035 | ;; terminating up-event. |
| 1025 | (if do-multi-click | 1036 | (if do-multi-click |
| 1026 | (goto-char start-point) | 1037 | (goto-char start-point) |
| 1027 | (deactivate-mark)) | 1038 | (let (select-active-regions) |
| 1039 | (deactivate-mark))) | ||
| 1028 | (when (and (functionp fun) | 1040 | (when (and (functionp fun) |
| 1029 | (= start-hscroll (window-hscroll start-window)) | 1041 | (= start-hscroll (window-hscroll start-window)) |
| 1030 | ;; Don't run the up-event handler if the window | 1042 | ;; Don't run the up-event handler if the window |