From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.devel Subject: Re: Zoom: a window management minor mode -- best practices and questions Date: Thu, 03 May 2018 09:11:18 +0200 Message-ID: <5AEAB616.4040900@gmx.at> References: <83muxioten.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: blaine.gmane.org 1525331432 27420 195.159.176.226 (3 May 2018 07:10:32 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 3 May 2018 07:10:32 +0000 (UTC) Cc: emacs-devel@gnu.org To: Andrea Cardaci , Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu May 03 09:10:28 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 1fE8Nn-00071y-UY for ged-emacs-devel@m.gmane.org; Thu, 03 May 2018 09:10:28 +0200 Original-Received: from localhost ([::1]:54386 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fE8Pu-0007Ao-JI for ged-emacs-devel@m.gmane.org; Thu, 03 May 2018 03:12:38 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54211) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fE8Or-000784-8j for emacs-devel@gnu.org; Thu, 03 May 2018 03:11:34 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fE8On-0002Wo-5b for emacs-devel@gnu.org; Thu, 03 May 2018 03:11:33 -0400 Original-Received: from mout.gmx.net ([212.227.17.22]:48451) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fE8Om-0002Vz-R9; Thu, 03 May 2018 03:11:29 -0400 Original-Received: from [192.168.1.101] ([212.95.5.30]) by mail.gmx.com (mrgmx103 [212.227.17.168]) with ESMTPSA (Nemesis) id 0MFctN-1fB3T13rhF-00EawH; Thu, 03 May 2018 09:11:27 +0200 In-Reply-To: X-Provags-ID: V03:K1:3ggeQ18/CtVzr94oXW04wsXcMT+X4T+5AEwFOtzkciUal8lg8S8 1vboz1myDddq5PMJ3cBv7FGohEd+GZDKOz17nAISB94f64NZXfXR1zPOIj9bdyrbLA2EoJr Z4MMLB9NTlntBAm8HnPo2s1wS2R2+zQRlNCe16AXFR2E4ftTMW5Mt4Wx1K/cmlqPUG1EmHG ryQxXPh7GZ945hgKfLqrg== X-UI-Out-Filterresults: notjunk:1;V01:K0:dzS8PoAXsFY=:xA2VZmgkVdsBR4RUirnqpA pMeLIPBO+G02ld9DXb0X6iA1KaQxFe6HOvyznzoEtyZ/lUshq8OMAFIw75DuTLY6RlJPG7HC0 Omih4+1Q2Ru4XG0B9nIascIm3YDSVcI/EH/BVR6rzWKDLiap7h/uwfQ0Uy5JW1RRSTCCKxhT7 aIYOlnPY+JMmaHQ95eckYZ/Lru0h7hcjQKbedH9kmDLDCM9qgZlEYXxGyJo7MdSVjFzDPcH18 GO40XKl2oD6mCRWjA000lg5kDMDuvc2g/sSuusMEaulMFv7Tv+pi3Srye/YEXLgmdEjFRgvsA iRmau008Yn0507dQkrUwdVZ7fnq61/ub7GNmZSpWyaI+796XDD7SXj2uPa8CHm/Xkzn+EJZhq 5IbmT2FwSyQmemkYg+YQX7LKxqoAeKd2Qh0o4QYKyfpKm726lQ8ToD6dI3Gnfjx8tuhjtL+pi gFbs+JHrBXXWIROhroXQIzgGGtUYcs++KywguMGgzzrSqBWzgRZiMquK79O/LtG9qdtk5NwUt KA1csbd3YiTGCWMQNNVlNxITTlHLM9sLNj9ZH87vg94dxEkQ9gZQcyakJg4l50seQJ/TgVMyR lS0Ivr0fnagcf3TgoP9QWcLTEgn6uYaGAFezUbMuTtiCVMA+lXPlW2gfGI80LMctKG1R0VsuX IjIzNrbpIltRuqQNWI+WRNRUAi21Q71BetIYNne/fl+Scr3SEccDbpn2TLLX5WoN27vvwQ2l+ aFEIIHzI4Pkebq2cMlrT5UwozhMTKwgGnXMLxGljReH3m11ndu+n0nqFSpPVdjyzHzEgx8/J X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 212.227.17.22 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:225045 Archived-At: > The handler should be triggered in these cases: > - a window is resized; > - a window is selected; > - a window is created (this is actually included in the "a window is resized" > case); > - a window changes its buffer (because it's possible to exclude certain > windows from zooming so the layout should be updated accordingly). There are probably other ones like when a window gets deleted or the configuration changes but all these should get caught by your code. 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). 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. 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. martin