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: Eli Zaretskii
Subject: Re: Zoom: a window management minor mode -- best practices and questions
Date: Wed, 02 May 2018 20:32:16 +0300

> From: Andrea Cardaci <address@hidden>
> Date: Wed, 2 May 2018 18:31:11 +0200
> Cc: Eli Zaretskii <address@hidden>
> 
> Zoom (https://github.com/cyrus-and/zoom) aims to enforce a fixed window 
> layout so that the selected window
> is always *big enough*. I think the screencast at the project page is quite 
> clear about the usage.

I've seen the screencast before asking the question, but couldn't
grasp the intent well enough, probably because the display in
screencast switches windows too quickly, and it's hard to understand
what Zoom attempts to do.

> The implementation is very simple, every time a window change is *detected* 
> the following happens:
> 1. `balance-windows` is called;
> 2. the selected window is resized.
> 
> This, in practice, has the effect of disabling the manual resizing of windows.
> 
> The problem is that to implement the "every time a window change is detected" 
> part I currently hook several
> functions, specifically:
> 
>     (add-hook 'window-size-change-functions #'zoom--handler)
>     (advice-add #'select-window :after #'zoom--handler)

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?

Did you try to use pre-redisplay-functions instead?  That doesn't
necessarily tell you that the selected window is going to change or
its dimensions are about to change, but determining that for a single
window shouldn't be too expensive, right?

Alternatively, we could provide some control to disable resizing of
the selected window -- would that be enough, in addition to hooking
select-widnow using the method suggested by martin?

> My knowledge of the Emacs internals is quite limited but at the highest level 
> of abstraction what AFAIK is
> missing is a way to enforce custom window layouts and manage the windows 
> size. This part seems quite
> fragile / extremely hard to work with (just look at the implementation of 
> `balance-windows`). In addition to that
> there are some features that further complicate the situation, e.g., side 
> windows and not resizable windows.

Maybe Martin will suggest a good way of doing that using the existing
facilities, if they are enough.



reply via email to

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