Compile And Run in emacs

Ali Çehreli acehreli at yahoo.com
Fri Nov 30 15:29:44 PST 2012


On 11/30/2012 03:13 PM, Aytug wrote:
 > So I have installed dmd, gdc, emacs and d-mode.el on my Debian
 > machine.
 >
 > I can compile the program fine with M-compile. The problem starts
 > after that.
 >
 > I cannot run the output file properly from within emacs. Either
 > there is a way and I cannot find it, or there really is no way.
 >
 > What I try instead:
 > 1. Write the sourcecode.
 > 2. M-compile.
 > 3. Launch a separate terminal, and run the executable from there.
 > Or,
 > 3. Launch a shell in emacs, and use that. Which sucks.

I have the following in my Makefile:

deneme: ${ALL_FILES}
	${DMD} ${SOURCES} ${LIBRARIES} -of$@ ${OPTIONS}
	./$@

The last line there executes the program that has just been built.

As an aside, if you do C-u,M-x,compile then you can interact with the 
program's standard input as well.

 > What am I doing wrong? Isn't there a "compile&run" option? And
 > one more thing, is there maybe a C-* alternative to M-compile
 > since it takes time to type that everytime?

You can set any key binding that you like in Emacs. I've never bothered 
to change it though: A quick M-x,M-p brings up the last compile command 
and I just hit Enter. (M-p is a key binding of mine that works better 
with the Dvorak keyboard, which means "up".)

Ali

-- 
D Programming Language Tutorial: http://ddili.org/ders/d.en/index.html



More information about the Digitalmars-d-learn mailing list