Subject: Re: bug#17449: 24.4.50; Empty lines confuse electric-indent-post-self-insert-function.

From: Philipp Rumpf <[email-masked]>
Date: Fri, 9 May 2014 17:36:51 +0000

Thanks for the response, but I really don't think this is the intended
behaviour! If you type

M-x python-mode <RET>
if a == 3:<RET>
<RET>
<RET>
<RET>

the cursor will jump back and forth between column 0 and 4 on every
alternate line, which simply does not make sense.

As for the documentation, here is the relevant paragraph from C-h k RET:

    If `electric-indent-mode' is enabled, this indents the final new line
    that it adds, and reindents the preceding line.  To just insert
    a newline, use M-x electric-indent-just-newline.

Since we're in electric-indent-mode in the test case (it is enabled by
default for me in emacs -Q), the behaviour I've seen definitely does not
match the documentation.

On Fri, May 9, 2014 at 4:09 PM, Eli Zaretskii <[email-masked]> wrote:

> > Date: Fri, 9 May 2014 10:09:03 +0000
> > From: Philipp Rumpf <[email-masked]>
> >
> > In C mode and Python mode, hitting <RET> on an indented but otherwise
> > empty line results in an unindented new line at point, rather than an
> > indented line.
> >
> > To reproduce in emacs -Q:
> >
> > M-x python-mode<RET>
> > if a == 3:<RET>
> > <RET>
> > M-: (current-column)<RET>
> >
> > Expected result: 4 / indented line
> > Actual result: 0 / line not indented
>
> Per the design.  "C-h k RET" displays this text:
>
>   RET (translated from <return>) runs the command newline, which is an
>   interactive compiled Lisp function in `simple.el'.
>
>   It is bound to RET.
>
>   (newline &optional ARG INTERACTIVE)
>
>   Insert a newline, and move to left margin of the new line if it's blank.
>                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>