Emacs: set compilation command per-buffer

前端 未结 2 1987
遥遥无期
遥遥无期 2020-12-10 20:24

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

2条回答
  •  [愿得一人]
    2020-12-10 20:57

    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" -*-
    

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

    I sometimes set things like c-indent-level: 4; c-basic-offset: 4; in there too.

提交回复
热议问题