From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Andrea Cardaci Newsgroups: gmane.emacs.devel Subject: Zoom: a window management minor mode -- best practices and questions Date: Wed, 2 May 2018 18:31:11 +0200 Message-ID: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000702f1c056b3b9de7" X-Trace: blaine.gmane.org 1525281335 5691 195.159.176.226 (2 May 2018 17:15:35 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 2 May 2018 17:15:35 +0000 (UTC) Cc: Eli Zaretskii To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed May 02 19:15:31 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 1fDvLn-0001Nu-3w for ged-emacs-devel@m.gmane.org; Wed, 02 May 2018 19:15:31 +0200 Original-Received: from localhost ([::1]:51646 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fDvNt-0007BO-UT for ged-emacs-devel@m.gmane.org; Wed, 02 May 2018 13:17:41 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:59578) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fDuew-000272-Ro for emacs-devel@gnu.org; Wed, 02 May 2018 12:31:16 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fDuev-0007FV-EZ for emacs-devel@gnu.org; Wed, 02 May 2018 12:31:14 -0400 Original-Received: from mail-qt0-x236.google.com ([2607:f8b0:400d:c0d::236]:46295) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fDuev-0007FQ-8V; Wed, 02 May 2018 12:31:13 -0400 Original-Received: by mail-qt0-x236.google.com with SMTP id m16-v6so19141453qtg.13; Wed, 02 May 2018 09:31:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to:cc; bh=8CIvaNmtATZv9GoFHQBNAjWJF0yeZva9GY4EMiPLBME=; b=BccXC8BF107LyKUW3lL0M3RAACp6AC4KS+SFkrq5BhsXyixrgk8au2bVa5yi7SNSgk /VcL+SacRgfh43vXp3tRp9bJGd0uUlLN97bkmbzcjCq+o8CU2zP1e/QHBz7dwPmj3Lhi kaOAzu0qUDNig7roMrzCpnID7NKxY0g+KdhQxfCPxJZ/GqOdMpKFiVqhWvoKZkWMxM3G jmk6sdDgvUqrAs3kFpGrXUl/ZSqlpfPnpZPAsCPkydyTqs1UJGbVoEw+IJFnQa6vo/Kg UI68/ZkZ0Am9/5z7xny7G4rZQ3Dpeld2CO+waKViSXvpVBX58Qcutu2iYc16etkAvcIR 3uBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc; bh=8CIvaNmtATZv9GoFHQBNAjWJF0yeZva9GY4EMiPLBME=; b=hjqeHo9oXpbsb4lkotgwLRNbUCMlhJkk52tLjLyfWS3RSGfiA1VM4wdbx6CdVCw7gA csqqK/InfxvoEkfsupXRNnzR4p3PGSSFocaEuPOVeCW4HdqCo0GJSbLs46+8eLa4lnhb 6LQ3lquZU8cn7qkYctVw2HGZDRkRDE8w/KXSMepq3hznO2X7yKHhExrTGCrdnmK07qs1 szcLqZKd3g50J0gbIBF1FII6TO7CudArYqQuGhwsgvg2rQeVaLnREMNSBCBAl6od32YJ NeSWxFTZBgHiNyhwbd4k3+VM6agbk8lY/bKQGpoawqbioXb+Scv3jZWNvxL6mZeZHM9Z aQZg== X-Gm-Message-State: ALQs6tAMzoUL+3w2AlBfUHlbYcv5ejrXrMdH6VqU6CWXVLSdG78MYc1L EpBxCu+dlU+MmY/cAVhji8Y9+vCyrhp3iKF7NkNl+JbbpGU= X-Google-Smtp-Source: AB8JxZp6lttCmWBaWbC29uRH7MYFKFtEyUAEf0mnldbf7LYcUbyMWnuhvh9DOuf06JbkmZTIGjusYBgJuhDA6blWP4Y= X-Received: by 2002:ac8:3f72:: with SMTP id w47-v6mr16936214qtk.318.1525278672169; Wed, 02 May 2018 09:31:12 -0700 (PDT) Original-Received: by 10.200.63.210 with HTTP; Wed, 2 May 2018 09:31:11 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c0d::236 X-Mailman-Approved-At: Wed, 02 May 2018 13:17:35 -0400 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:225035 Archived-At: --000000000000702f1c056b3b9de7 Content-Type: text/plain; charset="UTF-8" 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. > 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 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. 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 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. Said that, I'm definitely not in a position to make any feature requests but I would appreciate any feedback or suggestions. Thanks, Andrea --000000000000702f1c056b3b9de7 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi,

This is a follow-up discussion for = a bug I reported (https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D31312), since= the conversation was moving away from the bug itself I'm starting a ne= w thread as suggested by Eli.

> In that case, c= ould you explain in more detail what zoom.el attempts
> to do<= /div>

Zoom (https://github.com/cyrus-and/zoom) aims to enforce a fixed window lay= out so that the selected window is always *big enough*. I think the screenc= ast at the project page is quite clear about the usage.

The implementation is very simple, every time a window change is *det= ected* 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 currentl= y hook several functions, specifically:

=C2=A0 =C2=A0 (add-hook 'window-size= -change-functions #'zoom--handler)
=C2=A0 =C2=A0 (advice-add = #'select-window :after #'zoom--handler)

This is clearly an hack-ish solution but Zoom works fairly well mos= t 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 window= s in the `window-size-change-functions` hook.

More= over, this solution causes the handler to be called several times and most = of them are useless. (Additional guards can be added but still...)

>=C2=A0and what does it need from Emacs core to be able= to do that?

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

Said that, I'm definit= ely not in a position to make any feature requests but I would appreciate a= ny feedback or suggestions.


Thanks,=

Andrea
--000000000000702f1c056b3b9de7--