GNU bug report logs - #51930
27.2; Buffer-local functions? Buffers specified buffer-locally?

Previous Next

Package: emacs;

Reported by: Drew Adams <drew.adams <at> oracle.com>

Date: Wed, 17 Nov 2021 21:52:01 UTC

Severity: minor

Found in version 27.2

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 51930 in the body.
You can then email your comments to 51930 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#51930; Package emacs. (Wed, 17 Nov 2021 21:52:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Drew Adams <drew.adams <at> oracle.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 17 Nov 2021 21:52:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: "bug-gnu-emacs <at> gnu.org" <bug-gnu-emacs <at> gnu.org>
Subject: 27.2; Buffer-local functions? Buffers specified buffer-locally?
Date: Wed, 17 Nov 2021 21:51:29 +0000
I'm trying to read (elisp) `Window Hooks', and I can't make heads or
tails of it.  Throughout this node there's mention of buffer-local
functions: "functions specified buffer-locally".

I have no idea what is meant by this.  I search the Elisp manual for
buffer-local, and I find zillions of matches that are about
buffer-local variables, of course.  And I find a couple of mentions
of buffer-local faces.  No mention, that I can find, of buffer-local
functions or "functions specified buffer-locally".  How to specify a
function buffer-locally?

A wild guess is that what you're trying to say has something to do
with using the LOCAL argument to `add-hook' or `remove-hook`.  But
if so, it's not clear what.

Please clean up this text so it's comprehensible by an average reader.
If buffer-local functions are indeed a thing now, please document what
they are, somewhere.

In GNU Emacs 27.2 (build 1, x86_64-w64-mingw32)
 of 2021-03-26 built on CIRROCUMULUS
Repository revision: deef5efafb70f4b171265b896505b92b6eef24e6
Repository branch: HEAD
Windowing system distributor 'Microsoft Corp.', version 10.0.19042
System Description: Microsoft Windows 10 Pro (v10.0.2009.19042.1288)





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#51930; Package emacs. (Thu, 18 Nov 2021 08:28:01 GMT) Full text and rfc822 format available.

Message #8 received at 51930 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: 51930 <at> debbugs.gnu.org
Subject: Re: bug#51930: 27.2;
 Buffer-local functions? Buffers specified buffer-locally?
Date: Thu, 18 Nov 2021 10:27:10 +0200
> From: Drew Adams <drew.adams <at> oracle.com>
> Date: Wed, 17 Nov 2021 21:51:29 +0000
> 
> I'm trying to read (elisp) `Window Hooks', and I can't make heads or
> tails of it.  Throughout this node there's mention of buffer-local
> functions: "functions specified buffer-locally".
> 
> I have no idea what is meant by this.  I search the Elisp manual for
> buffer-local, and I find zillions of matches that are about
> buffer-local variables, of course.  And I find a couple of mentions
> of buffer-local faces.  No mention, that I can find, of buffer-local
> functions or "functions specified buffer-locally".  How to specify a
> function buffer-locally?
> 
> A wild guess is that what you're trying to say has something to do
> with using the LOCAL argument to `add-hook' or `remove-hook`.  But
> if so, it's not clear what.
> 
> Please clean up this text so it's comprehensible by an average reader.
> If buffer-local functions are indeed a thing now, please document what
> they are, somewhere.

This is a very dramatic description of a problem ("can't make heads or
tails", "I have no idea what is meant", etc.), so I'm not sure whether
a simple cross-reference to the documentation of add-hook, which
explains what is meant by "buffer-local" in this case, will solve the
problem.  If it will, doing that is very easy.  In fact, I just did.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#51930; Package emacs. (Thu, 18 Nov 2021 09:43:01 GMT) Full text and rfc822 format available.

Message #11 received at 51930 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 51930 <at> debbugs.gnu.org, Drew Adams <drew.adams <at> oracle.com>
Subject: Re: bug#51930: 27.2; Buffer-local functions? Buffers specified
 buffer-locally?
Date: Thu, 18 Nov 2021 10:42:13 +0100
Eli Zaretskii <eliz <at> gnu.org> writes:

> This is a very dramatic description of a problem ("can't make heads or
> tails", "I have no idea what is meant", etc.), so I'm not sure whether
> a simple cross-reference to the documentation of add-hook, which
> explains what is meant by "buffer-local" in this case, will solve the
> problem.  If it will, doing that is very easy.  In fact, I just did.

I think "Functions specified buffer-locally" is an unusual way to say
"the buffer-local value of window-buffer-change-functions" -- if indeed
that's what it's trying to say.  I think rewriting this in a less
passive voice would be a good idea:

---
Functions specified buffer-locally are called for any window showing
the corresponding buffer if that window has been created or assigned
that buffer since the last time window change functions were run.  In
this case the window is passed as argument.

Functions specified by the default value are called for a frame if at
least one window on that frame has been added, deleted or assigned
another buffer since the last time window change functions were run.
In this case the frame is passed as argument.
---


-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#51930; Package emacs. (Thu, 18 Nov 2021 11:13:01 GMT) Full text and rfc822 format available.

Message #14 received at 51930 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 51930 <at> debbugs.gnu.org, drew.adams <at> oracle.com
Subject: Re: bug#51930: 27.2; Buffer-local functions? Buffers specified
 buffer-locally?
Date: Thu, 18 Nov 2021 13:12:40 +0200
> From: Lars Ingebrigtsen <larsi <at> gnus.org>
> Cc: Drew Adams <drew.adams <at> oracle.com>,  51930 <at> debbugs.gnu.org
> Date: Thu, 18 Nov 2021 10:42:13 +0100
> 
> I think "Functions specified buffer-locally" is an unusual way to say
> "the buffer-local value of window-buffer-change-functions" -- if indeed
> that's what it's trying to say.  I think rewriting this in a less
> passive voice would be a good idea:

I didn't touch that text, I added a general explanation before it.  I
didn't understand the report as being against the passive tense there.
Of course, everyone should feel free to improve and/or clarify the
text in the manual, regardless.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#51930; Package emacs. (Thu, 18 Nov 2021 17:13:02 GMT) Full text and rfc822 format available.

Message #17 received at 51930 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>, Eli Zaretskii <eliz <at> gnu.org>
Cc: "51930 <at> debbugs.gnu.org" <51930 <at> debbugs.gnu.org>
Subject: RE: [External] : Re: bug#51930: 27.2; Buffer-local functions? Buffers
 specified buffer-locally?
Date: Thu, 18 Nov 2021 17:12:53 +0000
> I think "Functions specified buffer-locally" is an unusual way to say
> "the buffer-local value of window-buffer-change-functions"

To put it mildly.  And it _doesn't_ say that,
at all.  There's no way to legitimately read
it as saying that.

> -- if indeed that's what it's trying to say.

Yes.  It's a question any reader will pose:
What is it trying to say?

> I think rewriting this in a less passive voice
> would be a good idea:
> 
> ---
> Functions specified buffer-locally

That has the same problem.  A reader asks,
What are they trying to say?  What does it
mean for a _function_ to be specified
buffer-locally?  Means nothing, so far.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#51930; Package emacs. (Tue, 20 Sep 2022 15:24:02 GMT) Full text and rfc822 format available.

Message #20 received at 51930 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 51930 <at> debbugs.gnu.org, Drew Adams <drew.adams <at> oracle.com>
Subject: Re: bug#51930: 27.2; Buffer-local functions? Buffers specified
 buffer-locally?
Date: Tue, 20 Sep 2022 17:23:05 +0200
Eli Zaretskii <eliz <at> gnu.org> writes:

> This is a very dramatic description of a problem ("can't make heads or
> tails", "I have no idea what is meant", etc.), so I'm not sure whether
> a simple cross-reference to the documentation of add-hook, which
> explains what is meant by "buffer-local" in this case, will solve the
> problem.  If it will, doing that is very easy.  In fact, I just did.

I think the section is clear after that clarification, so I'm closing
this bug report.




bug closed, send any further explanations to 51930 <at> debbugs.gnu.org and Drew Adams <drew.adams <at> oracle.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Tue, 20 Sep 2022 15:24:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#51930; Package emacs. (Tue, 20 Sep 2022 15:59:02 GMT) Full text and rfc822 format available.

Message #25 received at 51930 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>, Eli Zaretskii <eliz <at> gnu.org>
Cc: "51930 <at> debbugs.gnu.org" <51930 <at> debbugs.gnu.org>
Subject: RE: [External] : Re: bug#51930: 27.2; Buffer-local functions? Buffers
 specified buffer-locally?
Date: Tue, 20 Sep 2022 15:58:25 +0000
> > This is a very dramatic description of a problem ("can't make heads or
> > tails", "I have no idea what is meant", etc.), so I'm not sure whether
> > a simple cross-reference to the documentation of add-hook, which
> > explains what is meant by "buffer-local" in this case, will solve the
> > problem.  If it will, doing that is very easy.  In fact, I just did.
> 
> I think the section is clear after that clarification, so I'm closing
> this bug report.

Nope, it's not clear.  The doc of `add-hook' does
not at all talk about buffer-local functions.  It
talks about buffer-local hooks and a buffer-local
hook list.  A buffer-local function is neither
defined nor described anywhere.

