From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Spencer Baugh Newsgroups: gmane.emacs.devel Subject: [PATCH v2 01/16] Add a test for let-binding unwinding Date: Sat, 21 Nov 2020 21:34:30 -0500 Message-ID: References: <20201119153814.17541-1-sbaugh@catern.com> Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15851"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Spencer Baugh , Arnold Noronha , Stefan Monnier , Dmitry Gutov To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Nov 22 03:36:16 2020 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kgfEd-0003xq-VQ for ged-emacs-devel@m.gmane-mx.org; Sun, 22 Nov 2020 03:36:15 +0100 Original-Received: from localhost ([::1]:42356 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kgfEc-00023x-R7 for ged-emacs-devel@m.gmane-mx.org; Sat, 21 Nov 2020 21:36:14 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40874) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kgfDH-0000Ic-Vo for emacs-devel@gnu.org; Sat, 21 Nov 2020 21:34:52 -0500 Original-Received: from venus.catern.com ([68.183.49.163]:60102) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kgfDG-0007IW-Fj for emacs-devel@gnu.org; Sat, 21 Nov 2020 21:34:51 -0500 Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=98.7.229.235; helo=localhost; envelope-from=sbaugh@catern.com; receiver= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=catern.com; s=mail; t=1606012490; bh=DOjSqSPl0tOWGmkMhtNCtDpnsW3C4t50Xv/K/EtJSv8=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=UVC2S1Q5CLChlUqMk3uHs8BK3LFSzm1j09MnNTHx9JLHt0LWoWiEHgSzXYYgMIzs0 Al2Ma+x0O/cD4kdxj/EazmWmOVf4+8V/8IRE6zorDmAbD43D3C3JfHho1yjTuc0WSJ uyJEp0cC4F1MXipV3gPdUGujOdVzP40kEusKf7Jw= Original-Received: from localhost (cpe-98-7-229-235.nyc.res.rr.com [98.7.229.235]) by venus.catern.com (Postfix) with ESMTPSA id EB6962DDD95; Sun, 22 Nov 2020 02:34:49 +0000 (UTC) X-Mailer: git-send-email 2.28.0 In-Reply-To: Received-SPF: pass client-ip=68.183.49.163; envelope-from=sbaugh@catern.com; helo=venus.catern.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:259574 Archived-At: 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 | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/test/src/data-tests.el b/test/src/data-tests.el index 1312683c84..7e69b9c331 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