如何调整Emacs的编译错误从编译缓冲区获取的路径? [英] How to adjust the path that Emacs' compile-goto-error gets from the compilation buffer?
问题描述
我正在使用Emacs 23,并且存在以下问题:
I am using Emacs 23 and have the following problem:
我从Emacs内部运行项目的构建系统,例如Mx compile-> cd / foo / bar& & ./build
I run our project's build system from within Emacs like M-x compile -> cd /foo/bar && ./build
构建系统现在执行了一些魔术操作,将 cd放入构建过程的某个子目录中,然后gcc抛出错误:
The build system now does some magic, "cd"s into some subdirectory for the build process and then gcc throws an error:
../ src / somesource.cc:50错误:blablabla
../src/somesource.cc:50 error: blablabla
现在问题是Emacs找不到该路径,因为它假定编译过程始于/ foo / bar,而不是始于/ foo / bar / builddir。因此,开头的 ../不适用于Emacs,例如运行编译转到错误时。
Now the problem is that Emacs won't find that path, because it assumes the compile process started out in /foo/bar, and not in /foo/bar/builddir. So the leading "../" is not working for Emacs, e.g. when running compile-goto-error. Is there a way to tell Emacs to try skipping leading "../"?
推荐答案
最好的方法可能是更改Emacs尝试跳过开头的 ../吗?构建系统以在更改目录时发出消息。 Emacs寻找
The best solution might be to change the build system to emit messages when it changes directories. Emacs looks for
Entering directory `...'
...
Leaving directory `...'
(请参阅编译目录匹配器
变量。如果构建系统在更改目录时确实发出了消息,但它们不是Emacs所寻找的格式,则可以将新的正则表达式添加到 compilation-directory-matcher
。)
(See the compilation-directory-matcher
variable. If your build system does emit messages when it changes directories, but they're not in the format Emacs is looking for, you can add new regexps to compilation-directory-matcher
.)
另一种解决方案是更改 compilation-search-path
(这是目录)。
The other solution is to change compilation-search-path
(which is a list of directories).
这篇关于如何调整Emacs的编译错误从编译缓冲区获取的路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!