GNU bug report logs - #32120
26.1; In python.el tab-width should default to 4

Previous Next

Package: emacs;

Reported by: Carlos Pita <carlosjosepita <at> gmail.com>

Date: Tue, 10 Jul 2018 22:06:02 UTC

Severity: wishlist

Tags: notabug

Found in version 26.1

Done: Stefan Kangas <stefan <at> marxist.se>

Bug is archived. No further changes may be made.

Full log


Message #29 received at 32120 <at> debbugs.gnu.org (full text, mbox):

From: Noam Postavsky <npostavs <at> gmail.com>
To: Carlos Pita <carlosjosepita <at> gmail.com>
Cc: Glenn Morris <rgm <at> gnu.org>, Robert Pluim <rpluim <at> gmail.com>,
 32120 <at> debbugs.gnu.org
Subject: Re: bug#32120: 26.1; In python.el tab-width should default to 4
Date: Fri, 29 Mar 2019 23:17:14 -0400
Carlos Pita <carlosjosepita <at> gmail.com> writes:

>> Right. What is your justification for wanting this to be 4?
>> Python generally discourages tabs, but when they are present, seems to
>> follow the historical convention mapping them to 8 spaces.

>> https://docs.python.org/3/reference/lexical_analysis.html#indentation
>>
>>     Tabs are replaced (from left to right) by one to eight spaces such
>>     that the total number of characters up to and including the
>>     replacement is a multiple of eight (this is intended to be the same
>>     rule as used by Unix).

> Sure, I don't want to enter tab characters at all, I just want to
> rigidly indent using 4-space tab stops. And setting tab-width to 4 and
> indent-tabs-mode to nil makes C-x Tab S-Right do just that.

> Some months later, I'm insisting on this.
>
> I don't see any point in setting the default to 8 when:
>
> 1. PEP 8 clearly states: use 4 spaces per indentation level.
> 2. Python mode specific rigid indentation mechanism defaults to 4 spaces.
>
> AFAICS the only thing you get by setting tab-width to 8 is
> incompatibility of emacs standard rigid indentation mechanism (M-x
> Tab) with both 1 and 2. I think it's important to play well with
> standard facilities (despite python mode providing it's own variant)
> and, in any case, there is no good reason, no trade off, not to do it.

Seems clear to me that the proper solution is simply to rebind C-x Tab
S-left/right to use python-indent-shift-left/right.  That will solve the
actual problem you experience, without incorrectly showing any existing
tab charaters as 4 spaces.





This bug report was last modified 5 years and 255 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.