If what is meant is the use of the function on
a hook buffer-locally, then say that.  Don't imply
that there's such a thing, defined anywhere, as
a buffer-local function.  Or else define it
somewhere.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#51930; Package emacs. (Tue, 20 Sep 2022 16:19:02 GMT) Full text and rfc822 format available.

Message #28 received at 51930 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: 51930 <at> debbugs.gnu.org, larsi <at> gnus.org
Subject: Re: [External] : Re: bug#51930: 27.2; Buffer-local functions? Buffers
 specified buffer-locally?
Date: Tue, 20 Sep 2022 19:18:02 +0300
> From: Drew Adams <drew.adams <at> oracle.com>
> CC: "51930 <at> debbugs.gnu.org" <51930 <at> debbugs.gnu.org>
> Date: Tue, 20 Sep 2022 15:58:25 +0000
> 
> > I think the section is clear after that clarification, so I'm closing
> > this bug report.
> 
> Nope, it's not clear.  The doc of `add-hook' does
> not at all talk about buffer-local functions.

What are "buffer-local functions"?  I'm not aware of such a feature in
Emacs.  The documentation of add-hook doesn't mention any
"buffer-local functions".

The node "Windows Hooks" uses the phrase "Functions specified
buffer-locally", after it explains that hooks can have buffer-local or
global values.  I see no problem with that.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#51930; Package emacs. (Tue, 20 Sep 2022 16:38:02 GMT) Full text and rfc822 format available.

