Subject: bug#32790: 27.0.50; point jumps unexpectedly after delete-window

From: martin rudalics <[email-masked]>
Date: Sun, 11 Nov 2018 09:51:57 +0100

>> Shouldn't (selected-window) be actually (minibuffer-selected-window)
 >> in these cases anyway?  Otherwise, we probably should invent two
 >> scenarios where either of the above would be preferable so we can make
 >> a decision.
 >
 > Probably you meant (or (minibuffer-selected-window) (selected-window))

Something like that, yes.

 > This summarizes the prefix keys where 'default' is the default
 > window selection behavior, and 'window-noselect' restores a previously
 > selected window:
 >
 >                                      default     window-noselect
 > relative to the position of point   no prefix   M-0
 > relative to the first edge          M-1         C-u
 > relative to the last edge           M-- 1       M--

I would drop that edge thingy, interactively.  I'm quite convinced
that nobody would ever use it.

IMHO this "relative" code is there for historical reasons - the author
wrote the simpler edges versions first, wrote the point version later
and didn't want to drop the edges versions then (maybe also because he
wasn't sure whether the point version would always work).  What I
doubt is that a user would ever make the relativity choice
interactively.  Rather people would be used to one or the other.

 > But maybe also another choice 'window-select' should be added to
 > force window selection?  I mean that some commands don't select
 > the displayed window by default, e.g. help commands like
 > 'C-h e', 'C-h f', 'C-h v', 'C-h k' after their invocation
 > don't select the window with the *Help* buffer.

With 'help-window-select' non-nil they should always select the help
window.

 > Or maybe a prefix key should invert the default behavior,
 > e.g. 'S-M-right C-x v =' by default selects the displayed window,
 > so ‘C-u S-M-right C-x v =’ will not select the window.
 > 'S-M-right C-h e' by default doesn't select the window,
 > so ‘C-u S-M-right C-h e’ will select the window.

That would confuse the hell out of me.  I'm not sure how you or others
feel, but personally I would prefer a fixed two layer choice like:

(1) The select/no-select choice always bound to one and the same
prefix key _regardless_ of the default behavior of the function (for
the buffer at hand), and

(2) in addition to a window relative to the selected window (above, on
the right, ... a new one always made by splitting the selected window)
optionally allow a window relative to the selected frame (on the top
full-width, on the right full-height, ... a new one always made by
splitting the frame's root window) bound to another prefix key.

Then (2) could be generalized via a global option to use/make a new
(child) frame in the indicated direction or whatever people want.

martin