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: Fri, 07 Sep 2018 01:17:01 +0300 Organization: LINKOV.NET Message-ID: <87bm9ae0f6.fsf@mail.linkov.net> References: <87musx9dr1.fsf@mail.linkov.net> <5B8F8A0C.1030908@gmx.at> <83k1o0x8w0.fsf@gnu.org> <87a7ov1ucp.fsf@mail.linkov.net> <837ejzxsif.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1536272660 14540 195.159.176.226 (6 Sep 2018 22:24:20 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 6 Sep 2018 22:24: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: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Sep 07 00:24: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 1fy2hC-0003ee-TT for geb-bug-gnu-emacs@m.gmane.org; Fri, 07 Sep 2018 00:24:15 +0200 Original-Received: from localhost ([::1]:35715 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fy2jJ-0007ce-Cj for geb-bug-gnu-emacs@m.gmane.org; Thu, 06 Sep 2018 18:26:25 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41875) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fy2jA-0007c4-GE for bug-gnu-emacs@gnu.org; Thu, 06 Sep 2018 18:26:17 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fy2iz-0007LE-Jm for bug-gnu-emacs@gnu.org; Thu, 06 Sep 2018 18:26:14 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:43505) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fy2iw-0007Go-KJ for bug-gnu-emacs@gnu.org; Thu, 06 Sep 2018 18:26:05 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1fy2iw-0002dh-Ad for bug-gnu-emacs@gnu.org; Thu, 06 Sep 2018 18:26:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 06 Sep 2018 22:26:02 +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.153627271010076 (code B ref 32637); Thu, 06 Sep 2018 22:26:02 +0000 Original-Received: (at 32637) by debbugs.gnu.org; 6 Sep 2018 22:25:10 +0000 Original-Received: from localhost ([127.0.0.1]:48522 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fy2i6-0002cS-7S for submit@debbugs.gnu.org; Thu, 06 Sep 2018 18:25:10 -0400 Original-Received: from pop.dreamhost.com ([64.90.62.162]:39056 helo=pdx1-sub0-mail-a22.g.dreamhost.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fy2i4-0002cK-9n for 32637@debbugs.gnu.org; Thu, 06 Sep 2018 18:25:08 -0400 Original-Received: from pdx1-sub0-mail-a22.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a22.g.dreamhost.com (Postfix) with ESMTP id 812D77E44C; Thu, 6 Sep 2018 15:25:07 -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=C/RBAl1XxHkUSIzhhDBzO9rB5jE=; b= NXk1ypKXaJyA9HfYyVK3TSnaOLN4PaxNdDj9a+V0dUXhRD3fhuyT37qnAMGaFfxV 5Tdcmi0Ezw/Y1Isk8o5HWxKXpRw62ixpc/tAShOsTRidJX/fOqjtBxA6Te/2zMR8 mq9ioeWMVw9hKI2jupRLT6nb6H3+YzhjT32urCFAjZ4= Original-Received: from localhost.linkov.net (m91-129-106-97.cust.tele2.ee [91.129.106.97]) (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-a22.g.dreamhost.com (Postfix) with ESMTPSA id 4FCEC7E44E; Thu, 6 Sep 2018 15:25:06 -0700 (PDT) In-Reply-To: <837ejzxsif.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 06 Sep 2018 05:35:20 +0300") 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:150099 Archived-At: >> > I actually don't understand why we need to support buffer-local hooks >> > in window-size-change-functions. This hook clearly applies to the >> > entire frame, so anything buffer-local sounds inappropriate there. >> >> A buffer-local hook is useful when a mode needs to reformat its >> buffer content on window resizing. > > We have no control on what each hook could or could not do. We give > programmers a rope, but cannot prevent them from hanging themselves > (and take down Emacs with them). > > E.g., what happens if two buffers displayed on the same frame have > different hooks there, which just happen to have conflicting ideas of > what should be done when windows are resized? How will they be able > to reconcile their conflict? The problem is that currently Emacs entangles programmers with too much rope for hanging themselves. See for example how programmers are currently struggling to emulate buffer-local window-size-change-functions: (define-derived-mode bs-mode nil "Buffer-Selection-Menu" ... (add-hook 'window-size-change-functions 'bs--track-window-changes) (add-hook 'kill-buffer-hook 'bs--remove-hooks nil t) (add-hook 'change-major-mode-hook 'bs--remove-hooks nil t)) (defun bs--remove-hooks () "Remove `bs--track-window-changes' and auxiliary hooks." (remove-hook 'window-size-change-functions 'bs--track-window-changes) ;; Remove itself (remove-hook 'kill-buffer-hook 'bs--remove-hooks t) (remove-hook 'change-major-mode-hook 'bs--remove-hooks t)) where "Remove itself" indeed sounds like "Hang itself". We can disentangle programmers from rope to avoid such fragile workarounds by allowing buffer-local hooks with just (define-derived-mode bs-mode nil "Buffer-Selection-Menu" ... (add-hook 'window-size-change-functions 'bs--track-window-changes nil t))