Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to know the line number corresponding to a buffer position?

Tags:

emacs

buffer

When Emacs reports error it always show code with a buffer position, with which it is quite unconvenient to find out where the exact words locate.

It there any way to know the exact line number of the buffer position?

like image 292
ZelluX Avatar asked Jun 02 '09 12:06

ZelluX


1 Answers

  • C-x = Bound to what-cursor-position; shows the current position.

  • C-x l Bound to count-lines-page; shows how many lines are before and after point on page, and total number of lines on page (where "page" spans lines between two page-break symbols ^L).

  • M-x Bound to what-line; shows line number of current line (and narrowed line number of point, if applicable).

But I think what you want is

M-x goto-char RET <pos>

which lets you go to position <pos> in the current buffer.

like image 157
Peter Miehle Avatar answered Nov 04 '22 11:11

Peter Miehle