From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#32637: 27.0.50; window-size-change-functions not run from local hook Date: Sun, 09 Sep 2018 02:56:35 +0300 Organization: LINKOV.NET Message-ID: <87zhwrzgp8.fsf@mail.linkov.net> References: <87musx9dr1.fsf@mail.linkov.net> <5B8F8A0C.1030908@gmx.at> <87musv1ufw.fsf@mail.linkov.net> <5B90D1B8.1000203@gmx.at> <87tvn2ffgf.fsf@mail.linkov.net> <5B92296A.4020603@gmx.at> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1536452360 7721 195.159.176.226 (9 Sep 2018 00:19:20 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 9 Sep 2018 00:19:20 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu) Cc: 32637@debbugs.gnu.org To: martin rudalics Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Sep 09 02:19:16 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1fynRc-0001uC-2P for geb-bug-gnu-emacs@m.gmane.org; Sun, 09 Sep 2018 02:19:16 +0200 Original-Received: from localhost ([::1]:45564 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fynTi-0000SF-0o for geb-bug-gnu-emacs@m.gmane.org; Sat, 08 Sep 2018 20:21:26 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53367) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fynSv-0008SQ-Cu for bug-gnu-emacs@gnu.org; Sat, 08 Sep 2018 20:20:38 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fynEp-0003Sv-Je for bug-gnu-emacs@gnu.org; Sat, 08 Sep 2018 20:06:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:45682) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fynEp-0003So-F8 for bug-gnu-emacs@gnu.org; Sat, 08 Sep 2018 20:06:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1fynEp-0005iA-8x for bug-gnu-emacs@gnu.org; Sat, 08 Sep 2018 20:06:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 09 Sep 2018 00:06:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 32637 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 32637-submit@debbugs.gnu.org id=B32637.153645151721882 (code B ref 32637); Sun, 09 Sep 2018 00:06:03 +0000 Original-Received: (at 32637) by debbugs.gnu.org; 9 Sep 2018 00:05:17 +0000 Original-Received: from localhost ([127.0.0.1]:50698 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fynE4-0005gs-Mi for submit@debbugs.gnu.org; Sat, 08 Sep 2018 20:05:16 -0400 Original-Received: from pop.dreamhost.com ([64.90.62.162]:46944 helo=pdx1-sub0-mail-a34.g.dreamhost.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fynE1-0005gh-BQ for 32637@debbugs.gnu.org; Sat, 08 Sep 2018 20:05:13 -0400 Original-Received: from pdx1-sub0-mail-a34.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a34.g.dreamhost.com (Postfix) with ESMTP id 7F5007F3A0; Sat, 8 Sep 2018 17:05:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=linkov.net; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=linkov.net; bh=2U8WqK4HnegQK8rK6dTy1PIQc9E=; b= MjKBdWGRySomsR7SNYsNX05ZyABh1xSJOuKWtssyqCQXRyZ1ah4qU+KPOS9ZHzB4 1D8iF5eUZDl8qT+6OBN1Uual/mIxeeVU95SeYXrcBJLu6y2aRp2aBD/d3zf51FgK KkidQ3xH7BCVcx1z+57U7vWC019jRwOHJ91iwbTiiZg= Original-Received: from localhost.linkov.net (m91-129-107-190.cust.tele2.ee [91.129.107.190]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: jurta@jurta.org) by pdx1-sub0-mail-a34.g.dreamhost.com (Postfix) with ESMTPSA id DE2927F3A1; Sat, 8 Sep 2018 17:05:10 -0700 (PDT) In-Reply-To: <5B92296A.4020603@gmx.at> (martin rudalics's message of "Fri, 07 Sep 2018 09:31:54 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:150140 Archived-At: >> But in bug#32536 you agreed that Man-window-size-change has to >> take care of cases where buffer-local window-size-change-functions >> needs to find all Man windows on the frame to compare their sizes >> and reformat the buffer with the minimim width from all its windows. >> >> So the window-size-change-functions hook should call the function not >> with the window as argument, but with the whole frame, as it already >> does now. And to call the buffer-local hook only once for all >> affected windows, as it already does now (the hook has responsibility >> to find all its windows from the frame). > > I meant that running 'window-size-change-functions' in a buffer-local > fashion when no window showing that buffer has changed its size might > be misleading. window-size-change-functions calling code could detect if a window with a buffer-local hook changed its size, and not to call its hook in this case. This would be even better than using global hook where you can't implement such optimization. > But put a buffer-local function on 'window-configuration-change-hook' > and show the buffer in two windows. The function gets called twice > with the respective window selected. So if we implemented > 'window-size-change-functions' in the same way as you suggested > earlier, you would "find all Man windows on the frame to compare their > sizes and reformat the buffer with the minimim width from all its > windows" twice. How would you deal with that? window-size-change-functions calling code could call it only once for every frame, even if the same buffer is displayed in multiple windows. >>> And I still think that running 'window-configuration-change-hook' >>> buffer-locally in its current from hardly makes sense either: For >>> example, we don't call it for a buffer when that buffer has been >>> removed from a window which incidentally is the case that would allow >>> Man to remove its function from 'window-configuration-change-hook'. >> >> There is no need to remove function from the buffer-local hook, >> because it is called only when the buffer is displayed >> in a window. > > As you noted earlier, a buffer-local 'window-size-change-functions' > function gets called regardless of whether the buffer is shown in a > window on the frame in question. I see that it's not called when the buffer is not displayed in any window on the frame - this is correct. But what I noted earlier is that it's not called when the buffer with the buffer-local hook is not the current-buffer in the selected window (but it's displayed in a non-selected window on the frame) - this should be fixed to call the hook regardless if its window is currently selected or not. > And if we wanted to fix that, we probably need something better than > imitating 'window-configuration-change-hook'. I think window-configuration-change-hook is a step forward in the right direction.