Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Interactive compilation mode in emacs ? (what if compiler asks a question)

Tags:

emacs

I am looking for either a hack to regular compilation mode, or suggestion on how to create new mode. What i want to achieve, is to 'compile' my code - but the compilator sometimes asks certain questions on the terminal (yes/no, etc etc). Afaik, regular compilation mode can't direct my keyboard input and feed the subprocess with it. Is that possible ?

Thanks

like image 644
Kuba Tyszko Avatar asked Jul 10 '10 01:07

Kuba Tyszko


People also ask

How do I run a compiled program in Emacs?

To run make or another compilation command, type M-x compile . This reads a shell command line using the minibuffer, and then executes the command by running a shell as a subprocess (or inferior process) of Emacs.

Does Emacs have a compiler?

Emacs can run compilers for languages such as C and Fortran, feeding the compilation log into an Emacs buffer. It can also parse the error messages and show you where the errors occurred.

What is compilation mode?

Compilation mode turns each error message in the buffer into a hyperlink; you can move point to it and type RET, or click on it with the mouse (see Following References with the Mouse), to visit the locus of the error message in a separate window. The locus is the specific position in a file where that error occurred.


2 Answers

C-u M-x compile RET is all you need.

This is, in fact, documented: typing C-h f compile RET shows

Additionally, with universal prefix arg, compilation buffer will be in comint mode, i.e. interactive.
like image 127
offby1 Avatar answered Sep 26 '22 07:09

offby1


If you know all of the answers in advance, you might be able to get away with something as easy as:

(setq compile-command "(echo yes; echo no; echo yes) | (old compile command)")
like image 43
Sean Avatar answered Sep 22 '22 07:09

Sean