Message #31 received at 51930 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: "51930 <at> debbugs.gnu.org" <51930 <at> debbugs.gnu.org>,
 "larsi <at> gnus.org" <larsi <at> gnus.org>
Subject: RE: [External] : Re: bug#51930: 27.2; Buffer-local functions? Buffers
 specified buffer-locally?
Date: Tue, 20 Sep 2022 16:37:15 +0000
> > > I think the section is clear after that clarification, so I'm closing
> > > this bug report.
> >
> > Nope, it's not clear.  The doc of `add-hook' does
> > not at all talk about buffer-local functions.
> 
> What are "buffer-local functions"?  I'm not aware of such a feature in
> Emacs.  The documentation of add-hook doesn't mention any
> "buffer-local functions".

We agree.  It's defined nowhere, AFAICT.  That's
the point of the bug report.

> The node "Windows Hooks" uses the phrase "Functions specified
> buffer-locally", after it explains that hooks can have buffer-local or
> global values.  I see no problem with that.

Is that the node you've linked to?  I thought
you linked to node `Setting Hooks', where
`add-hook' is covered.  (I think you said you
linked to where `add-hook' is covered?)

FWIW, I don't see any node "Windows Hooks" in
Emacs 28.1 or earlier.  Presumably that was
added later - 28.2 or 29?

However, does that node define/explain what
it _means_ for a _function_ to be "specified
buffer-locally"?  Is it just about functions
on hooks, and is it just that a "function
specified buffer-locally" _is_ (the use of)
a function on a buffer-local hook?

100% agreement that it's clear that _hooks_
(which are variables) can be buffer-local.

It sounds like maybe we're agreeing?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#51930; Package emacs. (Tue, 20 Sep 2022 16:48:02 GMT) Full text and rfc822 format available.

Message #34 received at 51930 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: 51930 <at> debbugs.gnu.org, larsi <at> gnus.org
Subject: Re: [External] : Re: bug#51930: 27.2; Buffer-local functions? Buffers
 specified buffer-locally?
Date: Tue, 20 Sep 2022 19:47:35 +0300
> From: Drew Adams <drew.adams <at> oracle.com>
> CC: "larsi <at> gnus.org" <larsi <at> gnus.org>,
>         "51930 <at> debbugs.gnu.org"
> 	<51930 <at> debbugs.gnu.org>
> Date: Tue, 20 Sep 2022 16:37:15 +0000
> 
> > The node "Windows Hooks" uses the phrase "Functions specified
> > buffer-locally", after it explains that hooks can have buffer-local or
> > global values.  I see no problem with that.
> 
> Is that the node you've linked to?  I thought
> you linked to node `Setting Hooks', where
> `add-hook' is covered.  (I think you said you
> linked to where `add-hook' is covered?)

