Emacs:设置每个缓冲区的编译命令 [英] Emacs: set compilation command per-buffer

查看:92
本文介绍了Emacs:设置每个缓冲区的编译命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以,假设我有一个文件file.c和一个文件anothr.c。我想为每个这些文件分别设置编译命令,例如: gcc -Wall -O3 -of file.c gcc - Wall -std = c99 -oa another.c 。如何为该缓冲区设置 gcc 命令,以便每次打开它时,它都知道如何编译它?有没有与 // - * - 指令或类似的东西?谢谢。

so, suppose I have a file file.c, and a file anothr.c. I would like to set the compilation command for each of those files separately, say: gcc -Wall -O3 -o f file.c, and gcc -Wall -std=c99 -o a another.c. How can I set the gcc command for that buffer so that every time I open it, it knows how to compile it? Is there something with the // -*- directive or something like that? Thanks.

推荐答案

是的,您可以使用该文件中的指令,并设置其他值。尝试一行或两行:

Yes, you can use the directive in the file, and also set other value. Try this in line one or two:

// -*- compile-command: "gcc -Wall -O3 -o f file.c" -*-

然后用 Cx重新加载文件v ,以便该设置生效。

and then re-load the file with C-x v so that the setting takes effect.

我有时设置像 c-indent-level:4; c-basic-offset:4; 在那里。

这篇关于Emacs:设置每个缓冲区的编译命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