bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#65209: 30.0.50; Unexpected behaviour of setq-local


From: Michael Heerdegen
Subject: bug#65209: 30.0.50; Unexpected behaviour of setq-local
Date: Mon, 14 Aug 2023 05:24:49 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <bug-gnu-emacs@gnu.org> writes:

> The patch below seems to work (for some reason, I'm getting several
> errors in `make check` today, but they seems unaffected by this patch
> (i.e. I get the same errors in a vanilla build)).

Thanks that you looked closer.  I've installed the patch locally and
will report back when I find any problem.

> +(defvar-local data-tests--bug65209 :default-value)
> +
> +(ert-deftest data-tests-make-local-bug65209 ()
> +  (let (vli vlo vgi vgo)
> +    (with-temp-buffer
> +      (let ((data-tests--bug65209 :let-bound-value))
> +        ;; While `setq' would not make the var buffer-local
> +        ;; (because we'd be setq-ing the let-binding instead),
> +        ;; `setq-local' definitely should.
> +        (setq-local data-tests--bug65209 :buffer-local-value)
> +        (setq vgi (with-temp-buffer data-tests--bug65209))
> +        (setq vli data-tests--bug65209))
> +      (setq vgo (with-temp-buffer data-tests--bug65209))
> +      (setq vlo data-tests--bug65209))
> +    (should (equal (list vli vlo vgi vgo)
> +                   '(:buffer-local-value :buffer-local-value
> +                     :let-bound-value :default-value)))))
> +

That would actually be a very good example for
(info "(elisp) Intro to Buffer-Local") if you replace vli, vlo, vgi, vgo
with non-abbreviating names.

Michael.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]