From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Nick Helm Newsgroups: gmane.emacs.bugs Subject: bug#26892: 25.2; whitespace-mode does not turn off correctly Date: Mon, 15 May 2017 12:26:14 +1200 Message-ID: References: <837f1ma96f.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1494808033 22244 195.159.176.226 (15 May 2017 00:27:13 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 15 May 2017 00:27:13 +0000 (UTC) User-Agent: mu4e 0.9.18; emacs 25.2.1 To: <26892@debbugs.gnu.org> Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon May 15 02:27:09 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dA3qu-0005gz-Ub for geb-bug-gnu-emacs@m.gmane.org; Mon, 15 May 2017 02:27:09 +0200 Original-Received: from localhost ([::1]:34291 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dA3r0-0003D5-GM for geb-bug-gnu-emacs@m.gmane.org; Sun, 14 May 2017 20:27:14 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54578) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dA3qt-0003Cf-HA for bug-gnu-emacs@gnu.org; Sun, 14 May 2017 20:27:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dA3qo-0000Yn-Ks for bug-gnu-emacs@gnu.org; Sun, 14 May 2017 20:27:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:42528) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dA3qo-0000Ya-Gq for bug-gnu-emacs@gnu.org; Sun, 14 May 2017 20:27:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dA3qo-0007DQ-CL for bug-gnu-emacs@gnu.org; Sun, 14 May 2017 20:27:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Nick Helm Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 15 May 2017 00:27:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 26892 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 26892-submit@debbugs.gnu.org id=B26892.149480799727678 (code B ref 26892); Mon, 15 May 2017 00:27:02 +0000 Original-Received: (at 26892) by debbugs.gnu.org; 15 May 2017 00:26:37 +0000 Original-Received: from localhost ([127.0.0.1]:45205 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dA3qP-0007CM-0K for submit@debbugs.gnu.org; Sun, 14 May 2017 20:26:37 -0400 Original-Received: from mail-sy3aus01on0112.outbound.protection.outlook.com ([104.47.117.112]:30641 helo=AUS01-SY3-obe.outbound.protection.outlook.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dA3qM-0007C5-I5 for 26892@debbugs.gnu.org; Sun, 14 May 2017 20:26:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tenpointcomms.onmicrosoft.com; s=selector1-tenpoint-co-nz; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=D9QKxadRiSQmOKts+8+5fQ0FAtV7xTLxZ7EeShqpzHY=; b=CUJKnmxqQn+yBzkP/rzBIlXi3nO+UM4JUVJUWYdLJ/Adr1xzN/LjVeNSVt3se1K1C6IfHMCTmQXaCMlfPRzx2qBlB5ygzhjqDX0EoZ8bJSugBUd02piKSRE6xcMwBXViFSQdOV1ujq2lQ8UfWgvn04bv+wpftIWLZ50JX4WVxjU= Authentication-Results: gnu.org; dkim=none (message not signed) header.d=none; gnu.org; dmarc=none action=none header.from=tenpoint.co.nz; Original-Received: from jupiter.local (125.239.122.5) by SYXPR01MB0974.ausprd01.prod.outlook.com (10.169.178.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1084.16; Mon, 15 May 2017 00:26:19 +0000 In-Reply-To: <837f1ma96f.fsf@gnu.org> X-Originating-IP: [125.239.122.5] X-ClientProxiedBy: SYXPR01CA0117.ausprd01.prod.outlook.com (10.171.33.154) To SYXPR01MB0974.ausprd01.prod.outlook.com (10.169.178.20) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8b29b404-b3a5-4f34-a786-08d49b2901ee X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201703131423075); SRVR:SYXPR01MB0974; X-Microsoft-Exchange-Diagnostics: 1; SYXPR01MB0974; 3:9D4c1mQl1QgMdumkhTO0cVCHXbWTIGyGWosvfGbuO1Fvccc8e1tO1s789bOQKH1KPDy15+Q+TD+xlKEQuOZ24wWMemIohxfgm/r1TxKdTU5zKZCyTxWmD/65IvaAlzhLpLnGcjrFiWUcYpLmtYpSAdbY5aghFNWXbOMhMmzhYtox5llrbdDLvXni196epW2u7mJl864YN9zcrNUL1Mestr2E4GepL7AT3NmCAu6lhR+HXtIlqAx+ThC3aa9yJWSq+piGWSKf13VAZEMI6r3fbMH7UGml5zmMRL5NI2Dc/sXgALVnS4GUrbtqWJAeG8Vy; 25:aX3lJ9AmTUNmx/Ql/U1gl4Zxgz3gdONk2/SQ4zR8fOWnoZiah709Qtgbf/5fGZMhe0O/OxKgDjreU4m3XrxC73XYH6vpvGE22p1FWNKAaC8fNTWpwAchmJdz/xN6P3uWgVjtWaqSy5vXsyDKAYY5e6pvp3o6OBtlmpNNiJq6lboymX0fCzpqakRy1cFAxW47TmdhuMOjNyiKki3ibTujZaeLX4ZNE+eQZ+ZpoJcqAg7NKvxGISVX4Qef8oDi+8hSvHsCFGwRUabM0k88Z12odY+qb45bp0j56Ty4DoB+4Kn8jblDb9m1Q9RUIYe+ZxQ5XzlC3b7xIp6opiveUXe7PV3ZHpsmhlRemqWYqqh0QsmgEfpZ7HwNiHGPFBQ4Fqov89j4QaOqCxfp6u1iVrM+JrrGRBg63IDZBwBj3ipqQv0eU3q/kHIcetO1nnVAaHMHJMlm8/AZpM9q94oPk6pWifkhhYKzBjqE1zdLbN19MRtnRS+MppfNhm+5bWmUxfVcyFroAxM X-Microsoft-Exchange-Diagnostics: 1; SYXPR01MB0974; 31:mKzXdc4rojdrk4b1TkFBN63dFE3G9ssT2XXIpsi8KsHnrXfXPUu0gQyRcJGwUDGye/U2OiZiljj73QI+JPYhKcGGyHFUxcHFpQyOaM+yC6Uys/xABOb/GbOfxcogEZFKTV6ozHcc6n6qCu/ykNaAWJMKtyvuqGwVZ1/iBxosjm5jbfv1gw6NrORa6vrBVMbjHJn9jfsp23X55oNasM6zklww1bth5hdyRGLFvJo1PDLpU3HRcXZThHqLKxiXLLBIYU/HmElJK7aA+VI5h/5uZrK/cpyxI6QukyoY87oXq/ao29hKjZJvEL9LoEHnIyzA X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(102415395)(6040450)(2401047)(8121501046)(5005006)(3002001)(93006095)(93001095)(10201501046)(6041248)(2016111802025)(20161123562025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123564025)(20161123560025)(20161123555025)(20161123558100)(6072148)(6043046); SRVR:SYXPR01MB0974; BCL:0; PCL:0; RULEID:; SRVR:SYXPR01MB0974; X-Microsoft-Exchange-Diagnostics: 1; SYXPR01MB0974; 4:YzK+qfvupsDBjVeX66AVKLINJun2whnsFlSNYwT+CP0VH39DHckZffQIkAEPL2QXcNNCuyAnhgrEnINrWrqOMYBJ/ck5YW4kYYWcRqEJq1UcDPndyQlIpyDYLxiU2zxUJjcIdKYkMNeLI8XWUD5Z7/ACxl3WaAEt6FCC8c6/IRODPCaAfN5WUY06s6Lxel95KPBwtNmQmwT/Xtiytc8MNNEjzDMRka6qCa/N7d74+6u+qdo1QD1i8Pt+tf3POFrLX5CHgRcIQcn07JG/CUMmbzYHPkahuKaVXDZMpZjA2AufgnlFZ2bekaKNmK3ETp02sMMtLMoeX+r9p+AGjpZZexjz/8pinZfYrqfkslP/SBoSYj58dhhUBCtUmMF7gzRyZsYiKDmzzsEU0eoj+U0g3LYmvR2Nyqoo0ZPXs72DVIXq7WMcMMi5XpvFeo38w71m99IvxLWEuMYTO9bXHCYbFU+d56yp5MMeWDwe75fAGm8uCcKxp3zGfXKkUR/wiKJtCfvhc1H6K2bcA1sNIZXZzL4VBz41Zu5GzsUxi5aTgSD53RMwP9r6xs8vQXHv7cAwrgKutWDPe7drv9ucv7De2jnuFrJd4mMgZ8cWlDjm7McrOMyR2kV9pYvzYhoBsMl9oXDLOHQ+w0f/BPpLSs5rpMZIVnTq5TpgIWhO0Z9mTF8qwW/pSv1oI2RCXBQg/yilIWZzPrQ7FpCijcgu64WQT3R+DcURydbezTWNcI/3WgI0yjrIuaoIqrtaGKBWCOe7soENepc65h/ejY5YprCWdLkwJQkLJ jP6jcgLqRk6H9lseRs+dFszJGcO6w0+/TnEsucwtFU2RNP X-Forefront-PRVS: 0308EE423E X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6009001)(39830400002)(39410400002)(39450400003)(39400400002)(8676002)(5890100001)(81166006)(6506006)(6246003)(5660300001)(6486002)(6512007)(84326002)(25786009)(4610100001)(86362001)(83506001)(6666003)(305945005)(5000100001)(4810100001)(6916009)(42882006)(2950100002)(7736002)(36756003)(4326008)(478600001)(42186005)(66066001)(2906002)(3846002)(6116002)(568964002)(2351001)(189998001)(50986999)(76176999)(38730400002)(110136004)(53936002)(33646002)(54356999)(74482002)(4001350100001); DIR:OUT; SFP:1102; SCL:1; SRVR:SYXPR01MB0974; H:jupiter.local; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; SYXPR01MB0974; 23:B9stpXkRqtacmY3t0DHqXJStb8K+EGfSXR2q8TzhO9XEpVx4XFN6XRY33okfET8NUOUluwIMxPmdAcE+ctjCHogkBFivzEtm1oXYB7J8AA6v/zofRov6MHN2J8Tkq8oB3+gIZqSCbaT2wrKlmPNNgL+fKH7lIu1ZU18ea7MbiVVNbJiDhmUQiW8NlI2BPlSClicui+t8cJWZnjqAHg9YDK0LSVYBZ8QKwV2s415vVahpaRZkeBYmapKocnGlILlhy5AXJ/1awL2DqO/p9iu7rl9bZk9zpKExOTXoRhkwBVLpqI9ylt+wJkcgqcF4YSwZEVCMKIWB0T5YILVLMlWx7vgIEPlrml2av9Em3XAVP1ctDrilB12CNYolHq/TlorQV8x34WP34ERpJnQ9T1aqDc/kgjZk+i0JMaanbUmu3S2QMc3pqvF0eKx+tsSvU0MoaHAxkgtpsLhNZRdibfja+UUqzI77sbdKU/1ed13MMfz90usYTxLY8FRDkkT3PtnFD9oh+1xuR9/aySkU9OQv+mmSM7BRFvXRr3oWSzOgIF94y0B3PHKoDt6WfER65+W0gmWU20iEI6nQouCfFPKRQV1ottpWJ2USwBpe7MrdpmtmhTpYVbpLTBmWrOrebaz/C7Q3uC0SSd+/+f0i1Hq4dufCWcWYj2tS27FSkf66SE8Uezc7tRNLQC9Zi1z20LEolvuFpcgHsgAWe63FTDf5KJ2VTjcW5L9xvwWRJ13/K6G9rV0pDX1sYFWZLWgBs32btBDNw26fmLz9UFEFGCrebyFmNpy/ ZICbboNVmPHqR4Qh/3A/Jm0uMnzBrWj1ga460z6/0CN+PQ X-Microsoft-Exchange-Diagnostics: 1; SYXPR01MB0974; 6:itWzMH3KzJx+gHaodZWWA4ISLTm6B1asESV8lP2PMkOdNmdfmidvqKiN5YLmrowi53hLz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exaBUie4Z/jAFh6wXGKEfux+ZUYnbrd2Ayz0IrR4jwMXZ4KID2EoLVto3SOXb3ppexYczA== X-OriginatorOrg: tenpoint.co.nz X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 May 2017 00:26:19.2092 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: SYXPR01MB0974 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:132510 Archived-At: --=-=-= Content-Type: text/plain > Did you try running whitespace-tests with this change, and if so, did > they pass? Yes, all tests pass. > If the tests pass, would you mind to please add a new test for this > bug? I've written a new test and confirmed it catches this problem. I also tweaked the original patch to handle another instance of the same bug. Patches for whitespace.el and whitespace-tests.el are attached. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename="whitespace-tests.patch" --- whitespace-tests-a.el 2017-05-12 23:11:38.000000000 +1200 +++ whitespace-tests-b.el 2017-05-15 01:55:43.000000000 +1200 @@ -47,6 +47,31 @@ (should (equal (whitespace-tests--cleanup-string "a \n\t \n\n") "a \n")))) +(ert-deftest whitespace-tests-display-tables () + "Test whitespace stores and restores the buffer display table - bug26892." + (with-temp-buffer + (whitespace-mode -1) ; turn off in case global ws mode is active + (let ((whitespace-style '(space-mark tab-mark newline-mark)) + (whitespace-display-mappings '((space-mark 32 [183] [46]) + (space-mark 160 [164] [95]) + (newline-mark 10 [36 10]) + (tab-mark 9 [187 9] [92 9]))) + (buffer-display-table nil)) + ;test the display table actually changes + (should-not (equal nil + (progn (whitespace-mode 1) + buffer-display-table))) + ;test the display table restores correctly + (should (equal nil + (progn (whitespace-mode -1) + buffer-display-table))) + ;test the stored display table is preserved + (should (equal nil + (progn (whitespace-mode 1) + (whitespace-mode 1) + (whitespace-mode -1) + buffer-display-table)))))) + (provide 'whitespace-tests) ;;; whitespace-tests.el ends here --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename="whitespace.patch" --- whitespace-a.el 2017-05-14 14:12:59.000000000 +1200 +++ whitespace-b.el 2017-05-15 01:11:30.000000000 +1200 @@ -2496,9 +2496,10 @@ (let (vecs vec) ;; Remember whether a buffer has a local display table. (unless whitespace-display-table-was-local - (setq whitespace-display-table-was-local t - whitespace-display-table - (copy-sequence buffer-display-table)) + (setq whitespace-display-table-was-local t) + (unless (or whitespace-mode global-whitespace-mode) + (setq whitespace-display-table + (copy-sequence buffer-display-table))) ;; Assure `buffer-display-table' is unique ;; when two or more windows are visible. (setq buffer-display-table --=-=-=--