changeset 15880:2fe76a330b1e

(mouse-drag-region): Don't call mouse-set-region-1 if mark is gone or no longer active or if we changed buffers.
author Richard M. Stallman <rms@gnu.org>
date Sat, 17 Aug 1996 16:56:19 +0000
parents 79dba775070d
children f207637cf4b4
files lisp/mouse.el
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/mouse.el	Sat Aug 17 11:53:54 1996 +0000
+++ b/lisp/mouse.el	Sat Aug 17 16:56:19 1996 +0000
@@ -594,8 +594,15 @@
 		    (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))))