Emacs: how to compile (run make) without pressing enter for the compile command query?
Asked Answered
N

3

15

with (x)emacs, how could I run the 'compile' command without separately pressing enter to accept the default command? (I can bind the 'compile' to a key but I'd like the whole thing to happen without separate pressing of enter)

Of course, similar behaviour with some else command would also be ok.

Nannette answered 14/1, 2009 at 15:11 Comment(0)
C
30

I used to (setq compilation-read-command nil) in my .emacs and invoke compile with a prefix argument when I actually wanted to change the command line: C-u M-x compile

Since then, I found about the recompile command that's even closer to what I want. Most importantly, it does not prompt for the command line. This one is the command I actually bound to a function key.

The usual workflow then goes: M-x compile the first time per project, and F9 at each iteration of the edit-compile-test process.

Crown answered 14/1, 2009 at 15:44 Comment(1)
This has the advantage of allowing you to change the command occasionally, and then stick with the change.Machado
N
9

Hmm,

after still a little bit more googling, I found the answer from the EmacsWiki : Compile command (under No prompt for command):

(setq compilation-read-command nil)

hope it helps somebody else later. No more pressing enter for the same default command.

Nannette answered 14/1, 2009 at 15:19 Comment(0)
D
8

most obvious method is to call M-x recompile

Dhole answered 7/2, 2009 at 14:13 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.