4

I read the documentation about compilation-mode but I didn't find any technique to hightlight source code where a compilation error occurs.

For example change the background color of the source code that produces the compilation error (like the red underline in Eclipse or Netbeans). And also a way to read the error message somewhere.

Maxime
  • 2,048
  • 1
  • 27
  • 38

2 Answers2

5

Normally, compilation mode will highlight the error message in the compiler output and you can use that to jump to the code. If you want your code syntax checked/highlighted you might want to look at flymake, which is supposed to be able to do exactly that.

Timo Geusch
  • 24,095
  • 5
  • 52
  • 70
  • 2
    [Flycheck](http://flycheck.readthedocs.org/en/latest/) is a newer plugin that does flymake better. – Thelema May 26 '14 at 19:59
3

Option next-error-highlight controls highlighting of compilation and grep hits in the source buffers. The possibilities for this are these:

  • highlight for a given time or until the next command
  • highlight until the next command or until next hit visit
  • do not highlight
  • show location in fringe -- which indication moves with the locus

If you use library simple+.el, then you have another possibility: highlight until the locus moves. This highlights, like the first two possibilities above, but the highlighting does not go away -- it just moves, like the last possibility above (fringe).

That sounds like what you want. (It is what I use.) For grep, for instance, the matching text is highlighted in the source file at the location you visit. It stays highlighted until you visit a different hit.

The same holds for the similar option next-error-highlight-no-select.

In addition, for grep and compilation to respect the new value provided by simple+.el, you will also need libraries grep+.el and compile+.el, respectively.

Drew
  • 29,895
  • 7
  • 74
  • 104