From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Zoom: a window management minor mode -- best practices and questions Date: Wed, 02 May 2018 20:32:16 +0300 Message-ID: <83muxioten.fsf@gnu.org> References: Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1525282240 5631 195.159.176.226 (2 May 2018 17:30:40 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 2 May 2018 17:30:40 +0000 (UTC) Cc: emacs-devel@gnu.org To: Andrea Cardaci Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed May 02 19:30:36 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fDvaJ-0001Ku-T0 for ged-emacs-devel@m.gmane.org; Wed, 02 May 2018 19:30:32 +0200 Original-Received: from localhost ([::1]:51815 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fDvcQ-0006zS-W3 for ged-emacs-devel@m.gmane.org; Wed, 02 May 2018 13:32:43 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47899) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fDvcF-0006zB-3c for emacs-devel@gnu.org; Wed, 02 May 2018 13:32:32 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fDvc9-0005BN-5C for emacs-devel@gnu.org; Wed, 02 May 2018 13:32:31 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:51253) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fDvc9-0005BJ-1G; Wed, 02 May 2018 13:32:25 -0400 Original-Received: from [176.228.60.248] (port=1055 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1fDvc7-0007Uy-Lh; Wed, 02 May 2018 13:32:24 -0400 In-reply-to: (message from Andrea Cardaci on Wed, 2 May 2018 18:31:11 +0200) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:225036 Archived-At: > From: Andrea Cardaci > Date: Wed, 2 May 2018 18:31:11 +0200 > Cc: Eli Zaretskii > > 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.