From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Andreas =?UTF-8?Q?R=C3=B6hler?= Newsgroups: gmane.emacs.bugs Subject: bug#32876: 26.1; python-mode mixes existing tabs with new spaces Date: Sat, 29 Sep 2018 22:11:12 +0200 Message-ID: References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1538251512 11792 195.159.176.226 (29 Sep 2018 20:05:12 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 29 Sep 2018 20:05:12 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux i686; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 To: 32876@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Sep 29 22:05:08 2018 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 1g6LU9-0002xT-B8 for geb-bug-gnu-emacs@m.gmane.org; Sat, 29 Sep 2018 22:05:05 +0200 Original-Received: from localhost ([::1]:52459 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g6LWG-0003uX-1b for geb-bug-gnu-emacs@m.gmane.org; Sat, 29 Sep 2018 16:07:16 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57412) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g6LW5-0003uR-V4 for bug-gnu-emacs@gnu.org; Sat, 29 Sep 2018 16:07:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g6LW2-0007YK-Qw for bug-gnu-emacs@gnu.org; Sat, 29 Sep 2018 16:07:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:54936) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1g6LW2-0007YA-MH for bug-gnu-emacs@gnu.org; Sat, 29 Sep 2018 16:07:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1g6LW2-0008KB-Cu for bug-gnu-emacs@gnu.org; Sat, 29 Sep 2018 16:07:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Andreas =?UTF-8?Q?R=C3=B6hler?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 29 Sep 2018 20:07:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 32876 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.153825160731974 (code B ref -1); Sat, 29 Sep 2018 20:07:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 29 Sep 2018 20:06:47 +0000 Original-Received: from localhost ([127.0.0.1]:59194 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g6LVm-0008Jd-Ot for submit@debbugs.gnu.org; Sat, 29 Sep 2018 16:06:46 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:47688) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g6LVl-0008JQ-1E for submit@debbugs.gnu.org; Sat, 29 Sep 2018 16:06:45 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g6LVf-0007Hj-9B for submit@debbugs.gnu.org; Sat, 29 Sep 2018 16:06:39 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:57372) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g6LVf-0007Hb-5l for submit@debbugs.gnu.org; Sat, 29 Sep 2018 16:06:39 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:57297) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g6LVe-0003q3-By for bug-gnu-emacs@gnu.org; Sat, 29 Sep 2018 16:06:39 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g6LVb-0007Fx-7e for bug-gnu-emacs@gnu.org; Sat, 29 Sep 2018 16:06:38 -0400 Original-Received: from mout.kundenserver.de ([212.227.126.130]:36651) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1g6LVa-0007Ey-Up for bug-gnu-emacs@gnu.org; Sat, 29 Sep 2018 16:06:35 -0400 Original-Received: from [192.168.178.35] ([188.103.26.138]) by mrelayeu.kundenserver.de (mreue009 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MDyoW-1fwU9c3CT6-009vqi for ; Sat, 29 Sep 2018 22:06:33 +0200 Original-Received: from [192.168.178.35] ([188.103.26.138]) by mrelayeu.kundenserver.de (mreue009 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MDyoW-1fwU9c3CT6-009vqi for ; Sat, 29 Sep 2018 22:06:33 +0200 In-Reply-To: Content-Language: en-US X-Provags-ID: V03:K1:haKK0d/uZ+HybFvMi5S3QwU8Y2XJWNOp1zuE22s6NWYPMWIe0QC LcwjYxYR1e/15gWSeKn05kDeOSS8+bTgaUeWl4nCGEbdzpFtkcuiD0Id8euHopI5VXF4Wy9 fpBS5BIwpxZMPg+nFLVevWdbuludV0uniSITT/Zlb8xKWFhvnEsmjCyA4mrywzXf1MjGKTH mbKt/1Aallq55mN1VWqNg== X-UI-Out-Filterresults: notjunk:1;V01:K0:ezZpmKumUxk=:m+CAUWgRLkfoY9hJIzE1mc sbDbj6We32qaU9liQolfDYZWuIewOmA6b+t7pICH9Qu22vB3MTEKw6t12NnUGdSfKIkHZU5M2 X0/SDBQalk5yPox7qm6AUrlWAHibRDHK6dG0puk0YWzpVmmxHc4X7YmwRO7+HmecAVCRdln0E JgoimTnI9VqE6CUD7y9ADGehNAghE+mYIuZIjZlxcHmIsl/psGbnAUhBMP/47e8L5itP7etCV eMb+3yGsOvTyhJj2vo0OY9tnFXYaEDMa9alRi/5YotMGYsXvPsxs70MntguRiUPz0RMGs2VgA AR1H23sIcs/AmUqadoizJm9VkpUo6Uxf4e/2+xlOvyMwErlLDOZP8bw/7A5UrfGxcAft+Dspj ROSDa6r1eN5J+NIhlJTcQc6WKT9I6wcStEzDtL35hn1omZtsiqQie2XiFm6QdIIepboXyd3rR AcEv5+X6Xb4A0QRXfohaXjvpXxvOkdjESL8dx/budD8nXlppG6nz6IwfqDLAHlNi9nkaOB4r7 5mv9dpnre1B8jFWJSO3vb68mXIpeUiV9tLqNrqIGyh1LMDDX/MUs45NSRdxOiZph7Ts6cjGKi dL19Z5qfA1zPQUWH8ZjXu+cpu8hHadsuPDDHQRpXrk6DBnmBE++lG4ItwxHodl4RNS8NClQl3 5P/knO0OEi0Na6Mr9/xxulwHI4cjiMvt8zJ1ZYSc6btf5TB+MGG3pJXr2JXyjQDlew+msSMOu UXvPYz8CdIIKkHif X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x 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:150770 Archived-At: On 29.09.2018 18:13, Per Starbäck wrote: > In GNU Emacs 26.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.26) > > ### Problem ### > > I did "emacs -Q pytab.py" where pytab.py contains the two lines: > > ------------------------------ > def foo(): > print('hello') > ------------------------------ > > The second line begins with a TAB. > > Then I add a line to this marvellous program with > > M-> TAB print('world') C-x C-s > > This new line will have eight spaces in the beginning, and because of > that this is no longer a valid Python3 program! > > ### Background ### > > Earlier you could mix spaces and tabs (seen as 8 spaces) in Python, but > Python3 disallows mixing them. > > Spaces are preferred, and the style guide "PEP 8" says that > > Tabs should be used solely to remain consistent with code that is > already indented with tabs. > > So python-mode ought to help you remain consistent with such old > code. I think that checking with what characters the current block is > indented all the time would be overdoing it for something that shouldn't > occur that often, but that it should suffice to just scan through the > visited file to see if it contains any tabs in that case instead turn on > indent-tabs-mode instead of turning it off. > > > May confirm that with GNU Emacs 27.0.50 (build 1, i686-pc-linux-gnu, GTK+ Version 3.14.5) of 2018-09-19 python.el hard-codes (set (make-local-variable 'indent-tabs-mode) nil) which should be customizable.