emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Zoom: a window management minor mode -- best practices and questions


From: Andrea Cardaci
Subject: Re: Zoom: a window management minor mode -- best practices and questions
Date: Thu, 3 May 2018 11:47:40 +0200

> There are probably other ones like when a window gets deleted or the
> configuration changes but all these should get caught by your code.

Yep, I forgot to mention when a window gets deleted.

> I'm not sure why hooking 'minibuffer-setup-hook' is needed, I suppose
> it is not, at least for Emacs 26.  Other than that your code seems
> valid to me (even disabling 'window-configuration-change-hook' in
> 'balance-windows' is OK, that hook should not get called there any
> more).

`minibuffer-setup-hook` is needed to detect when the minibuffer is
selected because there's an option to preserve the currently zoomed
window in that case to avoid quick and useless layout changes.

> Obviously, 'window-size-change-functions' is meant for applications to
> react to size changes and possibly readjust buffer text shown in a
> window whose size changed.  You should warn other applications to make
> sure they _append_ their functions to this hook in order to be aware
> of your adjustments.  Maybe you should re-prepend your function when
> you find out that other ones have been prepended in between.

That's a interesting advice.

> Otherwise, I would use 'buffer-list-update-hook' instead of advising
> 'select-window' to make sure that all occurences of selecting a window
> get caught.  And I would experimentally try to not zoom immediately in
> 'buffer-list-update-hook' and 'window-configuration-change-hook' but
> simply feed these occurrencs to 'pre-redisplay-function' to reduce the
> number of times you zoom.  'window-pixel-height-before-size-change'
> and 'window-pixel-width-before-size-change' should allow to easily do
> the 'window-size-change-functions' part in 'pre-redisplay-function' as
> well.  Though my personal experiences with 'pre-redisplay-function'
> are not bright enough to recommend it for sure.

I will try this approach, thanks.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]