From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Richard Stallman Newsgroups: gmane.emacs.devel Subject: window-buffer-change-functions Date: Wed, 21 Sep 2022 09:59:24 -0400 Message-ID: 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> Reply-To: rms@gnu.org Content-Type: text/plain; charset=Utf-8 Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="36898"; mail-complaints-to="usenet@ciao.gmane.io" To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Sep 21 16:08:04 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 1ob0OR-0009QB-TV for ged-emacs-devel@m.gmane-mx.org; Wed, 21 Sep 2022 16:08:04 +0200 Original-Received: from localhost ([::1]:47252 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ob0OQ-0003ee-QT for ged-emacs-devel@m.gmane-mx.org; Wed, 21 Sep 2022 10:08:02 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37790) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ob0G6-0004ce-W8 for emacs-devel@gnu.org; Wed, 21 Sep 2022 09:59:27 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:55304) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ob0G6-0003Sy-NH for emacs-devel@gnu.org; Wed, 21 Sep 2022 09:59:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=Date:References:Subject:In-Reply-To:to:From: mime-version; bh=+41DEq1GPkq6+Te4sDNGsTpGGPEV8XZ5XX/u3Fj6DOM=; b=CLTe5qCiWTly X0z8adI9U3K/3U+K4mEIFDOBtMm0VwpZNSEJsNIcGNZwloy4f4PNMmarNQU1pR4LurgKQVypkDput WegVOrz2T5FbcLafbqmg6SFoER0Bq8N9RTeBHBmFG3SNV53E17qZOYHnNXrSkzGvCtx3AwjyKuNbs iu1f9oAiMtbjdO0ytZfYHtiw9BoqiJSKzgO57lJ4zwocsDA8X9a3SSjpZG+R8IYJStvg99DSBJaI2 dKznoTWNsxQrdG/1nbeSOOj91M953jBxM5hmzrpHO9HoolyyVmLII6om2ALrRiWx1UgcbwDEt9Q2N nJrd/B4K8nhXBCDAdNYz/g==; Original-Received: from rms by fencepost.gnu.org with local (Exim 4.90_1) (envelope-from ) id 1ob0G4-0003JA-D6; Wed, 21 Sep 2022 09:59:24 -0400 In-Reply-To: <7110e0330e878c144a6364a8e6ad651c@webmail.orcon.net.nz> (message from Phil Sainty on Wed, 21 Sep 2022 16:05:10 +1200) 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:295913 Archived-At: [[[ To any NSA and FBI agents reading my email: please consider ]]] [[[ whether defending the US Constitution against all enemies, ]]] [[[ foreign or domestic, requires you to follow Snowden's example. ]]] 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'. `frame-buffer-change-functions' would do what is documented for the default value of `window-buffer-change-functions', and the `buffer-window-change-functions' would do the job documented for the buffer-local values. (If I understand that documention correctly.) We could retain `window-buffer-change-functions' for compatibility, marked obsolete, if it has existed with its current meaning for long enough to make that desirable. Or, if that variable used to be limited to frames, we could make `frame-buffer-change-functions' an alias for it. @defvar frame-buffer-change-functions A list of functions for redisplay to call to indicate changes in the displayed buffers in a frame. Each function should accept one argument, a frame. Redisplay, when necessary, calls each of these functions once for each frame, with the frame as argument, @emph{if} at least one window on that frame has been added, deleted or made to display a different buffer since the last time redisplay called these functions. @end defvar @defvar buffer-window-change-functions A list of functions for redisplay to call (when necessary) to indicate changes in the displayed buffers in a frame. Each function should accept one argument, a window. For each window, @emph{if} the window has been created, or made to display that buffer, since the last time redisplay called these functions, redisplay checks the value of this variable in the window's displayed buffer. That value should be a list of functions of one argument. Redisplay calls each function on the list, giving the window as argument. Most buffers don't need this special treatment, so normally programs will give `buffer-window-change-functions' a buffer-local value in those buffers that do need it. @end defvar This is still complicated, but much less so. Did I guess right about what the existing variable does? -- Dr Richard Stallman (https://stallman.org) Chief GNUisance of the GNU Project (https://gnu.org) Founder, Free Software Foundation (https://fsf.org) Internet Hall-of-Famer (https://internethalloffame.org)