I looked in both.

> FWIW, I don't see any node "Windows Hooks" in

"Window Hooks", without "s".

> However, does that node define/explain what
> it _means_ for a _function_ to be "specified
> buffer-locally"?

I think it does, yes.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#51930; Package emacs. (Tue, 20 Sep 2022 18:12:02 GMT) Full text and rfc822 format available.

Message #37 received at 51930 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: "51930 <at> debbugs.gnu.org" <51930 <at> debbugs.gnu.org>,
 "larsi <at> gnus.org" <larsi <at> gnus.org>
Subject: RE: [External] : Re: bug#51930: 27.2; Buffer-local functions? Buffers
 specified buffer-locally?
Date: Tue, 20 Sep 2022 18:11:42 +0000
> > > The node "Windows Hooks" uses the phrase "Functions specified
> > > buffer-locally", after it explains that hooks can have buffer-local
> > > or global values.  I see no problem with that.
> >
> > Is that the node you've linked to?  I thought
> > you linked to node `Setting Hooks', where
> > `add-hook' is covered.  (I think you said you
> > linked to where `add-hook' is covered?)
> 
> I looked in both.
> 
> > FWIW, I don't see any node "Windows Hooks" in
> 
> "Window Hooks", without "s".

Thanks; I see that now (e.g. in Emacs 28.1).

BTW, there's a typo here; "of" should be "or":

 As any hook, these hooks can be set either globally
 of buffer-locally via the LOCAL argument of 'add-hook'
 ^^
 (*note Setting Hooks::) when the hook is installed.

> > However, does that node define/explain what
> > it _means_ for a _function_ to be "specified
> > buffer-locally"?
> 
> I think it does, yes.

I don't think so, FWIW.  One might _guess_ that it
means that, when used on a buffer-local hook the	
function _is_ a buffer-local function, IOW, guess
that that's the definition of a buffer-local
function.  But that's not said, AFAICT.  Please
consider adding such a definition.  (But should
such a general definition be in a node about only
_window_ hooks?)

FWIW, I see nothing (in 18.1) in node `Setting
Hooks' that mentions buffer-local functions.  All
I see mention of there is buffer-local hooks.
(That doesn't mean there shouldn't be a link to
that node -- the link is good.)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#51930; Package emacs. (Wed, 21 Sep 2022 00:14:01 GMT) Full text and rfc822 format available.

Message #40 received at 51930 <at> debbugs.gnu.org (full text, mbox):

From: Phil Sainty <psainty <at> orcon.net.nz>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: 51930 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>, larsi <at> gnus.org
Subject: Re: bug#51930: 27.2; Buffer-local functions? Buffers specified buffer-locally?
Date: Wed, 21 Sep 2022 12:13:05 +1200
The pattern I see in the manual is:

 -- Variable: HOOK-NAME
     This variable specifies functions ...

     Functions specified buffer-locally are called ...

     Functions specified by the default value are called ...


So there's a minor inconsistency in phrasing there.  How about we
change all of these like so:

     Functions specified by the buffer-local value are called ...

     Functions specified by the default value are called ...


Then it's consistent, and I think also resolves Drew's concern?


-Phil





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#51930; Package emacs. (Wed, 21 Sep 2022 01:28:02 GMT) Full text and rfc822 format available.

Message #43 received at 51930 <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: Phil Sainty <psainty <at> orcon.net.nz>
Cc: "51930 <at> debbugs.gnu.org" <51930 <at> debbugs.gnu.org>,
 Eli Zaretskii <eliz <at> gnu.org>, "larsi <at> gnus.org" <larsi <at> gnus.org>
Subject: RE: [External] : Re: bug#51930: 27.2; Buffer-local functions? Buffers
 specified buffer-locally?
Date: Wed, 21 Sep 2022 01:27:15 +0000
>       Functions specified buffer-locally are called ...
>       Functions specified by the default value are called ...
> 
> So there's a minor inconsistency in phrasing there.  How about we
> change all of these like so:
> 
>       Functions specified by the buffer-local value are called ...
>       Functions specified by the default value are called ...
> 
> Then it's consistent, and I think also resolves Drew's concern?

