set-cursor-to-mouse - Move the cursor to the current mouse position
n set-cursor-to-mouse
set-cursor-to-mouse sets the current window and cursor position to the location of the mouse on it's last event (button press or release). This command may change the current window. If the line on which the mouse was located was the message line then the no action is taken, if the line was a window mode line the that window is made the current window but the cursor location within the window remains the same. This is usually used in user defined macros that control the functionality of the mouse.
An argument n determines if the command is permitted to change windows, when omitted a window change is permitted on set-cursor-to-mouse. When specified, the mouse is not permitted to change windows and returns an error condition in $mouse-pos(5) indicating that the mouse is not within the current window.
Invocation of this command sets the variable $mouse-pos(5) which determines where the mouse is within the window. Interrogation of the variable following the command may be used to determine if the mouse is located on one of the more specialized window or screen regions.
When writing macros to cut and paste using the mouse, care should be taken to ensure that the window at the button release is the same is at the button press. If this is not undertaken, undesired effects could result. The use of set-window(2) and goto-window(2) are most usefully used with this command to restore existing window context.
$mouse-pos(5), $mouse-x(5), $mouse-y(5), $window-mode-line(5), $window-scroll-bar(5), goto-window(2), set-scroll-with-mouse(2), set-window(2).
(c) Copyright JASSPA 1999
Last Modified: 1998/08/20
Generated On: 1999/12/01