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

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

bug#17449: 24.4.50; Empty lines confuse electric-indent-post-self-insert


From: Philipp Rumpf
Subject: bug#17449: 24.4.50; Empty lines confuse electric-indent-post-self-insert-function.
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 <eliz@gnu.org> wrote:
> Date: Fri, 9 May 2014 10:09:03 +0000
> From: Philipp Rumpf <prumpf@gmail.com>
>
> 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.
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^


reply via email to

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