[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fwd: Re: next-error insists on split windows]

From: Kevin Rodgers
Subject: [Fwd: Re: next-error insists on split windows]
Date: Fri, 28 Apr 2006 09:45:05 -0600
User-agent: Thunderbird (Windows/20060308)

Bill Wohler confirms my attached analysis and workaround:
> That seems to be doing what I hoped. Nice job. Thanks! That'll work
> nicely until the underlying code gets an option for configuring this
> behavior.
> To OP would probably appreciate a copy of this.

Kevin Rodgers
--- Begin Message --- Subject: Re: next-error insists on split windows Date: Thu, 27 Apr 2006 11:08:12 -0600 User-agent: Thunderbird (Windows/20060308)
Bill Wohler wrote:
Kevin Rodgers <address@hidden> writes:

So M-x compile and M-x grep ought to display the *compilation* and
*grep* buffers, but next-error and previous-error shouldn't.  Does
advising them to preserve the window configuration do what you want:

(defadvice next-error (around save-window-excursion activate)
  "Preserve the current window configuration."

It's a bit too strong since if the buffer with the next error isn't
current visible, you won't see it.

OK, I've dug a little deeper and I think I understand how this works.
The compilation buffer is displayed by compilation-goto-locus, but only
when next-error and friends were called from some other buffer or the
compilation buffer isn't already visible.

I don't think messing with display-buffer is a good idea, but after the
buffer is displayed compilation-set-window-height is called (unless it
was already visible, which doesn't concern us).  So perhaps advising
compilation-set-window to undisplay the buffer when it was called in
that context will work:

(defadvice compilation-set-window-height (after delete-window activate)
  "Undisplay WINDOW if `compilation-goto-locus' made it visible."
  (when (and (boundp 'from-compilation-buffer)
             (boundp 'pre-existing)
             (or (not from-compilation-buffer)
                 (not pre-existing)))
    (delete-window (ad-get-arg 0))))


--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]