unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: starback@stp.lingfil.uu.se (Per Starbäck)
Cc: 32876@debbugs.gnu.org
Subject: bug#32876: 26.1; python-mode mixes existing tabs with new spaces
Date: Wed, 23 Jun 2021 16:38:45 +0200	[thread overview]
Message-ID: <87v964k5my.fsf@gnus.org> (raw)
In-Reply-To: <sa5in2o7045.fsf@numerus.lingfil.uu.se> ("Per Starbäck"'s message of "Sat, 29 Sep 2018 18:13:30 +0200")

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





  parent reply	other threads:[~2021-06-23 14:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-29 16:13 bug#32876: 26.1; python-mode mixes existing tabs with new spaces Per Starbäck
2018-09-29 20:11 ` Andreas Röhler
2021-06-23 14:38 ` Lars Ingebrigtsen [this message]
2022-05-07 12:00   ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87v964k5my.fsf@gnus.org \
    --to=larsi@gnus.org \
    --cc=32876@debbugs.gnu.org \
    --cc=starback@stp.lingfil.uu.se \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).