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

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

bug#36884: Default python mode with electric-indent-mode sometimes inden


From: Andreas Röhler
Subject: bug#36884: Default python mode with electric-indent-mode sometimes indents empty lines
Date: Thu, 1 Aug 2019 09:56:53 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:60.0) Gecko/20100101 Thunderbird/60.7.2


On 01.08.19 09:06, Jarosław Rzeszótko wrote:
When pressing enter with the cursor like this:

def test():
    print("test")
[cursor]

Emacs (26.1) correctly just inserts a blank line. However, with this:

def test():
    if True:
          print("test")
[cursor]

Emacs inserts a blank line and indents it one level. With this:

def test():
    if True:
        if False:
              print("test")
[cursor]

it inserts a blank line and indents it two levels, etc. Moreover, with two methods like this:

def test1():
    if True:
          print("test")

[cursor]def test2():
    if True:
          print("test")

pressing enter will also indent the def block, instead of just inserting the empty line.


Hi Jarosław,

python-mode.el developer here, just being interested.

AFAIU electric-indent-mode doesn't run a timer, cursor position alone would not trigger it.

Assume there is a command used from pos. Which? BTW the key alone doesn't tell enough, as RET and C-j changed binding recently. Reporting Emacs version will be useful.

Thanks,

Andreas






reply via email to

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