goto-line
goto-line is an interactive compiled Lisp function in `simple.el
'.
It is bound to M-g g, M-g M-g, <menu-bar> <edit> <goto> <go-to-line>.
(goto-line LINE &optional BUFFER
)
This function is for interactive use only;
in Lisp code use `forward-line' instead.
Go to LINE, counting from line 1 at beginning of buffer.
If called interactively, a numeric prefix argument specifies
LINE; without a numeric prefix argument, read LINE from the
minibuffer.
If optional argument BUFFER is non-nil, switch to that buffer and
move to line LINE there. If called interactively with C-u
as argument, BUFFER is the most recently selected other buffer.
Prior to moving point, this function sets the mark (without
activating it), unless Transient Mark mode is enabled and the
mark is already active.
This function is usually the wrong thing to use in a Lisp program.
What you probably want instead is something like:
(goto-char (point-min))
(forward-line (1- N))
If at all possible, an even better solution is to use char counts
rather than line counts.