Works for me.  Thx.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#51930; Package emacs. (Wed, 21 Sep 2022 02:37:02 GMT) Full text and rfc822 format available.

Message #46 received at 51930 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Phil Sainty <psainty <at> orcon.net.nz>
Cc: 51930 <at> debbugs.gnu.org, larsi <at> gnus.org, drew.adams <at> oracle.com
Subject: Re: bug#51930: 27.2;
 Buffer-local functions? Buffers specified buffer-locally?
Date: Wed, 21 Sep 2022 05:36:55 +0300
> Date: Wed, 21 Sep 2022 12:13:05 +1200
> From: Phil Sainty <psainty <at> orcon.net.nz>
> Cc: Eli Zaretskii <eliz <at> gnu.org>, 51930 <at> debbugs.gnu.org, larsi <at> gnus.org
> 
> So there's a minor inconsistency in phrasing there.  How about we
> change all of these like so:
> 
>       Functions specified by the buffer-local value are called ...
> 
>       Functions specified by the default value are called ...

Double passive tense? no, thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#51930; Package emacs. (Wed, 21 Sep 2022 04:06:01 GMT) Full text and rfc822 format available.

Message #49 received at 51930 <at> debbugs.gnu.org (full text, mbox):

From: Phil Sainty <psainty <at> orcon.net.nz>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 51930 <at> debbugs.gnu.org, larsi <at> gnus.org, drew.adams <at> oracle.com
Subject: Re: bug#51930: 27.2; Buffer-local functions? Buffers specified buffer-locally?
Date: Wed, 21 Sep 2022 16:05:10 +1200
On 2022-09-21 14:36, Eli Zaretskii wrote:
>> From: Phil Sainty <psainty <at> orcon.net.nz>
>>       Functions specified by the buffer-local value are called ...
>>       Functions specified by the default value are called ...
> 
> Double passive tense? no, thanks.

Well one of those is what's already in the manual.

I personally disagree that the double passive tense is bad here,
but here's another alternative:


 -- Variable: window-buffer-change-functions

     A list of functions called during redisplay when window buffers
     have changed.  Each function takes a single argument.

     For the buffer-local value, each function is called for any window
     showing the corresponding buffer, if that window has been created
     or assigned that buffer since the last time window change functions
     were run.  In this case the window is passed as argument.

     For the default value, each function is called for a frame if at
     least one window on that frame has been added, deleted or assigned
     another buffer since the last time window change functions were
     run.  In this case the frame is passed as argument.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#51930; Package emacs. (Wed, 21 Sep 2022 06:22:02 GMT) Full text and rfc822 format available.

Message #52 received at 51930 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefankangas <at> gmail.com>
To: Phil Sainty <psainty <at> orcon.net.nz>, Eli Zaretskii <eliz <at> gnu.org>
Cc: 51930 <at> debbugs.gnu.org, larsi <at> gnus.org, drew.adams <at> oracle.com
Subject: Re: bug#51930: 27.2;
 Buffer-local functions? Buffers specified buffer-locally?
Date: Tue, 20 Sep 2022 23:21:42 -0700
Phil Sainty <psainty <at> orcon.net.nz> writes:

> I personally disagree that the double passive tense is bad here,
> but here's another alternative:

That alternative is indeed less clear than what you had before.

    "Never use the passive where you can use the active."
                           ^^^^^^^^^^^^^
    —George Orwell, "Politics and the English Language," April 1946

Note the qualifier.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#51930; Package emacs. (Thu, 22 Sep 2022 03:13:02 GMT) Full text and rfc822 format available.

Message #55 received at 51930 <at> debbugs.gnu.org (full text, mbox):

From: Richard Stallman <rms <at> gnu.org>
To: Phil Sainty <psainty <at> orcon.net.nz>
Cc: 51930 <at> debbugs.gnu.org, eliz <at> gnu.org, larsi <at> gnus.org, drew.adams <at> oracle.com
Subject: Re: bug#51930: 27.2;
 Buffer-local functions? Buffers specified buffer-locally?
Date: Wed, 21 Sep 2022 23:11:52 -0400
[[[ 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. ]]]

        > For the buffer-local value, each function is called for any window
        > showing the corresponding buffer, if that window has been created
        > or assigned that buffer since the last time window change functions
        > were run.  In this case the window is passed as argument.

        > For the default value, each function is called for a frame if at
        > least one window on that frame has been added, deleted or assigned
        > another buffer since the last time window change functions were
        > run.  In this case the frame is passed as argument.

