unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Matthew Calhoun <calhounm@mac.com>
Subject: Re: Open compilation window only on errors?
Date: Mon, 13 Oct 2003 01:05:55 -0700	[thread overview]
Message-ID: <11EB670C-FD54-11D7-8605-0003930EBF00@mac.com> (raw)
In-Reply-To: <uvfrcylll.fsf@undis.closed>

Thanks to the superb guidance of Jens, Francois, and Kevin, I have a 
compilation-finish-function that works quite well. It looks like this:

(defun handle-compilation-window (buffer msg)
   "Gets rid of compilation window on successful compilation, otherwise 
goes to first error."
   (if (and (equal (substring msg 0 8) "finished")
		   (get-buffer-window buffer)) ; Compilation window is still open
	  (progn (delete-window (get-buffer-window buffer))
			 (message "Compilation was clean."))
	(next-error)))
(setq compilation-finish-function 'handle-compilation-window)

It even works correctly with my unit test failures, which was a 
pleasant surprise. But it's not perfect yet. When compilation results 
in warnings but no errors, my function is closing the compilation 
window because it receives a "finished" message, but I would rather 
keep the window open and go to the first warning, just like I would if 
there were errors. I know I could tell the compiler to treat warnings 
as errors, but that's not always feasible. Should I add a regexp to 
compilation-error-regexp-alist to fix this, or is there a better way?

Thanks,
Matt

  reply	other threads:[~2003-10-13  8:05 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.813.1064689050.21628.help-gnu-emacs@gnu.org>
2003-09-29  9:45 ` Open compilation window only on errors? Jens Schmidt
2003-10-13  8:05   ` Matthew Calhoun [this message]
2003-09-29 14:45 ` François Fleuret
2003-09-29 22:10 ` Kevin Rodgers
     [not found] <mailman.1571.1066032399.21628.help-gnu-emacs@gnu.org>
2003-10-13 17:24 ` Kevin Rodgers
2003-09-27 18:57 Matthew Calhoun

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=11EB670C-FD54-11D7-8605-0003930EBF00@mac.com \
    --to=calhounm@mac.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).