From unknown Mon Jun 23 04:10:42 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#26624 <26624@debbugs.gnu.org> To: bug#26624 <26624@debbugs.gnu.org> Subject: Status: 26.0.50; Generalized variable `buffer-local-value' does't restore local flag Reply-To: bug#26624 <26624@debbugs.gnu.org> Date: Mon, 23 Jun 2025 11:10:42 +0000 retitle 26624 26.0.50; Generalized variable `buffer-local-value' does't res= tore local flag reassign 26624 emacs submitter 26624 Philipp Stephani
Philipp Stephani <p.stephani2@gmail.com> writes:<= br>
> It's possible to fix this (see attached patch), but at the expense= of
> breaking other valid use cases such as (cl-incf (buffer-local-value
> ...)). Not sure whether the bug can be fixed at all without breaking > other stuff.
I have no solution, but some thoughts.
The more I think about it, the more I come to the conclusion that
`buffer-local-value' does not have a well defined according place.
The function `buffer-local-value' is not injective: it maps different states to the same value because it can't express whether the VARIABLE&= #39;s
binding is buffer-local or not.=C2=A0 But we need this information because = we
need to undo creating a buffer local binding in the setter when closing
the `letf'.
And the setter, accepting only a value for the binding, isn't
surjective, because the argument doesn't hold any information of
buffer-localness.=C2=A0 Moreover, we want the setter to always create a
buffer-local binding in one situation (setf), but this isn't true for the setter we need to use for `cl-letf'.
We could widen the semantics of `cl-letf' to do what we want in this
case, but I'm not sure if it's worth the trouble.=C2=A0 Not if ther= e are more
cases like this.
Philipp = Stephani <p.s= tephani2@gmail.com> writes:
> It's possible to fix this (see attached patch), but at the expense= of
> breaking other valid use cases such as (cl-incf (buffer-local-value
> ...)). Not sure whether the bug can be fixed at all without breaking > other stuff.
I have no solution, but some thoughts.
The more I think about it, the more I come to the conclusion that
`buffer-local-value' does not have a well defined according place.
The function `buffer-local-value' is not injective: it maps different states to the same value because it can't express whether the VARIABLE&= #39;s
binding is buffer-local or not.=C2=A0 But we need this information because = we
need to undo creating a buffer local binding in the setter when closing
the `letf'.
And the setter, accepting only a value for the binding, isn't
surjective, because the argument doesn't hold any information of
buffer-localness.=C2=A0 Moreover, we want the setter to always create a
buffer-local binding in one situation (setf), but this isn't true for the setter we need to use for `cl-letf'.
We could widen the semantics of `cl-letf' to do what we want in this
case, but I'm not sure if it's worth the trouble.=C2=A0 Not if ther= e are more
cases like this.
Philipp Stephani <p.stephani2@gmail.com>= writes:
> * lisp/emacs-lisp/gv.el (buffer-local-value): Remove.
Is it possible to just give an obsolete warning first?
> From: Noam Postavsky <npostavs@users.sourceforge.net>
> Date: Sun, 24 Sep 2017 13:43:20 -0400
> Cc: Michael Heerdegen <michael_heerdegen@web.de>, 26624@debbugs.gnu.org
>
> Philipp Stephani <p.stephani2@gmail.com> writes:
>
> > Noam Postavsky <npostavs@users.sourceforge.net> schrieb am So.= , 24.
> > Sep. 2017 um 17:44=C2=A0Uhr:
> >
> >=C2=A0 =C2=A0 =C2=A0Philipp Stephani <p.stephani2@gmail.com> writes:
> >
> >=C2=A0 =C2=A0 =C2=A0> * lisp/emacs-lisp/gv.el (buffer-local-val= ue): Remove.
> >
> >=C2=A0 =C2=A0 =C2=A0Is it possible to just give an obsolete warnin= g first?
> >
> >
> > I don't think it's possible in the sense of `make-obsolet= e' because
> > the expander is not a named function.
> > It would be possible to use `display-warning' within the body= of the
> > setter, but that would only annoy users.
> > If necessary, we might add additional code to the `setf' macr= o to
> > warn about this form in particular during byte compilation.
>
> IMO, a compilation warning would be appropriate.
I agree.=C2=A0 Removing some feature without due warning is not something we should do, except in very rare cases (which this one isn't).I fully agree, but I don't know how to cor= rectly deprecate a generalized variable. Should I add code to the byte comp= iler to deal with this case explicitly?=C2=A0=C2=A0