Mercurial > emacs
comparison lisp/mouse.el @ 4554:cf541ed1fed8
(mouse-set-point): Use event-end, not event-start.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Wed, 11 Aug 1993 06:17:43 +0000 |
parents | c2afed091afb |
children | 477fbf60722b |
comparison
equal
deleted
inserted
replaced
4553:ceb140c16ad2 | 4554:cf541ed1fed8 |
---|---|
89 (if (< last-col first-col) | 89 (if (< last-col first-col) |
90 (error "window too narrow to split") | 90 (error "window too narrow to split") |
91 (split-window-horizontally | 91 (split-window-horizontally |
92 (min (max new-width first-col) last-col)))))) | 92 (min (max new-width first-col) last-col)))))) |
93 | 93 |
94 (defun mouse-set-point (click) | 94 (defun mouse-set-point (event) |
95 "Move point to the position clicked on with the mouse. | 95 "Move point to the position clicked on with the mouse. |
96 This must be bound to a mouse click." | 96 This should be bound to a mouse click event type." |
97 (interactive "e") | 97 (interactive "e") |
98 (let ((posn (event-start click))) | 98 ;; Use event-end in case called from mouse-drag-region. |
99 ;; If EVENT is a click, event-end and event-start give same value. | |
100 (let ((posn (event-end event))) | |
99 (and (window-minibuffer-p (posn-window posn)) | 101 (and (window-minibuffer-p (posn-window posn)) |
100 (not (minibuffer-window-active-p (posn-window posn))) | 102 (not (minibuffer-window-active-p (posn-window posn))) |
101 (error "Minibuffer window is not active")) | 103 (error "Minibuffer window is not active")) |
102 (select-window (posn-window posn)) | 104 (select-window (posn-window posn)) |
103 (if (numberp (posn-point posn)) | 105 (if (numberp (posn-point posn)) |
104 (goto-char (posn-point posn))))) | 106 (goto-char (posn-point posn))))) |
105 | 107 |
106 (defun mouse-set-region (click) | 108 (defun mouse-set-region (click) |
107 "Set the region to the text that the mouse is dragged over. | 109 "Set the region to the text that the mouse is dragged over. |
108 This must be bound to a mouse drag event." | 110 This should be bound to a mouse drag event." |
109 (interactive "e") | 111 (interactive "e") |
110 (let ((posn (event-start click)) | 112 (let ((posn (event-start click)) |
111 (end (event-end click))) | 113 (end (event-end click))) |
112 (select-window (posn-window posn)) | 114 (select-window (posn-window posn)) |
113 (if (numberp (posn-point posn)) | 115 (if (numberp (posn-point posn)) |