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

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

bug#32876: 26.1; python-mode mixes existing tabs with new spaces


From: Lars Ingebrigtsen
Subject: bug#32876: 26.1; python-mode mixes existing tabs with new spaces
Date: Wed, 23 Jun 2021 16:38:45 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

starback@stp.lingfil.uu.se (Per Starbäck) writes:

> 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.

Andreas Röhler <andreas.roehler@easy-emacs.de> writes:

> python.el hard-codes
>
> (set (make-local-variable 'indent-tabs-mode) nil)
>
> which should be customizable.

Well, I don't know -- the problem is that mixing them leads to invalid
programs, so specifying a single tab mode here makes sense, since it
will presumably lead to fewer problems in the long run.

That is, python-mode doesn't really support .py files with tabs in
them -- as a design decision.  So I think this works as designed.

Anybody else have an opinion here?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





reply via email to

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