From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: starback@stp.lingfil.uu.se (Per =?UTF-8?Q?Starb=C3=A4ck?=) Newsgroups: gmane.emacs.bugs Subject: bug#32876: 26.1; python-mode mixes existing tabs with new spaces Date: Sat, 29 Sep 2018 18:13:30 +0200 Message-ID: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1538237525 19957 195.159.176.226 (29 Sep 2018 16:12:05 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 29 Sep 2018 16:12:05 +0000 (UTC) To: 32876@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Sep 29 18:12:01 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 1g6Hqb-000568-0F for geb-bug-gnu-emacs@m.gmane.org; Sat, 29 Sep 2018 18:12:01 +0200 Original-Received: from localhost ([::1]:51534 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g6Hsh-0002gK-MR for geb-bug-gnu-emacs@m.gmane.org; Sat, 29 Sep 2018 12:14:11 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46621) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g6Hsb-0002gF-LH for bug-gnu-emacs@gnu.org; Sat, 29 Sep 2018 12:14:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g6HsY-0007CO-Hn for bug-gnu-emacs@gnu.org; Sat, 29 Sep 2018 12:14:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:54845) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1g6HsY-0007CK-E1 for bug-gnu-emacs@gnu.org; Sat, 29 Sep 2018 12:14:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1g6HsY-0002il-6O for bug-gnu-emacs@gnu.org; Sat, 29 Sep 2018 12:14:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: starback@stp.lingfil.uu.se (Per =?UTF-8?Q?Starb=C3=A4ck?=) Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 29 Sep 2018 16:14:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 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.153823762710427 (code B ref -1); Sat, 29 Sep 2018 16:14:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 29 Sep 2018 16:13:47 +0000 Original-Received: from localhost ([127.0.0.1]:59103 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g6HsJ-0002i6-5P for submit@debbugs.gnu.org; Sat, 29 Sep 2018 12:13:47 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:36971) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g6HsI-0002hs-0R for submit@debbugs.gnu.org; Sat, 29 Sep 2018 12:13:46 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g6HsB-00071D-PS for submit@debbugs.gnu.org; Sat, 29 Sep 2018 12:13:40 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:51175) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g6HsB-000719-Ki for submit@debbugs.gnu.org; Sat, 29 Sep 2018 12:13:39 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46574) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g6HsA-0002da-QC for bug-gnu-emacs@gnu.org; Sat, 29 Sep 2018 12:13:39 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g6Hs7-0006yn-Lj for bug-gnu-emacs@gnu.org; Sat, 29 Sep 2018 12:13:38 -0400 Original-Received: from numerus.lingfil.uu.se ([130.238.78.148]:45624) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g6Hs7-0006wy-DK for bug-gnu-emacs@gnu.org; Sat, 29 Sep 2018 12:13:35 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by numerus.lingfil.uu.se (Postfix) with ESMTP id A9273A19E427; Sat, 29 Sep 2018 18:13:31 +0200 (CEST) X-Virus-Scanned: amavisd-new at lingfil.uu.se Original-Received: from numerus.lingfil.uu.se ([127.0.0.1]) by localhost (numerus.lingfil.uu.se [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 0bFLJOlxm7GP; Sat, 29 Sep 2018 18:13:30 +0200 (CEST) Original-Received: from numerus.lingfil.uu.se (localhost [127.0.0.1]) by numerus.lingfil.uu.se (Postfix) with ESMTP id E2259A19E426; Sat, 29 Sep 2018 18:13:30 +0200 (CEST) Original-Received: (from starback@localhost) by numerus.lingfil.uu.se (8.14.7/8.14.7/Submit) id w8TGDU3v027767; Sat, 29 Sep 2018 18:13:30 +0200 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:150767 Archived-At: 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.