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

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

Re: code for closing compilation buffers


From: Xu Weijiang
Subject: Re: code for closing compilation buffers
Date: Mon, 16 Jul 2007 09:34:42 +0800
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (windows-nt)

Hadron <hadronquark@gmail.com> writes:

> I googled up some code and then modified it to use the more recent
> compilation-finish-functions hook.
>
> Could someone take a peek that I did the "if then else" part right.
>
> If errors then jump to first error, else close the window. It *works* I
> would just be grateful if someone could comment on whether its done
> right:
>
>
> (add-hook 'compilation-finish-functions
>       (lambda (buf str)
>         (if (string-match "exited abnormally" str) 
>           (next-error)
>           ;;no errors, make the compilation window go away in a few seconds
>           (run-at-time "2 sec" nil 'delete-windows-on (get-buffer-create 
> "*compilation*"))
>           (message "No Compilation Errors!")
>         )
>       ))
It works great, Thanks.

Best regards
Xu Weijiang
-- 
everything has its rules!


reply via email to

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