It is always better to avoid the passive tense entirely, unless that
is difficult somehow.  I wanted to do this, to provide an example.
In the process I found a much worse problem: the text is not clear at all.
I don't understand the behavior it tries to document.

But I tried anyway, and documented what appears to be a bizarre use of
both the variable's default value and its current value, in different ways.

======================================================================
A list of functions for redisplay to call when the assignment of
buffers to windows has changed.  Each function takes a single
argument.

This variable is peculiar in that its default value has one meaning
and its actual value (normally buffer-local) has a different meaning.
Redisplay uses both of these values, each in a different way.

For the actual (buffer-local) value, redisplay calls each function
once for each window, with the window as argument, if that window has
been created or assigned that buffer since the last time the window
change functions were called.

For the default value, redisplay calls each function once for each
frame, with the frame as argument, if at least one window on that
frame has been added, deleted or assigned another buffer since the
last time window change functions were called.
======================================================================

However, looking at the doc string of the variable seems to describe
a different behavior, more like this:

======================================================================
A list of functions for redisplay to call when the assignment of
buffers to windows has changed.  Each function takes a single
argument.

Redisplay examines the global value of this variable, and calls each
function once for each frame, with the frame as argument, if at least
one window on that frame has been added, deleted or made to display a
different buffer since the last time window change functions were
called.

Redisplay also checks a buffer-local value of this variable in each
buffer that's currenly displayed in a window.  If there is one,
redisplay calls each function listed there for each window that
displays the buffer in question, with the window as argument,
@emph{if} the window has been created, or made to display that buffer,
since the last time the window change functions were called.
======================================================================

Is this correct?  I can't tell from the text available.


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






Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#51930; Package emacs. (Thu, 22 Sep 2022 06:55:01 GMT) Full text and rfc822 format available.

Message #58 received at 51930 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: rms <at> gnu.org, martin rudalics <rudalics <at> gmx.at>
Cc: psainty <at> orcon.net.nz, 51930 <at> debbugs.gnu.org, larsi <at> gnus.org,
 drew.adams <at> oracle.com
Subject: Re: bug#51930: 27.2;
 Buffer-local functions? Buffers specified buffer-locally?
Date: Thu, 22 Sep 2022 09:54:44 +0300
> From: Richard Stallman <rms <at> gnu.org>
> Cc: eliz <at> gnu.org, 51930 <at> debbugs.gnu.org, larsi <at> gnus.org,
> 	drew.adams <at> oracle.com
> Date: Wed, 21 Sep 2022 23:11:52 -0400
> 
> ======================================================================
> A list of functions for redisplay to call when the assignment of
> buffers to windows has changed.  Each function takes a single
> argument.
> 
> This variable is peculiar in that its default value has one meaning
> and its actual value (normally buffer-local) has a different meaning.
> Redisplay uses both of these values, each in a different way.
> 
> For the actual (buffer-local) value, redisplay calls each function
> once for each window, with the window as argument, if that window has
> been created or assigned that buffer since the last time the window
> change functions were called.
> 
> For the default value, redisplay calls each function once for each
> frame, with the frame as argument, if at least one window on that
> frame has been added, deleted or assigned another buffer since the
> last time window change functions were called.
> ======================================================================
> 
> However, looking at the doc string of the variable seems to describe
> a different behavior, more like this:
> 
> ======================================================================
> A list of functions for redisplay to call when the assignment of
> buffers to windows has changed.  Each function takes a single
> argument.
> 
> Redisplay examines the global value of this variable, and calls each
> function once for each frame, with the frame as argument, if at least
> one window on that frame has been added, deleted or made to display a
> different buffer since the last time window change functions were
> called.
> 
> Redisplay also checks a buffer-local value of this variable in each
> buffer that's currenly displayed in a window.  If there is one,
> redisplay calls each function listed there for each window that
> displays the buffer in question, with the window as argument,
> @emph{if} the window has been created, or made to display that buffer,
> since the last time the window change functions were called.
> ======================================================================
> 
> Is this correct?  I can't tell from the text available.

The manual is more correct: the code goes through windows and invokes
these functions for a window if its buffer has a non-nil buffer-local
value of the variable.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 20 Oct 2022 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 188 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.