diff options
| author | Richard M. Stallman | 1992-10-17 07:07:39 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1992-10-17 07:07:39 +0000 |
| commit | 652ccd357df24265d492d15990efdac79840993e (patch) | |
| tree | c9a150349934b892998341cbe29e1e1fb2734be5 | |
| parent | cb7b0c050fc958055fadc1763b630d9a684f95c7 (diff) | |
| download | emacs-652ccd357df24265d492d15990efdac79840993e.tar.gz emacs-652ccd357df24265d492d15990efdac79840993e.zip | |
(mouse-set-region): New command. Bind drag-mouse-1 to it.
| -rw-r--r-- | lisp/mouse.el | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/lisp/mouse.el b/lisp/mouse.el index 0cc2aacc673..71c4cf8328c 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el | |||
| @@ -114,6 +114,20 @@ This must be bound to a mouse click." | |||
| 114 | (if (numberp (posn-point posn)) | 114 | (if (numberp (posn-point posn)) |
| 115 | (goto-char (posn-point posn))))) | 115 | (goto-char (posn-point posn))))) |
| 116 | 116 | ||
| 117 | (defun mouse-set-region (click) | ||
| 118 | "Set the region to the text that the mouse is dragged over. | ||
| 119 | This must be bound to a mouse click." | ||
| 120 | (interactive "e") | ||
| 121 | (let ((posn (event-start click)) | ||
| 122 | (end (event-end click))) | ||
| 123 | (select-window (posn-window posn)) | ||
| 124 | (if (numberp (posn-point posn)) | ||
| 125 | (goto-char (posn-point posn))) | ||
| 126 | (sit-for 1) | ||
| 127 | (push-mark) | ||
| 128 | (if (numberp (posn-point end)) | ||
| 129 | (goto-char (posn-point end))))) | ||
| 130 | |||
| 117 | (defun mouse-set-mark (click) | 131 | (defun mouse-set-mark (click) |
| 118 | "Set mark at the position clicked on with the mouse. | 132 | "Set mark at the position clicked on with the mouse. |
| 119 | Display cursor at that position for a second. | 133 | Display cursor at that position for a second. |
| @@ -582,7 +596,7 @@ This does not delete the region; it acts like \\[kill-ring-save]." | |||
| 582 | ;; are properly implemented. | 596 | ;; are properly implemented. |
| 583 | (global-set-key [mouse-1] 'mouse-set-point) | 597 | (global-set-key [mouse-1] 'mouse-set-point) |
| 584 | 598 | ||
| 585 | (global-set-key [drag-mouse-1] 'mouse-set-mark) | 599 | (global-set-key [drag-mouse-1] 'mouse-set-region) |
| 586 | (global-set-key [mouse-2] 'mouse-yank-at-click) | 600 | (global-set-key [mouse-2] 'mouse-yank-at-click) |
| 587 | (global-set-key [mouse-3] 'mouse-save-then-kill) | 601 | (global-set-key [mouse-3] 'mouse-save-then-kill) |
| 588 | 602 | ||