Andrea Cardaci
2018-05-02 16:31:11 UTC
Hi,
This is a follow-up discussion for a bug I reported (
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=31312), since the
conversation was moving away from the bug itself I'm starting a new thread
as suggested by Eli.
layout so that the selected window is always *big enough*. I think the
screencast at the project page is quite clear about the usage.
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)
This is clearly an hack-ish solution but Zoom works fairly well most of the
times. On the other thread Martin suggested to replace `advice-add` with an
hook to `buffer-list-update-hook`, but the main issue remains that
`zoom--handler` actually resizes windows in the
`window-size-change-functions` hook.
Moreover, this solution causes the handler to be called several times and
most of them are useless. (Additional guards can be added but still...)
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.
Said that, I'm definitely not in a position to make any feature requests
but I would appreciate any feedback or suggestions.
Thanks,
Andrea
This is a follow-up discussion for a bug I reported (
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=31312), since the
conversation was moving away from the bug itself I'm starting a new thread
as suggested by Eli.
In that case, could you explain in more detail what zoom.el attempts
to do
Zoom (https://github.com/cyrus-and/zoom) aims to enforce a fixed windowto do
layout so that the selected window is always *big enough*. I think the
screencast at the project page is quite clear about the usage.
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)
This is clearly an hack-ish solution but Zoom works fairly well most of the
times. On the other thread Martin suggested to replace `advice-add` with an
hook to `buffer-list-update-hook`, but the main issue remains that
`zoom--handler` actually resizes windows in the
`window-size-change-functions` hook.
Moreover, this solution causes the handler to be called several times and
most of them are useless. (Additional guards can be added but still...)
and what does it need from Emacs core to be able to do that?
My knowledge of the Emacs internals is quite limited but at the highestlevel 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.
Said that, I'm definitely not in a position to make any feature requests
but I would appreciate any feedback or suggestions.
Thanks,
Andrea