# HG changeset patch # User Richard M. Stallman # Date 719305659 0 # Node ID 4005f73e57126bdffa894dae19bf5a5dad099a28 # Parent 029bee59c09233856b6814d12ff58a977855f759 (mouse-set-region): New command. Bind drag-mouse-1 to it. diff -r 029bee59c092 -r 4005f73e5712 lisp/mouse.el --- 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)