Function: posn-at-point
posn-at-point is a function defined in keyboard.c.
Signature
(posn-at-point &optional POS WINDOW)
Documentation
Return position information for buffer position POS in WINDOW.
POS defaults to point in WINDOW; WINDOW defaults to the selected window.
Return nil if POS is not visible in WINDOW. Otherwise,
the return value is similar to that returned by event-start for
a mouse click at the upper left corner of the glyph corresponding
to POS:
(WINDOW AREA-OR-POS (X . Y) TIMESTAMP OBJECT POS (COL . ROW)
IMAGE (DX . DY) (WIDTH . HEIGHT))
The posn- functions access elements of such lists.
Probably introduced at or before Emacs version 22.1.
Source Code
// Defined in /usr/src/emacs/src/keyboard.c
{
Lisp_Object tem;
if (NILP (window))
window = selected_window;
tem = Fpos_visible_in_window_p (pos, window, Qt);
if (!NILP (tem))
{
Lisp_Object x = XCAR (tem);
Lisp_Object y = XCAR (XCDR (tem));
Lisp_Object aux_info = XCDR (XCDR (tem));
int y_coord = XFIXNUM (y);
/* Point invisible due to hscrolling? X can be -1 when a
newline in a R2L line overflows into the left fringe. */
if (XFIXNUM (x) < -1)
return Qnil;
if (!NILP (aux_info) && y_coord < 0)
{
int rtop = XFIXNUM (XCAR (aux_info));
y = make_fixnum (y_coord + rtop);
}
tem = Fposn_at_x_y (x, y, window, Qnil);
}
return tem;
}