I don't want comments to be auto-indented

Asked by Boris Kheyfets

Suppose I have a code:

for i in range(1,4):
    print i

for ...

If I'll try to add a comment before the second 'for' cycle - python-mode would move to:

for i in range(1,4):
    print i
    # IT GETS HERE!
for ...

while I don't need this, I want, that on pressing # python mode would leave it at the beginning of the line - since I want to explain the purpose of the next 'for' cycle:

for i in range(1,4):
    print i
# I WANT IT HERE!
for ...

Is there a way to control this behaviour in python-mode?

Question information

Language:
English Edit question
Status:
Solved
For:
python-mode.el Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:

This question was reopened

Revision history for this message
Andreas Roehler (a-roehler) said :
#1

customize boolean variable py-indent-comments to nil

Revision history for this message
Boris Kheyfets (kheyfboris) said :
#2

Thanks Andreas Roehler, that solved my question.

Revision history for this message
Boris Kheyfets (kheyfboris) said :
#3

Nope. Doesn't work:

I do have

(setq py-indent-comments nil)

and I checked - the same value is in my python-mode buffer. Still - comments got indented.

Revision history for this message
Andreas Roehler (a-roehler) said :
#4

please a bug report for it, thanks

Revision history for this message
Andreas Roehler (a-roehler) said :
#5

beside of the bug, this question might be considered solved

Revision history for this message
Boris Kheyfets (kheyfboris) said :
#6

As of rev 900 - the bug is still there.

Revision history for this message
Andreas Roehler (a-roehler) said :
#7

Am 19.03.2012 04:45, schrieb Boris Kheyfets:
> Question #190513 on python-mode.el changed:
> https://answers.launchpad.net/python-mode/+question/190513
>
> Status: Solved => Open
>
> Boris Kheyfets is still having a problem:
> As of rev 900 - the bug is still there.
>

Hi Boris,

think question section is made for a kind of howto - while the bugtracker for bugs.
we must not double that.

Revision history for this message
Boris Kheyfets (kheyfboris) said :
#8

Ok. But when I press "Problem Solved" - it says: "There is 1 error."

Revision history for this message
Andreas Roehler (a-roehler) said :
#9

that bug is out of question :)