In *scratch*, evaluate:
(defvar foo-test-var nil)
(with-temp-buffer
=C2=A0 (list (list (buffer-local-value 'foo-test-var (current-buffer))<=
br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (local-variable-p 'foo=
-test-var)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (local-variable-if-set-p &=
#39;foo-test-var))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (cl-letf (((buffer-local-value 'foo-test-va=
r (current-buffer)) 123))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (list (buffer-local-value 'foo-test-=
var (current-buffer))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (local-variable-p &=
#39;foo-test-var)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (local-variable-if-=
set-p 'foo-test-var)))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 (list (buffer-local-value 'foo-test-var (cu=
rrent-buffer))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (local-variable-p 'foo=
-test-var)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (local-variable-if-set-p &=
#39;foo-test-var))))
The result is:
((nil nil nil) (123 t t) (nil t t))
But expected is:
((nil nil nil) (123 t t) (nil nil nil))
i.e. the local flag of the variable should be reset.
It's possible to fix this (see attache=
d 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 al=
l without breaking other stuff.=C2=A0