]> git.eshelyaron.com Git - emacs.git/commitdiff
(mouse-drag-region): Don't call mouse-set-region-1
authorRichard M. Stallman <rms@gnu.org>
Sat, 17 Aug 1996 16:56:19 +0000 (16:56 +0000)
committerRichard M. Stallman <rms@gnu.org>
Sat, 17 Aug 1996 16:56:19 +0000 (16:56 +0000)
if mark is gone or no longer active or if we changed buffers.

lisp/mouse.el

index 7ffc98c7a9deaee105c2bb1563b1f471d249c5a2..c10101bf64b16e70559b8c30005f5bfde4ca1a1d 100644 (file)
@@ -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))))