From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: window-buffer-change-functions Date: Thu, 22 Sep 2022 09:21:52 +0300 Message-ID: <83fsgkszcv.fsf@gnu.org> References: <83o86hyild.fsf@gnu.org> <877d1ycbom.fsf@gnus.org> <835yhivx39.fsf@gnu.org> <83v8piuh5k.fsf@gnu.org> <2f85eda92184de27e10572e6b2320885@webmail.orcon.net.nz> <83pmfpv4fs.fsf@gnu.org> <7110e0330e878c144a6364a8e6ad651c@webmail.orcon.net.nz> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14982"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Richard Stallman , martin rudalics Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Sep 22 08:28:37 2022 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1obFhN-0003nI-1r for ged-emacs-devel@m.gmane-mx.org; Thu, 22 Sep 2022 08:28:37 +0200 Original-Received: from localhost ([::1]:56478 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1obFhM-0001OZ-0p for ged-emacs-devel@m.gmane-mx.org; Thu, 22 Sep 2022 02:28:36 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:57370) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1obFak-0007Lh-K9 for emacs-devel@gnu.org; Thu, 22 Sep 2022 02:21:51 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:41342) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1obFai-0005AY-OF; Thu, 22 Sep 2022 02:21:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=RUsbQQXGcKp2rhd5XEk2GORAJW7uKY+AFHRcQmsmFXk=; b=I2gA1+l4CjGv ixlFW+sjWK7XxH1IYogC+J/QERQ7isTFBuEv1EX26lKFpa6SbKUr8ZWfECHutExXB8Ei05zG3OXFF ZbmEFjdjqUNQwqEWXqtlpqezEQqXdK3SHct9l8aM3+q8NEgQBOFqso4++wnLOyxVoVy5P1uZSnzd2 pQQYF1mZxtv5ZBlhV8Jek0IqpSIAm2No2rkq7v+s2G30pSyD3GtUza9ypZp+2eisA+hXlrUVxN+QV rpGemYVjWHtAYlwUt+gubcHtv6zxPHqSfVBNhNIj6d/aho9Dl7mEMHwsXPKAFj9tKL7H9g/pNLlwM I28fWULnAs1ZYT7KOLvMZQ==; Original-Received: from [87.69.77.57] (port=1093 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1obFag-0003Wz-Ev; Thu, 22 Sep 2022 02:21:42 -0400 In-Reply-To: (message from Richard Stallman on Wed, 21 Sep 2022 09:59:24 -0400) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:295961 Archived-At: > From: Richard Stallman > Date: Wed, 21 Sep 2022 09:59:24 -0400 > > I tried to fix the documentation of `window-buffer-change-functions' > to avoid passive voice, then discovered it was unclear in other ways. > So I decided to rewrite it to make it clear. > > In that attempt, I found it was so unclear that I could not be sure > what the variable actually does. I concluded ultimately that the > problem was in the variable's meaning, not just in the documentation > text. If I understand it right, it uses the default (global?) value > in one way and buffer-local values in another way. > > This messes up the general rule for the meaning of buffer-local > bindings, undermining the clarity of the Emacs Lisp language. We > should try hard to avoid ever doing that. In this case I think it > will not be hard. > > I propose we replace it with two variables, each with a simple > meaning. They could be `buffer-window-change-functions' and > `frame-buffer-change-functions'. I don't think this justifies splitting this variable (which exists since Emacs 27) into two. Such a split will cause a lot of problems for existing code, because this hooks are used in a lot of Lisp programs. Keeping obsolete aliases is a PITA and a maintenance burden, so it doesn't really eliminate this downside. This hook is conceptually simple: it is called when the correspondence between buffers and their windows changes. The functions in the local value are called for individual windows only when the corresponding buffer is involved in the change, and the global value is called once for any frame where the correspondence changed for any buffer. This shouldn't be hard to explain, and any not-100%-clean design shouldn't get in the way of documenting it clearly and in a way that Lisp programs could use, including elimination of passive tense. So I don't agree with the need to introduce two separate new variables. The downsides of such a split aren't justified by the minor conceptual problems you mention. I added Martin, who made this change back in Emacs 27, to the discussion, in the hope that he could comment on the issue.