Compile And Run in emacs

Timon Gehr timon.gehr at gmx.ch
Fri Nov 30 15:36:28 PST 2012


On 12/01/2012 12:13 AM, 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.
>
> 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?

It is emacs. Every key binding is a possible alternative.
I use

(global-set-key (kbd "\C-c c") 'compile)
(global-set-key (kbd "\C-c n") 'next-error)

Usually I just run non-interactive programs from within compile,

M-x compile
dmd -run program args <<< "program input"

or
M-x compile
make && ./program args <<< "program input"

or just
M-x compile
./program args <<< "program input"

or even
M-x gdb
r <<< "program input"

otherwise I have a separate console (are you using a sane window 
manager?) or use M-x ansi-term.


More information about the Digitalmars-d-learn mailing list