changeset 1420:4005f73e5712

(mouse-set-region): New command. Bind drag-mouse-1 to it.
author Richard M. Stallman <rms@gnu.org>
date Sat, 17 Oct 1992 07:07:39 +0000
parents 029bee59c092
children a8378792a31d
files lisp/mouse.el
diffstat 1 files changed, 15 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/mouse.el	Fri Oct 16 08:26:44 1992 +0000
+++ b/lisp/mouse.el	Sat Oct 17 07:07:39 1992 +0000
@@ -114,6 +114,20 @@
     (if (numberp (posn-point posn))
 	(goto-char (posn-point posn)))))
 
+(defun mouse-set-region (click)
+  "Set the region to the text that the mouse is dragged over.
+This must be bound to a mouse click."
+  (interactive "e")
+  (let ((posn (event-start click))
+	(end (event-end click)))
+    (select-window (posn-window posn))
+    (if (numberp (posn-point posn))
+	(goto-char (posn-point posn)))
+    (sit-for 1)
+    (push-mark)
+    (if (numberp (posn-point end))
+	(goto-char (posn-point end)))))
+
 (defun mouse-set-mark (click)
   "Set mark at the position clicked on with the mouse.
 Display cursor at that position for a second.
@@ -582,7 +596,7 @@
 ;; are properly implemented.
 (global-set-key   [mouse-1]	'mouse-set-point)
 
-(global-set-key   [drag-mouse-1]	'mouse-set-mark)
+(global-set-key   [drag-mouse-1]	'mouse-set-region)
 (global-set-key   [mouse-2]	'mouse-yank-at-click)
 (global-set-key   [mouse-3]	'mouse-save-then-kill)