* Re: master b2e6e95581: Only reset buffer-local buffer-stale-function in make-indirect-buffer
[not found] ` <20220711140833.3343AC0D772@vcs2.savannah.gnu.org>
@ 2022-07-11 15:59 ` Stefan Monnier
2022-07-11 17:20 ` Eli Zaretskii
2022-07-12 12:38 ` Lars Ingebrigtsen
0 siblings, 2 replies; 6+ messages in thread
From: Stefan Monnier @ 2022-07-11 15:59 UTC (permalink / raw)
To: emacs-devel; +Cc: Lars Ingebrigtsen
> + if (!NILP (Flocal_variable_p (Qbuffer_stale_function, base_buffer)))
> + Fset (Qbuffer_stale_function, Qbuffer_stale__default_function);
Shouldn't this use `kill-local-variable` instead or something like that?
Stefan
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: master b2e6e95581: Only reset buffer-local buffer-stale-function in make-indirect-buffer
2022-07-11 15:59 ` master b2e6e95581: Only reset buffer-local buffer-stale-function in make-indirect-buffer Stefan Monnier
@ 2022-07-11 17:20 ` Eli Zaretskii
2022-07-11 17:49 ` Eli Zaretskii
2022-07-12 12:38 ` Lars Ingebrigtsen
1 sibling, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2022-07-11 17:20 UTC (permalink / raw)
To: Stefan Monnier; +Cc: emacs-devel, larsi
> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Cc: Lars Ingebrigtsen <larsi@gnus.org>
> Date: Mon, 11 Jul 2022 11:59:20 -0400
>
> > + if (!NILP (Flocal_variable_p (Qbuffer_stale_function, base_buffer)))
> > + Fset (Qbuffer_stale_function, Qbuffer_stale__default_function);
>
> Shouldn't this use `kill-local-variable` instead or something like that?
I'm also not sure it is wise not to use nil here, since
buffer-stale--default-function is only defined when files.el is
loaded, so this could cause trouble during bootstrap (if not now, then
in some distant future). At least Ffboundp test is in order, I think.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: master b2e6e95581: Only reset buffer-local buffer-stale-function in make-indirect-buffer
2022-07-11 17:20 ` Eli Zaretskii
@ 2022-07-11 17:49 ` Eli Zaretskii
0 siblings, 0 replies; 6+ messages in thread
From: Eli Zaretskii @ 2022-07-11 17:49 UTC (permalink / raw)
To: monnier, larsi; +Cc: emacs-devel
> Date: Mon, 11 Jul 2022 20:20:31 +0300
> From: Eli Zaretskii <eliz@gnu.org>
> Cc: emacs-devel@gnu.org, larsi@gnus.org
>
> > > + if (!NILP (Flocal_variable_p (Qbuffer_stale_function, base_buffer)))
> > > + Fset (Qbuffer_stale_function, Qbuffer_stale__default_function);
> >
> > Shouldn't this use `kill-local-variable` instead or something like that?
>
> I'm also not sure it is wise not to use nil here, since
> buffer-stale--default-function is only defined when files.el is
> loaded, so this could cause trouble during bootstrap (if not now, then
> in some distant future). At least Ffboundp test is in order, I think.
Come to think of this: why do we test that the variable is
buffer-local? This is in make-indirect-buffer, where the buffer was
not yet "released" into the world, so how come it could have this
variable as buffer-local already?
I think the code should instead _force_ the variable to be
buffer-local, _and_ unconditionally set its buffer-local value to nil.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: master b2e6e95581: Only reset buffer-local buffer-stale-function in make-indirect-buffer
2022-07-11 15:59 ` master b2e6e95581: Only reset buffer-local buffer-stale-function in make-indirect-buffer Stefan Monnier
2022-07-11 17:20 ` Eli Zaretskii
@ 2022-07-12 12:38 ` Lars Ingebrigtsen
2022-07-12 13:42 ` Eli Zaretskii
1 sibling, 1 reply; 6+ messages in thread
From: Lars Ingebrigtsen @ 2022-07-12 12:38 UTC (permalink / raw)
To: Stefan Monnier; +Cc: emacs-devel
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> + if (!NILP (Flocal_variable_p (Qbuffer_stale_function, base_buffer)))
>> + Fset (Qbuffer_stale_function, Qbuffer_stale__default_function);
>
> Shouldn't this use `kill-local-variable` instead or something like that?
Yup; now adjusted.
Eli Zaretskii <eliz@gnu.org> writes:
> I'm also not sure it is wise not to use nil here, since
> buffer-stale--default-function is only defined when files.el is
> loaded, so this could cause trouble during bootstrap (if not now, then
> in some distant future). At least Ffboundp test is in order, I think.
nil is documented to be a legacy value, so it shouldn't be used.
Eli Zaretskii <eliz@gnu.org> writes:
> Come to think of this: why do we test that the variable is
> buffer-local? This is in make-indirect-buffer, where the buffer was
> not yet "released" into the world, so how come it could have this
> variable as buffer-local already?
clone_per_buffer_values copies the local variables from the base buffer.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: master b2e6e95581: Only reset buffer-local buffer-stale-function in make-indirect-buffer
2022-07-12 12:38 ` Lars Ingebrigtsen
@ 2022-07-12 13:42 ` Eli Zaretskii
2022-07-12 13:53 ` Lars Ingebrigtsen
0 siblings, 1 reply; 6+ messages in thread
From: Eli Zaretskii @ 2022-07-12 13:42 UTC (permalink / raw)
To: Lars Ingebrigtsen; +Cc: monnier, emacs-devel
> From: Lars Ingebrigtsen <larsi@gnus.org>
> Cc: emacs-devel@gnu.org
> Date: Tue, 12 Jul 2022 14:38:53 +0200
>
> Eli Zaretskii <eliz@gnu.org> writes:
>
> > I'm also not sure it is wise not to use nil here, since
> > buffer-stale--default-function is only defined when files.el is
> > loaded, so this could cause trouble during bootstrap (if not now, then
> > in some distant future). At least Ffboundp test is in order, I think.
>
> nil is documented to be a legacy value, so it shouldn't be used.
What about the scenario I presented, where
buffer-stale--default-function is not yet known?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: master b2e6e95581: Only reset buffer-local buffer-stale-function in make-indirect-buffer
2022-07-12 13:42 ` Eli Zaretskii
@ 2022-07-12 13:53 ` Lars Ingebrigtsen
0 siblings, 0 replies; 6+ messages in thread
From: Lars Ingebrigtsen @ 2022-07-12 13:53 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: monnier, emacs-devel
Eli Zaretskii <eliz@gnu.org> writes:
>> nil is documented to be a legacy value, so it shouldn't be used.
>
> What about the scenario I presented, where
> buffer-stale--default-function is not yet known?
I pushed Stefan's suggested fix, which just calls kill-local-variable,
which should to the right thing in any case.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-07-12 13:53 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <165754851290.3031.9159264035427641051@vcs2.savannah.gnu.org>
[not found] ` <20220711140833.3343AC0D772@vcs2.savannah.gnu.org>
2022-07-11 15:59 ` master b2e6e95581: Only reset buffer-local buffer-stale-function in make-indirect-buffer Stefan Monnier
2022-07-11 17:20 ` Eli Zaretskii
2022-07-11 17:49 ` Eli Zaretskii
2022-07-12 12:38 ` Lars Ingebrigtsen
2022-07-12 13:42 ` Eli Zaretskii
2022-07-12 13:53 ` Lars Ingebrigtsen
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).