bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Noam Postavsky
Subject: bug#32120: 26.1; In python.el tab-width should default to 4
Date: Fri, 29 Mar 2019 23:17:14 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1.91 (gnu/linux)

Carlos Pita <carlosjosepita@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.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]