summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChong Yidong <cyd@gnu.org>2012-06-13 23:28:10 +0800
committerChong Yidong <cyd@gnu.org>2012-06-13 23:28:10 +0800
commit8cca97031d60136b3bdebef0d978ee3fe40eddec (patch)
tree3e8649dcdaf125634112230b9e69f9fc1c6bab3d
parentccf1dc189c647a4a70db6b4733693a508616389e (diff)
downloademacs-8cca97031d60136b3bdebef0d978ee3fe40eddec.tar.gz
emacs-8cca97031d60136b3bdebef0d978ee3fe40eddec.tar.bz2
emacs-8cca97031d60136b3bdebef0d978ee3fe40eddec.zip
Do not set mark on single mouse-1 clicks.
* mouse.el (mouse-drag-track): Do not set the mark if the user releases the mouse without selecting anything. Fixes: debbugs:11588
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/mouse.el15
2 files changed, 14 insertions, 6 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index a016032e285..845c666bc8b 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
+2012-06-13 Chong Yidong <cyd@gnu.org>
+
+ * mouse.el (mouse-drag-track): Do not set the mark if the user
+ releases the mouse without selecting anything (Bug#11588).
+
2012-06-13 Stefan Monnier <monnier@iro.umontreal.ca>
* textmodes/tex-mode.el (latex-indent): Recognize tex-verbatim at EOB
diff --git a/lisp/mouse.el b/lisp/mouse.el
index f40a0199525..fb2e67408bd 100644
--- a/lisp/mouse.el
+++ b/lisp/mouse.el
@@ -805,7 +805,7 @@ DO-MOUSE-DRAG-REGION-POST-PROCESS should only be used by
;; when setting point near the right fringe (but see below).
(auto-hscroll-mode-saved auto-hscroll-mode)
(auto-hscroll-mode nil)
- event end end-point)
+ moved-off-start event end end-point)
(setq mouse-selection-click-count click-count)
;; In case the down click is in the middle of some intangible text,
@@ -840,6 +840,9 @@ DO-MOUSE-DRAG-REGION-POST-PROCESS should only be used by
(redisplay))
(setq end (event-end event)
end-point (posn-point end))
+ ;; Note whether the mouse has left the starting position.
+ (unless (eq end-point start-point)
+ (setq moved-off-start t))
(if (and (eq (posn-window end) start-window)
(integer-or-marker-p end-point))
(mouse--drag-set-mark-and-point start-point
@@ -880,11 +883,11 @@ DO-MOUSE-DRAG-REGION-POST-PROCESS should only be used by
(let (deactivate-mark)
(copy-region-as-kill (mark) (point)))))
- ;; If point hasn't moved, run the binding of the
- ;; terminating up-event.
- (if do-multi-click
- (goto-char start-point)
- (deactivate-mark))
+ ;; Otherwise, run binding of terminating up-event.
+ (cond
+ (do-multi-click (goto-char start-point))
+ (moved-off-start (deactivate-mark))
+ (t (pop-mark)))
(when (and (functionp fun)
(= start-hscroll (window-hscroll start-window))
;; Don't run the up-event handler if the window