tags:

views:

124

answers:

2

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?

+9  A: 
C-x =    (current position)
C-x l    (line on and lines in page, that is between next page-break symbol ^L)
M-x what-line      (shows current line)

but i think, what you want is

M-x goto-char pos

(goto position pos in buffer)

Peter Miehle
+1 Excellent answer. I just edited to clarify the distinction between the command and the explanation of it; hope that's OK.
Carl Meyer
A: 

It seems you need Goto line: M-g g

The exact line number of the buffer position is shown in the status line of your Emacs buffer.

volodyako
Don't know why this is rated '-1', it is correct. One should find the current line number in the mode-line, it the number after the `L` and before the major mode name. 'M-g g' is available only since emacs 22.1.
danielpoe
I'm not downvoting since it's correct, but it fails to answer the question that was asked.
Carl Meyer
My apologies, I was confused by "buffer position". This emacs phraseology is a bit elusive.To my answer, I would also add the following emacs bindings:M-g n next-errorM-g p previous-errorOne could browse through errors without telling line numbers.
volodyako