help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Very simple IDE for programming newbie


From: despen
Subject: Re: Very simple IDE for programming newbie
Date: Sun, 03 Jan 2010 16:49:56 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)

Sean McAfee <mcafee@sean-mcafees-macbook-pro.local> writes:

> Peter Dyballa <Peter_Dyballa@Web.DE> writes:
>
>> Am 03.01.2010 um 17:10 schrieb Sean McAfee:
>>> I know; my question was how to a) know when the asynchronous
>>> compilation process has finished, and b) tell whether there were any
>>> errors, so that if there were none, I can immediately launch the
>>> newly-compiled program in a terminal emulator.
>>
>>
>> The *compilation* buffer's mode-line expresses such things.
>
> Actually, by "I" above I meant the special compilation function I'm
> planning to write.  Something like:
>
> (defun my-compile ()
>   (interactive)
>   (compile (format "gcc %s" (file-name-nondirectory (buffer-file-name))))
>   (when-compilation-is-complete
>    (lambda ()
>      (when (not (there-were-errors))
>        (kill-buffer "*term*")
>        (term "./a.out")))))
>
> What I'm not quite clear on at the moment is how to write the
> when-compilation-is-complete and there-were-errors functions.
>
> Actually, for there-were-errors I could obviously parse the content of
> the *compilation* buffer, but I was hoping the same information might
> be available more directly.

You know a compilation is good by it's return code.
If you set compilation command to "make", this would check the
return code and run the test:

make && ./myprog

But smarter is to create a Makefile and make running of the test
dependent on the compile.

You don't need to parse for errors, all that's already built in.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]