Thanks for the answer.
> I understand why you need to hook select-window, but not why you need
> the other hook. Is it because there are too many functions that could
> modify the window size, and you didn't want to hook all of them?
The handler should be triggered in these cases:
- a window is resized;
- a window is selected;
- a window is created (this is actually included in the "a window is resized" case);
- a window changes its buffer (because it's possible to exclude certain windows from zooming so the layout should be updated accordingly).
So yes, instead of trying to figure out what the functions that cause such events are (probably way too many) I simply tried to hook on the effects of such actions.
> Did you try to use pre-redisplay-functions instead?
Not yet, but a quick test shows that it gets called *very* often, even when Emacs is idle. I should really implement some additional guard if I decide to go that way to avoid incurring in performance issues.
Also it seems to not work well with the `track-mouse` variable that I use to delay the re-layout if there is some mouse selection in progress.
Besides, doesn't this in principle suffer of the same do-something-that-triggers-the-hook-inside-such-hook problem like `window-size-change-functions`?
> Alternatively, we could provide some control to disable resizing of
> the selected window
Please elaborate on this point. How can it help this situation?