unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Richard Stallman <rms@gnu.org>
To: emacs-devel@gnu.org
Subject: window-buffer-change-functions
Date: Wed, 21 Sep 2022 09:59:24 -0400	[thread overview]
Message-ID: <E1ob0G4-0003JA-D6@fencepost.gnu.org> (raw)
In-Reply-To: <7110e0330e878c144a6364a8e6ad651c@webmail.orcon.net.nz> (message from Phil Sainty on Wed, 21 Sep 2022 16:05:10 +1200)

[[[ 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)





       reply	other threads:[~2022-09-21 13:59 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <SJ0PR10MB54886AFA7B33CF1E43E2E013F39A9@SJ0PR10MB5488.namprd10.prod.outlook.com>
     [not found] ` <83o86hyild.fsf@gnu.org>
     [not found]   ` <877d1ycbom.fsf@gnus.org>
     [not found]     ` <SJ0PR10MB548895C6693206D88C719E60F34C9@SJ0PR10MB5488.namprd10.prod.outlook.com>
     [not found]       ` <835yhivx39.fsf@gnu.org>
     [not found]         ` <SJ0PR10MB5488AA81BBFCC4B4CE2D31B4F34C9@SJ0PR10MB5488.namprd10.prod.outlook.com>
     [not found]           ` <83v8piuh5k.fsf@gnu.org>
     [not found]             ` <SJ0PR10MB54887366A66613D1189EC466F34C9@SJ0PR10MB5488.namprd10.prod.outlook.com>
     [not found]               ` <2f85eda92184de27e10572e6b2320885@webmail.orcon.net.nz>
     [not found]                 ` <83pmfpv4fs.fsf@gnu.org>
     [not found]                   ` <7110e0330e878c144a6364a8e6ad651c@webmail.orcon.net.nz>
2022-09-21 13:59                     ` Richard Stallman [this message]
2022-09-21 16:22                       ` [External] : window-buffer-change-functions Drew Adams
2022-09-22  6:21                       ` window-buffer-change-functions Eli Zaretskii
2022-09-22  9:44                         ` window-buffer-change-functions martin rudalics
2022-09-23  3:19                           ` window-buffer-change-functions Richard Stallman
2022-09-23  6:12                             ` window-buffer-change-functions Eli Zaretskii
2022-09-24  2:43                               ` window-buffer-change-functions Richard Stallman
2022-09-23 11:13                             ` window-buffer-change-functions Phil Sainty
2022-09-24  2:43                               ` window-buffer-change-functions Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E1ob0G4-0003JA-D6@fencepost.gnu.org \
    --to=rms@gnu.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).