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: Thu, 3 May 2018 11:47:40 +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 1525352353 2258 195.159.176.226 (3 May 2018 12:59:13 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 3 May 2018 12:59:13 +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 Thu May 03 14:59:09 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 1fEDpE-0000Tn-Ue for ged-emacs-devel@m.gmane.org; Thu, 03 May 2018 14:59:09 +0200 Original-Received: from localhost ([::1]:56184 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fEDrM-0006qW-1c for ged-emacs-devel@m.gmane.org; Thu, 03 May 2018 09:01:20 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36890) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fEAq0-0007xr-7O for emacs-devel@gnu.org; Thu, 03 May 2018 05:47:45 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fEApz-00083E-E8 for emacs-devel@gnu.org; Thu, 03 May 2018 05:47:44 -0400 Original-Received: from mail-qt0-x22d.google.com ([2607:f8b0:400d:c0d::22d]:36899) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fEApx-00082t-VL; Thu, 03 May 2018 05:47:42 -0400 Original-Received: by mail-qt0-x22d.google.com with SMTP id q13-v6so21221675qtp.4; Thu, 03 May 2018 02:47:41 -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=OlVsgUgq3fwwJiMqZjjZREMITY5ps/x7cmqn9NjsE0I=; b=f12QiNyf9jAKX7A/JyDkZ4PMFXn7s9boSOEWEI27fKwRUKpF7mvuu1WrUmOoWYzMFP fJ5yeXF9t6WWlqnsGTmuw7aeg3jLHs8iU+5QxL5qKUT9KQ5LfxCWgXb4eYTza7jI+oK+ 5MRMPghbIHgu0VTwLy+2hHKBZ4gSSbhLiVMeSxyyU1d62SX+9HEHhAuUpnGh0xQzOLa0 tju4pBL81ySky5p4Fuq/6YXXwMeWYPtPUDJxCl4U5sXTajQQJ7BzbjimtSwJ1YsThAat SmmNhk9tcrdU8AY8rjE6HJpRNnRf+n6dv4BcXH4HpDRcFHYOxBqOUfRImRek0LtgYIkg O1BA== 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=OlVsgUgq3fwwJiMqZjjZREMITY5ps/x7cmqn9NjsE0I=; b=LFxnw821wDDG502zXWtkR1KYvgoyRCI0PCw6K+gD6nOzmJV4JbNRjtwsMVJU1ZDQFc MKt0P321MK4KCrebyTyzWSmLdr4BCOQfXjqF06GohdACVWCML9sDp3uXhmgL/1bk5QxG NrWv8gu48rDV8Vx4UyWd8vir5mRL61oaQMKpuQ4zafUfzV96VDXvYCC6+S3ED5RjkQ3x rrqm2heabHy3dcq6yHhp/lx8P9QvicQ3mK+Qbw/FCmmmidXT0SOW73ajIuKd3z/bhZXd E2a9V1/dxMcvwv8iKy1Ldhqux3CpM/xbQNNLTN/UAcknrpRlJIjt6cCceqi4w4/iOOW1 35Lg== X-Gm-Message-State: ALQs6tDtTio2tBDm5NZnN5fcOXmLwzpxrleKWNCqBPB2g8qV2luWmEf4 Gz4mUmCsltjUAGOMfp5y47tTjUE3+x8F6tzxvFY= X-Google-Smtp-Source: AB8JxZpZ4P3CKW/iq7cqkTfssJhHuihSkvwSzA8Wk1JHo1aYRzXoifs7yMOF/T7fIyUgpnz9FPt8ENI11Gr2f4iKre0= X-Received: by 2002:ac8:2aef:: with SMTP id c44-v6mr19528760qta.380.1525340861255; Thu, 03 May 2018 02:47:41 -0700 (PDT) Original-Received: by 10.200.63.210 with HTTP; Thu, 3 May 2018 02:47:40 -0700 (PDT) In-Reply-To: <5AEAB616.4040900@gmx.at> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c0d::22d X-Mailman-Approved-At: Thu, 03 May 2018 09:00:29 -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:225048 Archived-At: > There are probably other ones like when a window gets deleted or the > configuration changes but all these should get caught by your code. Yep, I forgot to mention when a window gets deleted. > 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). `minibuffer-setup-hook` is needed to detect when the minibuffer is selected because there's an option to preserve the currently zoomed window in that case to avoid quick and useless layout changes. > 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. That's a interesting advice. > 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.