From: Spencer Baugh <sbaugh@catern.com>
To: emacs-devel@gnu.org
Cc: Spencer Baugh <sbaugh@catern.com>, Eli Zaretskii <eliz@gnu.org>,
Stefan Monnier <monnier@iro.umontreal.ca>
Subject: [PATCH 1/7] Add a test for let-binding unwinding
Date: Tue, 23 Mar 2021 23:11:51 -0400 [thread overview]
Message-ID: <b8630f7040fb770328cb00cddd7714f776da4aab.1616554376.git.sbaugh@catern.com> (raw)
In-Reply-To: <cover.1616554376.git.sbaugh@catern.com>
Bindings in other buffers are not un-set when we unwind a let-binding
which set the default value. There doesn't seem to be an existing
test which covers this, so here's one.
* test/src/data-tests.el (data-tests--let-buffer-local-no-unwind-other-buffers):
Add test for let-binding unwinding behavior
---
test/src/data-tests.el | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/test/src/data-tests.el b/test/src/data-tests.el
index 03d867f18a..d0cb87293f 100644
--- a/test/src/data-tests.el
+++ b/test/src/data-tests.el
@@ -364,6 +364,28 @@ comparing the subr with a much slower lisp implementation."
(should (equal (default-value var) (symbol-value var))))
(should (equal (default-value var) def))))))
+(ert-deftest data-tests--let-buffer-local-no-unwind-other-buffers ()
+ "Test that a let-binding for a buffer-local unwinds only current-buffer."
+ (let ((blvar (make-symbol "blvar")))
+ (set-default blvar 0)
+ (make-variable-buffer-local blvar)
+ (dolist (var (list blvar 'left-margin))
+ (let* ((def (default-value var))
+ (newdef (+ def 1))
+ (otherbuf (generate-new-buffer "otherbuf")))
+ (with-temp-buffer
+ (cl-progv (list var) (list newdef)
+ (with-current-buffer otherbuf
+ (set var 123)
+ (should (local-variable-p var))
+ (should (equal (symbol-value var) 123))
+ (should (equal (default-value var) newdef))))
+ (with-current-buffer otherbuf
+ (should (local-variable-p var))
+ (should (equal (symbol-value var) 123))
+ (should (equal (default-value var) def)))
+ )))))
+
(ert-deftest binding-test-makunbound ()
"Tests of makunbound, from the manual."
(with-current-buffer binding-test-buffer-B
--
2.28.0
next prev parent reply other threads:[~2021-03-24 3:11 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-24 3:11 [PATCH 0/7] Cleanups and tests for DEFVAR_PER_BUFFER variables Spencer Baugh
2021-03-24 3:11 ` Spencer Baugh [this message]
2021-03-24 3:11 ` [PATCH 2/7] Assert not local-variable-p after setq in let_default binding Spencer Baugh
2021-03-24 3:11 ` [PATCH 3/7] Stop checking the constant default for enable_multibyte_characters Spencer Baugh
2021-03-24 3:11 ` [PATCH 4/7] Take buffer field name in DEFVAR_PER_BUFFER Spencer Baugh
2021-03-24 3:11 ` [PATCH 5/7] Combine unnecessarily separate loops in buffer.c Spencer Baugh
2021-03-24 3:11 ` [PATCH 6/7] Assert that PER_BUFFER_IDX for Lisp variables is not 0 Spencer Baugh
2021-03-24 3:11 ` [PATCH 7/7] Remove unnecessary Qunbound check Spencer Baugh
2021-03-25 16:46 ` Stefan Monnier
2021-03-24 5:36 ` [PATCH 0/7] Cleanups and tests for DEFVAR_PER_BUFFER variables Eli Zaretskii
2021-03-25 16:48 ` Stefan Monnier
2021-03-25 17:00 ` Eli Zaretskii
2021-04-01 18:13 ` Spencer Baugh
2021-04-01 18:51 ` Eli Zaretskii
2021-04-03 20:53 ` Spencer Baugh
2021-04-04 7:15 ` Eli Zaretskii
2021-04-01 21:42 ` Stefan Monnier
2021-04-01 23:39 ` Spencer Baugh
2021-04-02 2:55 ` Stefan Monnier
2021-04-02 5:36 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b8630f7040fb770328cb00cddd7714f776da4aab.1616554376.git.sbaugh@catern.com \
--to=sbaugh@catern.com \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=monnier@iro.umontreal.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).