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

From: Lars Ingebrigtsen <[email-masked]>
Date: Tue, 18 May 2021 16:49:01 +0200

Juri Linkov <[email-masked]> writes:

> People still have trouble with unpredictable behavior of 'C-x 0'
> that selects an unexpected window after the current window is deleted.
>
> This is a recent example:
> https://old.reddit.com/r/emacs/comments/m8omt0/how_can_deletewindow_cx_0_be_configured_to_stay/
>
> The previous failed attempt to fix this was in bug#32790.
>
> I still don't understand the current logic what window is selected
> after deleting the selected window with 'C-x 0'.

`C-x 0' isn't a command I use much, so I don't really have much
intuition about how it's supposed to work.  But, indeed, playing around
with it, it seems unexpected that `C-x 0' selects a different window
(instead of remaining in the "merged" window).

> Maybe something like this could be adapted to delete-window
> by adding an optional interactive argument keep-pos:

If I'm reading that patch correctly (I haven't actually tested), that
seems more DWIM to me.  Perhaps Martin has some comments here; added to
the CCs.  (And if anybody else has an opinion here, please do chime in.)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no