Function: mouse-position

mouse-position is a function defined in frame.c.

Signature

(mouse-position)

Documentation

Return a list (FRAME X . Y) giving the current mouse frame and position.

The position is given in canonical character cells, where (0, 0) is the upper-left corner of the frame, X is the horizontal offset, and Y is the vertical offset, measured in units of the frame's default character size. If Emacs is running on a mouseless terminal or hasn't been programmed to read the mouse position, it returns the selected frame for FRAME and nil for X and Y.

FRAME might be nil if track-mouse(var)/track-mouse(fun) is set to drag-source. This means there is no frame under the mouse. If mouse-position-function is non-nil, mouse-position calls it, passing the normal return value to that function as an argument, and returns whatever that function returns.

View in manual

Probably introduced at or before Emacs version 19.23.

Source Code

// Defined in /usr/src/emacs/src/frame.c
{
  return mouse_position (true);
}