GNU bug report logs -
#17449
24.4.50; Empty lines confuse electric-indent-post-self-insert-function.
Previous Next
Reported by: Philipp Rumpf <prumpf <at> gmail.com>
Date: Fri, 9 May 2014 15:43:02 UTC
Severity: normal
Found in version 24.4.50
Done: Stefan Monnier <monnier <at> iro.umontreal.ca>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
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 <at> gnu.org> wrote:
> > Date: Fri, 9 May 2014 10:09:03 +0000
> > From: Philipp Rumpf <prumpf <at> 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.
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
[Message part 2 (text/html, inline)]
This bug report was last modified 11 years and 17 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.