summaryrefslogtreecommitdiff
path: root/lisp/mouse.el
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1996-08-17 16:56:19 +0000
committerRichard M. Stallman <rms@gnu.org>1996-08-17 16:56:19 +0000
commit7f461c93b879270bda9e18287eb0e498b30533f7 (patch)
treef065beae479f6d3dca27793b73dc4a86e1891cec /lisp/mouse.el
parent260adf3fdd727b3ce65e81e790ad54d505363396 (diff)
downloademacs-7f461c93b879270bda9e18287eb0e498b30533f7.tar.gz
(mouse-drag-region): Don't call mouse-set-region-1
if mark is gone or no longer active or if we changed buffers.
Diffstat (limited to 'lisp/mouse.el')
-rw-r--r--lisp/mouse.el11
1 files changed, 9 insertions, 2 deletions
diff --git a/lisp/mouse.el b/lisp/mouse.el
index 7ffc98c7a9d..c10101bf64b 100644
--- a/lisp/mouse.el
+++ b/lisp/mouse.el
@@ -594,8 +594,15 @@ remains active. Otherwise, it remains until the next input event."
(push-mark region-commencement t t)
(goto-char region-termination)
(copy-region-as-kill (point) (mark t))
- (mouse-show-mark)
- (mouse-set-region-1))
+ (let ((buffer (current-buffer)))
+ (mouse-show-mark)
+ ;; mouse-show-mark can call read-event,
+ ;; and that means the Emacs server could switch buffers
+ ;; under us. If that happened,
+ ;; avoid trying to use the region.
+ (and (mark t) mark-active
+ (eq buffer (current-buffer))
+ (mouse-set-region-1))))
(goto-char (overlay-end mouse-drag-overlay))
(setq this-command 'mouse-set-point)
(delete-overlay mouse-drag-overlay))))