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: Re: Zoom: a window management minor mode -- best practices and questions Date: Mon, 7 May 2018 14:32:28 +0200 Message-ID: References: <83muxioten.fsf@gnu.org> <5AEAB616.4040900@gmx.at> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" X-Trace: blaine.gmane.org 1525696448 2352 195.159.176.226 (7 May 2018 12:34:08 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 7 May 2018 12:34:08 +0000 (UTC) Cc: Eli Zaretskii , emacs-devel@gnu.org To: martin rudalics Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon May 07 14:34:04 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 1fFfL9-0000Qx-Ve for ged-emacs-devel@m.gmane.org; Mon, 07 May 2018 14:34:04 +0200 Original-Received: from localhost ([::1]:45969 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fFfNB-00007x-Vq for ged-emacs-devel@m.gmane.org; Mon, 07 May 2018 08:36:10 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50842) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fFfJj-0006z1-SV for emacs-devel@gnu.org; Mon, 07 May 2018 08:32:38 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fFfJi-00060I-S4 for emacs-devel@gnu.org; Mon, 07 May 2018 08:32:35 -0400 Original-Received: from mail-qt0-x22e.google.com ([2607:f8b0:400d:c0d::22e]:45347) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fFfJe-0005te-C1; Mon, 07 May 2018 08:32:30 -0400 Original-Received: by mail-qt0-x22e.google.com with SMTP id j42-v6so35900875qtj.12; Mon, 07 May 2018 05:32:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=dGo/L5XKI47OAvyJZMzFfNnPt3N+vw7ONFh1rnwuYG8=; b=Wuy6T9ioxdqDBvSk19a+ovXjyRmBQ/vEVnqJNUbOUo9dF6gjHwkBK5vxehi1o6yku3 5HpynVpRIprx1ur9BdIzmuusYUOr1NpOzbe8EKu3p7jodNWKDt4LfRpn+G0pMRpYxHvl Hk3iqJLkRzySWx/V3Dvy4q0jKLTpTUUzyC4NsKLUxlMXm0Hkr217vOj3mQzOw7t+AsTr iTaELKSAwCCT/mMw8aSuaRShH6plrpcdimDXZ/ZnGZH4YZGRFJydYiD2YdaUg/ZfG9pl CHK40qLAqgnV0qCQ158tUNhGgwfgtx9Q5vxkw7t+dJG9I08OikP4Yl2sBIJ0I/KBmt/M 7atw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=dGo/L5XKI47OAvyJZMzFfNnPt3N+vw7ONFh1rnwuYG8=; b=puKAyfuo7KySLI27QzppTYYnl7sPXkKVz6prn5F3a5F4OSBCGLj5ff1KliXKxfsSNL CpWZYrfpygigol2Pse6cSlXWRFedQ9IhVNDsdCc69Bz1kKhTuDgK8ZUobPXckL9QiDS8 FIilu38EQgjl8UPaygMikDJyblTNzm8OIKJZWhsHXWvVO1cBmyVq01nrxex2K+Qe+ATm TR0m8mkEkRrMIpezn7vibw/nQsrtXG0maNzOpeMaDEJShTgpd6SGNdrYaeastnzPNDlp jgow+4Aw3OfVR0XpTSfOSWg/ab0/D83Irr+Yo2JHljH2vs+8i6ke4gPV8hg5bX91aSkZ t23Q== X-Gm-Message-State: ALQs6tCI0II158ONZko37VrCZhNa9gnMmO/uMVFzZZKUfxSYX0SGhcle pdJMK4X4XCtOHgLxcrEiOFG9bdwRMLMTH5+Zjbw= X-Google-Smtp-Source: AB8JxZq0rDJF+tkGLKX0jlid0hfkHtysQCnAg74eP5oLJrKkDLhj1HvtYd/cGuShRQcKhLDXIwTyfBxH7cGgme6Ryms= X-Received: by 2002:aed:3595:: with SMTP id c21-v6mr33122754qte.203.1525696349301; Mon, 07 May 2018 05:32:29 -0700 (PDT) Original-Received: by 10.200.63.210 with HTTP; Mon, 7 May 2018 05:32:28 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c0d::22e 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:225110 Archived-At: > > 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. > > I will try this approach, thanks. I've been trying this, I like the separation between checking whether a relayout is needed or not and the actual relayout. There's one problem with `buffer-list-update-hook` though, it gets called (multiple times) even wen the buffer list is not changed, e.g., simply by clicking in the buffer. Is this the expected behaviour? Besides this, if there's no way to get rid of false positives in event handling (i.e., a relayout is triggered but no actual change happened) I guess I need a way to decide if a relayout is *really* needed. A naive way would be saving the current window and buffer but I'm not sure if we can do better. Also, oddly enough, `pre-redisplay-function` is never called on macOS (Emacs 26.1)...