emacs-orgmode
[Top][All Lists]
Advanced

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

[O] Bug: Tangling python code results in mixed tabs and spaces, incomapt


From: Edmund Christian Herenz
Subject: [O] Bug: Tangling python code results in mixed tabs and spaces, incomaptible with python3 [9.1.4 (9.1.4-dist @ /home/ehere/emacs-scripts/org-9.1.4/lisp/)]
Date: Wed, 20 Dec 2017 19:24:48 +0100
User-agent: NeoMutt/20170912 (1.9.0)

The following python code uses only whitespaces for the different
indentdation levels:

a_list = ['elem1',
          'elem2',
          'elem3']

for elem in a_list:
    print(elem)
    for char in elem:
        print char

I enter this code into a SRC block with

#+BEGIN_SRC python :tangle blank_test.py

#+END_SRC

by pressing C-' inside the block (which opens the editing buffer
python-mode).  Then I press C-' again, after which I tangle the code
to blank_test.py by pressing C-u C-c C-v C-t.  The resulting file
blank_test.py will contain a mix of tabs and spaces for the different
intendation levels.  (I checked this with whitespace.el).

Above behaviour is a bug, since Python3 forbids mixing of spaces and
tabs. (Python2 is more relaxed about mixing of tabs and spaces). Thus,
the above code, syntactical correctly entered into an OrgSrc buffer,
will result in code that can not be run in python3 when tangled from
an org-mode file.

Emacs  : GNU Emacs 24.4.1 (x86_64-pc-linux-gnu, GTK+ Version 3.14.5)
 of 2017-09-12 on hullmann, modified by Debian
Package: Org mode version 9.1.4 (9.1.4-dist @ 
/home/ehere/emacs-scripts/org-9.1.4/lisp/)




reply via email to

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