aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/mouse.el
diff options
context:
space:
mode:
authorRichard M. Stallman <[email protected]>1992-10-17 07:07:39 +0000
committerRichard M. Stallman <[email protected]>1992-10-17 07:07:39 +0000
commit652ccd357df24265d492d15990efdac79840993e (patch)
treec9a150349934b892998341cbe29e1e1fb2734be5 /lisp/mouse.el
parentcb7b0c050fc958055fadc1763b630d9a684f95c7 (diff)
(mouse-set-region): New command. Bind drag-mouse-1 to it.
Diffstat (limited to 'lisp/mouse.el')
-rw-r--r--lisp/mouse.el16
1 files changed, 15 insertions, 1 deletions
diff --git a/lisp/mouse.el b/lisp/mouse.el
index 0cc2aacc67..71c4cf8328 100644
--- a/lisp/mouse.el
+++ b/lisp/mouse.el
@@ -114,6 +114,20 @@ This must be bound to a mouse click."
(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 @@ This does not delete the region; it acts like \\[kill-ring-save]."
;; 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)