I've been wondering with frustration why my windows disappear right after i
move to them to start editing...
Then i read: jde-compile-finish-kill-buffer, and lo! it intentionally waits
2 seconds after a compile,
then sneaks in and destroys the window that contains the compiler output!
Two seconds is about the time it takes me to type C-xC-o, C-xC-b "buffer i
want to edit"
and magically i've been reduced from 2 windows to 1 window,
so now I have to C-x2 can again C-xC-b to get back to the buffer....

Yikes! Kill the compiler buffer, or bury the compile buffer;
but don't wait 2 seconds and then mess the window configuration!
[IMHO: changing my window configuration asynchronously goes way beyond the
principle of least astonishment.]
Ok, flame off;
Maybe you all use Emacs in the multi-frame pop-up mode and this is not a
problem?
If so, tell me how you make that work, just setting pop-up-frames makes more
and more frames...




Or maybe there is some confusion about deleting the window and killing the
buffer:
The function called "jde-compile-kill-buffer" un-conditionally deletes a
window,
 and only conditionally kills a buffer!
If the function was re-named "jde-compile-delete-window", then its function
and the [IMHO] severe consequences would be more clearly identified.

Can we at least move the (if  jde-compile-enable-kill-buffer ...) test
to include the (delete-winodws-on buf) or put *inside*
jde-compile-finish-kill-buffer?
so it controls not just the 'kill' of the buffer, but also the
delete-window-on aspect also?
[surely, there is little incentive to kill the compile buffer when compile
succeeds...?
 it is so small, what is the point of killing it?

Alright, i'm hacked it to work like this:

;;; redefine jde-compile-enable-kill-buffer to be the time to wait...
(defun jde-compile-finish-kill-buffer (buf msg)
  "Removes the jde-compile window after a few seconds if no errors."
  (save-excursion
    (set-buffer buf)
    (if (null (or (string-match ".*exited abnormally.*" msg)
                  (string-match ".*BUILD FAILED.*" (buffer-string))
    (not (numberp jde-compile-enable-kill-buffer))))
        ;;no errors, make the compilation window go away in a few seconds
        (lexical-let ((compile-buffer buf))
          (run-at-time (format "%d secs" jde-compile-enable-kill-buffer)
         nil 'jde-compile-kill-buffer
           compile-buffer)
          (message "No compilation errors"))
      ;;there were errors, so jump to the first error
      (if jde-compile-jump-to-first-error (next-error 1)))))

(defun jde-compile-kill-buffer (buf)
  (kill-buffer buf))

(defcustom jde-compile-enable-kill-buffer 1
  "* Number of seconds to wait before 'jde-compile-finish-kill-buffer
will kill the compilation output buffer, or nil to not kill the buffer."
  :group 'jde-compile-options
  :type 'integer)

Reply via email to