How can I go to a certain line given its number?
================================================
Are you sure you indeed need to go to a line by its number? Perhaps
all you want is to display a line in your source file for which a
compiler printed an error message? If so, compiling from within Emacs
using the `M-x compile' and `M-x recompile' commands is a much more
effective way of doing that. Emacs automatically intercepts the compile
error messages, inserts them into a special buffer called
`*compilation*', and lets you visit the locus of each message in the
source. Type `C-x `' to step through the offending lines one by one.
Click `Mouse-2' or press <RET> on a message text in the `*compilation*'
buffer to go to the line whose number is mentioned in that message.
But if you indeed need to go to a certain text line, type `M-x
goto-line <RET>'. Emacs will prompt you for the number of the line and
go to that line.
You can do this faster by invoking `goto-line' with a numeric
argument that is the line's number. For example, `C-u 286 M-x
goto-line <RET>' will jump to line number 286 in the current buffer.
If you need to use this command frequently, you might consider
binding it to a key. The following snippet, if added to your `~/.emacs'
file, will bind the sequence `C-x g' to `goto-line':
(global-set-key "\C-xg" 'goto-line)