[Top][All Lists]

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

Re: xref window switching problems

From: Stephen Leake
Subject: Re: xref window switching problems
Date: Thu, 06 Aug 2015 04:36:23 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (windows-nt)

Ingo Lohmar <address@hidden> writes:

> Disclaimer: Recent discussion seems to have centered around the question
> if the newly opened file buffers should be cleaned up somehow.  I am not
> worried nor bothered by having all these buffers opened.  It's always
> been that way in Emacs, and it's never been a problem for me.
> I care more (but it's not all that important to me) about the buffers
> and points *shown* in windows.  


> In that respect, what if
> xref--marker-ring stored, together with the location where
> xref-push-marker-stack is called, the window where it is called.  Then
> xref-pop-marker-stack could look at the top of the stack and:
> - if window is same as current: same as now, ie, goto buffer and point
>   in same window
> - if window is different, still there and showing the buffer of the
>   stack location, switch to that window and go to location's point
> - if the window no longer exists, or shows a different buffer now, use
>   the current window to switch to the buffer and goto location's point

That's nice; I would like that.

> That would, I think, be quite close to going back "in time" to the
> window/buffer setup that the user had before, whenever that is possible.
> If that is deemed a reasonable goal, 

I don't think it is.

xref-pop-marker-stack should cause the previous marker location to be
displayed; that's _not_ the same as "also cause everything else that was
displayed at that point in time to be displayed".

Currently, it always does so in the current window; your proposal
extends that to consider the other currently visible windows.

> the last clause seems the only one where the behavior could differ.
> Maybe one could reuse another window showing the target buffer, 

Yes, I think that is best. No need to store the window; just look in the
other currently visible windows; if the location is visible (using
pos-visible-in-window-p ?), go there. It doesn't matter if it's the same
window that location was in at some earlier time; it's visible now.

You could almost implement this with `display-buffer-use-some-frame',
(that I just added), with a frame-predicate that checks
pos-visible-in-window-p, but that's not precise enough. We'd have to
extend that with a window-predicate. Which I need to do for another use
case. Hmm, it might be better to add window-predicate to

> or even choose one of two or three actions, customizable by an option.

Ah, the Emacs Prime Directive again :).

-- Stephe

reply via email to

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