[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: compiling in C mode and the compilation buffer
From: |
Shug Boabie |
Subject: |
Re: compiling in C mode and the compilation buffer |
Date: |
Wed, 28 Jul 2004 01:24:03 +0000 (UTC) |
Benjamin Rutt wrote:
> Shug Boabie writes:
> > i was wondering; is there a way to have the compilation buffer close
> > automatically if there are no warnings or errors?
> >
> > also, is there a way to run the compile command, without having to agree
> > that `make -k` is the correct command each time? that extra 'enter' is just
> > annoying.
>
> I would use the following for all of this:
>
> (require 'compile)
> (setq compilation-read-command nil)
> (defun my-compilation-finish-function-standard (buf str)
> ;; avoid doing this for buffers created from M-x grep
> (when (string-match "*compilation.*" (buffer-name buf))
> (if (string-match "exited abnormally" str)
> ;;there were errors
> (progn
> (message "compilation errors, press C-x ` to visit"))
> ;;no errors, make the compilation window go away
> (run-at-time 0.5 nil 'delete-windows-on buf)
> (message "NO COMPILATION ERRORS!"))))
> (add-to-list 'compilation-finish-functions
> 'my-compilation-finish-function-standard)
excellent, however i would still like the window to remain open upon detection
of warnings as well [in order to force me to write ISO C99 code :-)]. i use the
compile command exclusively for C code, so a grep for "warning:" should be
sufficient. however, my attempts to customise your function have failed. any
further hints?
Re: compiling in C mode and the compilation buffer, Kevin Rodgers, 2004/07/26