[Top][All Lists]

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

Re: xref and displaying locations in appropriate window or frame

From: martin rudalics
Subject: Re: xref and displaying locations in appropriate window or frame
Date: Sun, 24 Jan 2016 19:12:31 +0100

> That doesn't seem to be true. Try:
> (with-temp-buffer-window "test" t nil
>    (insert "abc"))

> It shows the buffer "test" empty, and "abc" gets inserted into the
> buffer that was current before with-temp-buffer-window call.

Because of "Do not make that buffer current for running the forms in
BODY."  You have to use ‘with-current-buffer’ around the ‘insert’.

> Yup. That's about temp-buffer-resize-mode. But it seems orthogonal to
> the problem I currently have.

Not entirely.  I'd make the *xref* window as small as possible so it
doesn't get split.  And I'd like to see it always at the same frame

> Anyway, IME most lines in xref take more than half of its width (which
> is ~110 here). So rearranging them wouldn't help much.

With a maximized frame I get 200 columns here.  Anyway.  Don't bother
about laying out its contents.  But here usually the *xref* buffer never
occupies its full _height_.  That's where ‘temp-buffer-resize-mode’
would come in handy.

> The current issue is that people want *xref* to behave less like
> *Completions* (transient, disappearing soon) and more like
> *Compilation*, which stays until the user explicitly buries it or
> kills it or its window.

This should be of no importance.  Help windows are also displayed via
‘with-temp-buffer-window’ and don't disappear soon.  Some people keep
the help window open all the time.  The IMHO important aspect is that
*Completions* uses ‘display-buffer-at-bottom’ which calls plain
‘split-window’ and thus is not limited by ‘split-height-threshold’.  You
can obviously use ‘display-buffer-at-bottom’ with plain ‘display-buffer’
as well.  But then ‘temp-buffer-resize-mode’ won't get called.

> I think I need to "not reuse the original window", nor xref's
> window. And reusing the original window is more preferable than
> reusing the xref's window.

That's my understanding as well.

> Can I make xref's window temporarily dedicated, and call pop-to-buffer
> from the original window?

Yes.  But the one-window-per-frame user might get a new frame then.
She's not your target (because of the assumption that the original
window and the *xref* window are already there when you want to display
the other buffer).  But even softly (that's all you need here) dedicated
windows sometimes behave erratically.

> So if the frame is too narrow, and there are two windows only, the
> location will be displayed in the original window? OK, that should be
> fine.

If the other window is the *xref* window and the *xref* window was
"used" later.  You might have to "touch" it from time to time ;-)

>> I asked a couple of times whether this makes any sense but nobody cared.
> What makes sense? Having a split threshold? I think it does. Beyond
> that, I'd say window management might be too complex for a casual
> commenter to say whether it makes sense or not.

A threshold that is more than twice as large as the default value?

>> Why would she want to do that if you keep *xref* visible as long as it's
>> needed?  If the *xref* window is gone, the user should never switch to
>> *xref* manually but ask you to redisplay it.
> They can press `q', but then switch back to it a while later. I see no
> reason to prohibit this.

Neither do I.  But in a sense this is a bit like an ediff user deleting
the control panel and switching back to it later.  The ideal layout may
have gone at that time.

> Do we prohibit things like that in some other buffers?

Not to my knowledge.  I just wouldn't call it good user practice.  For
example, switching to *Help* in an arbitrary window and doing
‘quit-window’ there is not likely producing good results.  The same will
hold for ‘q’ in a window where you manually switched to *xref*.  Maybe
some command to "bring back" the *xref* buffer would be more useful than
simply switching to it.


reply via email to

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