* code for closing compilation buffers
@ 2007-07-11 14:08 Hadron
2007-07-16 1:34 ` Xu Weijiang
2007-07-16 15:34 ` J. David Boyd
0 siblings, 2 replies; 3+ messages in thread
From: Hadron @ 2007-07-11 14:08 UTC (permalink / raw)
To: help-gnu-emacs
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!")
)
))
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: code for closing compilation buffers
2007-07-11 14:08 code for closing compilation buffers Hadron
@ 2007-07-16 1:34 ` Xu Weijiang
2007-07-16 15:34 ` J. David Boyd
1 sibling, 0 replies; 3+ messages in thread
From: Xu Weijiang @ 2007-07-16 1:34 UTC (permalink / raw)
To: help-gnu-emacs
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!
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: code for closing compilation buffers
2007-07-11 14:08 code for closing compilation buffers Hadron
2007-07-16 1:34 ` Xu Weijiang
@ 2007-07-16 15:34 ` J. David Boyd
1 sibling, 0 replies; 3+ messages in thread
From: J. David Boyd @ 2007-07-16 15:34 UTC (permalink / raw)
To: help-gnu-emacs
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!")
> )
> ))
I would say that, if it works, it _can't_ really be done wrong!
Dave
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-07-16 15:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-11 14:08 code for closing compilation buffers Hadron
2007-07-16 1:34 ` Xu Weijiang
2007-07-16 15:34 ` J. David Boyd
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).