line-number-at-pos

line-number-at-pos is a compiled Lisp function in `simple.el'.

(line-number-at-pos &optional POS)

Return (narrowed) buffer line number at position POS.
If POS is nil, use current buffer location.
Counting starts at (point-min), so the value refers
to the contents of the accessible portion of the buffer.