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

From: martin rudalics <[email-masked]>
Date: Tue, 21 Nov 2023 18:14:38 +0100

> That depends on the rest of the config, AFAIK.
 > I tried the patch I sent on some of my config and it did have an effect
 > (e.g. when I open `M-x calendar`, depending the `same-frame` I either
 > get one frame with *Calendar* and another with `diary` or I get
 > a single frame with both.  Both windows are dedicated).

Neither of these deal with 'reusable-frames' or 'lru-frames'.

 >> 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 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.

 > 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'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.  But all I can do
is to hint at inconsistencies in your proposal.

martin