all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* 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

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.