15

make -kEmacs在我运行时默认使用命令compile。但是,我几乎从不认为make在错误后继续是有用的,所以我总是删除-k标志。有没有办法改变我的默认值.emacs,让它只是make

4

2 回答 2

14
(setq compile-command "make") 

或类似的 .emacs 就足够了。

有关更多信息,请键入

C-h f compile

它描述了调用 Mx compile 时使用了哪些变量。

在那里,你应该看到它调用了 compile-command 和一个

C-h v compile-command

告诉你这默认为“make -k”。以上都是简化,但如果您需要进一步挖掘,所有信息都应该在这些命令中。

于 2011-01-05T20:15:57.420 回答
8

由于我需要针对不同模式使用不同的编译器,因此我使用了以下代码段(此处显示为 javascript):

(require 'compile)
(add-hook 'js-mode-hook
          (lambda ()
            (set (make-local-variable 'compile-command)
                 (format "jshint %s" (file-name-nondirectory buffer-file-name)))))

这将“jshint”作为我的编译命令运行。然后我也可以将钩子添加到其他语言,并根据我的需要进行自定义。

于 2014-11-28T10:55:00.303 回答