Subject: Re: bug#67249: 30.0.50; `same-frame` equivalent for `display-buffer-alist`

From: Stefan Monnier <[email-masked]>
Date: Tue, 21 Nov 2023 14:09:22 -0500

>>> So a (same-frame . t) entry would simply auto-translate to a pair of
>>> (reusable-frames . nil) (lru-frames . nil) entries?
>>
>> [ Hmm... I'm curious how you interpreted what I wrote to reach
>>    that conclusion.  ]
>> No, I meant the opposite: the users who want to override
>> `reusable-frames` and `lru-frames` need to add all three
>>
>>      (same-frame . t)
>>      (reusable-frames . nil)
>>      (lru-frames . nil)
>
> Suppose an application calls ‘display-buffer’ with a non-nil
> 'same-frame' alist entry.  If we want an existing action function to
> obey that entry and we do not want to rewrite that function, we could
> have 'display-buffer' add a (reusable-frames . nil) (lru-frames . nil)
> pair to the alist.

We could, but we could also define the semantics of `same-frame` to have
no effect on frame re-use (it would actually be closer to the current
semantics).  If so, it'd be best to find another name for it along the
lines of "no-new-frame".

>>> We could add a 'display-buffer--same-frame-action' variable.
>> I don't really know what that suggestion means.
>> The `--` suggests it'd be some internal detail of `window.el` whereas
>> I thought we're discussing the externally visible API and semantics.
> It could do what I meant above - translate 'same-frame' internally.

What is "it"?  `display-buffer--same-frame-action`?
Without knowing where you'd use such a variable, it's hard for me to
guess what you mean by that.

>> I don't see why you think it'd require any change in existing code: the
>> ones who set `same-frame` get what they ask for.
> You already would change the existing 'display-buffer-pop-up-frame'.
> If you think that change is sufficient, I will obviously stop thinking.

I suspect it might be sufficient, but it would deserve a better name so
users don't get the wrong impression that it will affect reuse on
other frames.

So you think the patch I sent is actually more-or-less acceptable
(modulo documentation and finding a better name)?

>> I'm not talking about `display-buffer` choosing a minibuffer-only frame.
>> I'm saying that when the selected-frame is a minibuffer-only frame, it's OK
>> to ignore the `same-frame` request.
> When the selected frame is a minibuffer-only frame, 'display-buffer'
> usually tries to think of 'last-nonminibuffer-frame' as the selected
> frame.  So probably 'same-frame' should do the same.

Sounds like this is compatible to my suggestion that it's OK to ignore
`same-frame` when the selected frame is a minibuffer-only frame.

> But all I can do is to hint at inconsistencies in your proposal.

Not sure what's the inconsistency there.

        Stefan