Go to the first, previous, next, last section, table of contents.


Finding Errors

When you have compiled something with the Meta-x compile command it is possible to step through each of the errors that it produces. To do this use the command,

Ctrl-x `
Displays the next error in the *compilation* buffer. The file that is in is loaded (if necessary) and the line with the error is found.

If you edit a file which has errors in it, then try to find the next error (which is in the same file) everything will still work. The positions of errors are updated as the buffers are modified.

The only exception to this is when you invoke the next-error function while the *compilation* buffer is still being written to. If more errors are produced in a file which has been modified since the compilation started it is likely that the positions will get out of sync.

By default, the next-error function understands the type of error output that gcc produces. This is of the form,

file:line-number:description

It is possible to use other formats though, the variables which control this are,

Variable: compile-error-regexp
Regular expression to match a line containing an error. For gcc this is `^(.*):([0-9]+):(.+)'.

Variable: compile-file-expand
Expansion template to produce the name of the file with the error, using compile-error-regexp and the line containing the error. By default this is `\1'.

Variable: compile-line-expand
Similar to compile-file-expand except that it expands to a string defining the number of the line with the error. By default, `\2'.

Variable: compile-error-expand
Similar to compile-file-expand, but produces the description of the error. By default, `\3'.


Go to the first, previous, next, last section, table of contents.