Subject: Re: bug#47300: delete-window to select window with same position

From: Juri Linkov <[email-masked]>
Date: Wed, 19 May 2021 19:07:18 +0300

>> I can't find where `get-mru-window' is called during window deletion.
>
> It's here in `delete-window-internal'
>
> 	  /* Now look whether `get-mru-window' gets us something.  */
> 	  mru_window = call1 (Qget_mru_window, frame);

Thanks, I missed it because I searched with 'C-x p g get-mru-window'
instead of 'C-x p g get.mru.window'.

>> Maybe a new option e.g. `delete-window-select' with type not boolean,
>> but a predicate with the default value `get-mru-window', and another
>> choice `delete-window-select-underlying' to select the "merged" window.
>
> `get-mru-window' is not a predicate.  You probably mean a function so
> that someone could also use `get-lru-window' as value of that option?

Yes, a function to get a window to select after window deletion.

> The problem with such a function is that it has to be called with some
> predefined sort of FRAME or ALL-FRAMES argument so some explanatory
> footwork would be required.

It's fine to call it with a FRAME argument.  The problem is
how to write such a function that will find the window that
gets the screen space previously owned by the deleted window.
Could you recommend the right direction?  Maybe this window that
gets the screen space is just the parent of the deleted window?