发生编译错误时如何在 Emacs 编译模式下突出显示源代码
我阅读了有关编译模式的文档,但没有找到任何技术来突出显示发生编译错误的源代码。
例如,更改产生编译错误的源代码的背景颜色(如 Eclipse 或 Netbeans 中的红色下划线)。还有一种在某处读取错误消息的方法。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
通常,编译模式会在编译器输出中突出显示错误消息,您可以使用它跳转到代码。如果您希望检查/突出显示代码语法,您可能需要查看 flymake,它应该能够做到这一点。
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.
选项
next-error-highlight
控制源缓冲区中编译和 grep 命中的突出显示。可能性如下:如果您使用库
simple+.el
,那么你还有另一种可能:突出显示直到轨迹移动。这会突出显示,就像上面的前两种可能性一样,但是突出显示不会消失 - 它只是移动,就像上面的最后一种可能性(边缘)一样。这听起来像你想要的。 (这就是我使用的。)例如,对于
grep
,匹配的文本会在您访问的位置的源文件中突出显示。它会一直突出显示,直到您访问其他热门内容。对于类似的选项
next-error-highlight-no-select
也是如此。此外,对于
grep
和编译来说,要尊重simple+.el
,您还需要库grep+.el
和分别为
compile+.el
。Option
next-error-highlight
controls highlighting of compilation and grep hits in the source buffers. The possibilities for this are these: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 bysimple+.el
, you will also need librariesgrep+.el
andcompile+.el
, respectively.