i think delete-window instead of other-window and delete-other-windows is
better, also, i think you can get the compilatio buffer by referring to the
outbuf variable instead of hard-coding "*compilation*".
also, instead of using compilation-finish-function, you can defadvice
'compile' and use save-window-excursion to restore the windows & sizes
something like
(defadvice compile (around compile-saving-windows-setup first act)
(save-window-excursion
ad-do-it
)
)
then if you don't want to rely on the name of the compilation buffer being
"*compilation*", you can create your own buffer naming function, customize
compilation-buffer-name-function to point to it and then you can be sure of
the name.
i didn't test any of these. if you want tell me and i will.
ittay
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Sunday, June 18, 2000 7:45 PM
To: Paul Kinnucan
Cc: J. de Kleine; [EMAIL PROTECTED]
Subject: Re: customization: create compilation buffer only on errors
(fwd)
In message <[EMAIL PROTECTED]>, Paul
Kinnucan w
rites:
: At 04:23 PM 6/16/00 -0700, you wrote:
: >
: >I would really like to customize JDE in the following way:
: >At present, the jde-compile command creates a compilation buffer and
fills
: >it with the output of the compile command. I would instead like
: >jde-compile to create a compilation buffer only if error/warning messages
: >are returned by the compiler. If no errors/warnings are produced the
: >only visible result should be a message printed in the minibuffer saying
: >something like "Compilation succesful", or "Compiling... done".
: >
: >I have been through the FAQ and user guide trying to find a way to do
: >this, to no avail. I'd implement it myself, but unfortunately I am not
: >yet a lisp programmer.
: >
: >Is there a way to do this that I am missing?
: >
:
: No. It would require a fair amount of research and coding to implement.
: Perhaps someone else may be interested in undertaking to create such an
: option. If so, I'd be happy to incorporate it into the JDE.
Here's a half-baked attempt - suggestions from better lisp programmers
welcome:
Compilation mode has a customizable variable "compilation-finish-function."
Install the following defun and set compilation-finish-function to it.
Note: if you use multiple emacs windows, this will almost certainly *not*
do what you want it to do. Caveat programmer!
Tested only on linux + xemacs, and not very extensively at that.
(defun half-baked-compilation-finish-function
(buffer mesg)
"When compilation terminates with successfully, switch back to the
other buffer, kill the compilation buffer, and delete all other windows.
You will *not* like this if you're using multiple windows, so don't
bother trying it if that's how you work."
(if (string= mesg "finished\n")
(progn
(other-window 1)
(delete-other-windows)
(kill-buffer "*compilation*")
(message "Compilation finished OK")
)
(message "Compilation errors")))
Eric