修复在 emacs 中执行源外自动工具构建时的源文件搜索路径
我有一个使用自动工具的项目。 autotools 的一个很好的功能是“源外”构建,而不是这样做:
cd foobar
./configure
make
我实际上为构建创建了一个文件夹,在其中进行配置:(
cd foobar/builds/linux
../../configure
make
好处是我的源文件夹没有被生成的 Makefiles 破坏,并且在交叉编译时有帮助)。
因此,当我在 emacs 中处理代码时,要运行编译,我将执行 Mxcompile
,将编译命令指定为 cd ~/foobar/builds/linux ;制作
。
在发生编译错误之前,这一切正常。编译缓冲区将列出具有丑陋路径的文件(例如 ../../../../src...
),它指向相对于构建文件夹的源文件。但是,似乎 emacs 在编译结束时不会保留在构建文件夹中,因此该链接没有指向任何内容。因此,我无法轻松浏览回错误。
我尝试使用compilation-search-path
,但没有运气。
有没有办法强制 emacs “停留”在编译文件夹中(以便编译缓冲区中的路径引用现有文件?)
谢谢
PH
I have a project that uses autotools. A nice feature of autotools is 'out-of-source' builds, wheras instead of doing :
cd foobar
./configure
make
I actually create a folder for builds, in which I do the configuration :
cd foobar/builds/linux
../../configure
make
(The nicety is that my source folder is not crippled with the generated Makefiles, and it helps when cross-compiling).
So when I am working on my code in emacs, to run the compilation I'll do M-x compile
specifying the compile command as cd ~/foobar/builds/linux ; make
.
This works fine until a compilation error occurs. The compilation buffer will list the files with ugly path (like ../../../../src...
), which points to a source file, relative to the build folder.However, it seems like emacs does not stay in the build folder at the end of the compile, so the link does not point to anything. Hence, I cannot easily browse back to the error.
I tried playing with compilation-search-path
, whithout luck.
Is there a way to force emacs to 'stay' in the compilation folder (so that the paths in the compilation buffer reference existing files ?)
Thanks
PH
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您改为使用 make -C ~/foobar/builds/linux ,emacs 应该能够跟踪
进入目录...
、离开目录... make 发出并使用它来保持对文件的正确引用的
消息。If you instead use
make -C ~/foobar/builds/linux
, emacs should be able to track theEntering directory ...
,Leaving directory ...
messages that make emits and use this to keep proper references to the files.使用 jamessan 的建议,我可以通过以下方式部分解决该问题:
不太确定两者是否都需要或者这是否是最好的做事方式......
无论如何谢谢!
Using jamessan advice, I could partially fix the issue by :
Not so sure if both are needed or if it is the best way to do things ...
Thanks anyway !