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

From: Juri Linkov <[email-masked]>
Date: Thu, 25 Oct 2018 23:48:09 +0300

>> 2. based on display-buffer-alist, implement some more declarative
>>     definitions of window layouts, i.e. allow the user to describe
>>     the used windows in which buffers should be displayed in them.
>
> I'd need to see a proposal how that can be done.  In a way it's
> orthogonal to how 'window-state-put' tries to reconstruct a window
> configuration and it's no entirely trivial to do that.

I imagine it could be a structure like returned by 'window-state-get'
but instead of a buffer name specify a regexp or a list of possible
buffer names that are allowed to be displayed in the given window.
Then display-buffer could search a buffer in such template and
reconstruct the window state where the buffer will be displayed in
the place specified in the template.

> But I think that putting a function on
> 'window-configuration-change-hook' can be dangerous when a window
> showing the buffer in question already exists and gets reused.  In
> such case 'window-configuration-change-hook' is not run and the
> changed value of 'display-buffer-overriding-action' will persist.  So
> we probably need a 'display-buffer-functions' hook to remove it
> reliably.  Basically, however, I think that using an overriding action
> is justified here.

Please note that in the code posted 3 days ago I used the hook that you
proposed recently window-state-change-functions, so this code is not yet
functional :)