aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/ChangeLog7
-rw-r--r--lisp/mouse.el36
2 files changed, 29 insertions, 14 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index bc1bcac7191..dfe19e994ce 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,12 @@
12010-08-15 Chong Yidong <cyd@stupidchicken.com> 12010-08-15 Chong Yidong <cyd@stupidchicken.com>
2 2
3 * mouse.el (mouse--drag-set-mark-and-point): New function.
4 (mouse-drag-track): Use LOCATION arg to push-mark. Use
5 mouse--drag-set-mark-and-point to take click-count into
6 consideration when updating point and mark (Bug#6840).
7
82010-08-15 Chong Yidong <cyd@stupidchicken.com>
9
3 * progmodes/compile.el (compilation-error-regexp-alist-alist): 10 * progmodes/compile.el (compilation-error-regexp-alist-alist):
4 Give the Ruby rule a lower priority than Gnu (Bug#6778). 11 Give the Ruby rule a lower priority than Gnu (Bug#6778).
5 12
diff --git a/lisp/mouse.el b/lisp/mouse.el
index 89a136434d9..f404de98ce3 100644
--- a/lisp/mouse.el
+++ b/lisp/mouse.el
@@ -954,8 +954,7 @@ DO-MOUSE-DRAG-REGION-POST-PROCESS should only be used by
954 '(only) 954 '(only)
955 (cons 'only transient-mark-mode))) 955 (cons 'only transient-mark-mode)))
956 (let ((range (mouse-start-end start-point start-point click-count))) 956 (let ((range (mouse-start-end start-point start-point click-count)))
957 (goto-char (nth 0 range)) 957 (push-mark (nth 0 range) t t)
958 (push-mark nil t t)
959 (goto-char (nth 1 range))) 958 (goto-char (nth 1 range)))
960 959
961 ;; Track the mouse until we get a non-movement event. 960 ;; Track the mouse until we get a non-movement event.
@@ -974,14 +973,8 @@ DO-MOUSE-DRAG-REGION-POST-PROCESS should only be used by
974 end-point (posn-point end)) 973 end-point (posn-point end))
975 (if (and (eq (posn-window end) start-window) 974 (if (and (eq (posn-window end) start-window)
976 (integer-or-marker-p end-point)) 975 (integer-or-marker-p end-point))
977 ;; If moving in the original window, move point by going 976 (mouse--drag-set-mark-and-point start-point
978 ;; to start first, so that if end is in intangible text, 977 end-point click-count)
979 ;; point jumps away from start. Don't do it if
980 ;; start=end, or a single click would select a region if
981 ;; it's on intangible text.
982 (unless (= start-point end-point)
983 (goto-char start-point)
984 (goto-char end-point))
985 (let ((mouse-row (cdr (cdr (mouse-position))))) 978 (let ((mouse-row (cdr (cdr (mouse-position)))))
986 (cond 979 (cond
987 ((null mouse-row)) 980 ((null mouse-row))
@@ -999,8 +992,9 @@ DO-MOUSE-DRAG-REGION-POST-PROCESS should only be used by
999 (eq (posn-window end) start-window) 992 (eq (posn-window end) start-window)
1000 (integer-or-marker-p end-point) 993 (integer-or-marker-p end-point)
1001 (/= start-point end-point)) 994 (/= start-point end-point))
1002 (goto-char start-point) 995 (mouse--drag-set-mark-and-point start-point
1003 (goto-char end-point)) 996 end-point click-count))
997
1004 ;; Find its binding. 998 ;; Find its binding.
1005 (let* ((fun (key-binding (vector (car event)))) 999 (let* ((fun (key-binding (vector (car event))))
1006 (do-multi-click (and (> (event-click-count event) 0) 1000 (do-multi-click (and (> (event-click-count event) 0)
@@ -1051,6 +1045,21 @@ DO-MOUSE-DRAG-REGION-POST-PROCESS should only be used by
1051 (put 'mouse-2 'event-kind 'mouse-click))) 1045 (put 'mouse-2 'event-kind 'mouse-click)))
1052 (push event unread-command-events))))))) 1046 (push event unread-command-events)))))))
1053 1047
1048(defun mouse--drag-set-mark-and-point (start click click-count)
1049 (let* ((range (mouse-start-end start click click-count))
1050 (beg (nth 0 range))
1051 (end (nth 1 range)))
1052 (cond ((eq (mark) beg)
1053 (goto-char end))
1054 ((eq (mark) end)
1055 (goto-char beg))
1056 ((< click (mark))
1057 (set-mark end)
1058 (goto-char beg))
1059 (t
1060 (set-mark beg)
1061 (goto-char end)))))
1062
1054(defun mouse--remap-link-click-p (start-event end-event) 1063(defun mouse--remap-link-click-p (start-event end-event)
1055 (or (and (eq mouse-1-click-follows-link 'double) 1064 (or (and (eq mouse-1-click-follows-link 'double)
1056 (= (event-click-count start-event) 2)) 1065 (= (event-click-count start-event) 2))
@@ -1166,8 +1175,7 @@ If MODE is 2 then do the same for lines."
1166 ((= mode 2) 1175 ((= mode 2)
1167 (list (save-excursion 1176 (list (save-excursion
1168 (goto-char start) 1177 (goto-char start)
1169 (beginning-of-line 1) 1178 (line-beginning-position 1))
1170 (point))
1171 (save-excursion 1179 (save-excursion
1172 (goto-char end) 1180 (goto-char end)
1173 (forward-line 1) 1181 (forward-line 1)