Subject: Re: bug#16155: 24.3.50;

From: Alan Mackenzie <[email-masked]>
Date: Sun, 15 Dec 2013 20:01:29 +0000 (UTC)

Stefan Monnier <[email-masked]> wrote:
> Richard Stallman <[email-masked]> wrote:
>> I don't ever like having newline indent.

I agree.  `newline' should never indent the new line.  `newline-and-indent'
should always indent the new line.

>> It should be a minor mode,

> It is a minor mode.  Called electric-indent-mode, and no enabled by default.
> See NEWS.

electric-indent-mode _is_ enabled by default in the current trunk.  I've
just updated, built, and tried it.

>> and the documentation of `newline' should explain how to easily turn
>> this off.

> The docstring does mention the indentation behavior, with a link to
> electric-indent-mode.

What the docstring says is this:

    A non-nil INTERACTIVE argument means to run the `post-self-insert-hook',
    which by default will also indent the line (see `electric-indent-mode').

Presumably the invocation of `newline' by pressing the RET key leaves
INTERACTIVE set to nil.  Nevertheless, the unwanted indentation happened.

This is bad documentation, since it describes the internal workings rather
than the coherent functionality.  As a user of `newline', I shouldn't have
to know about `post-self-insert-hook', never mind having to try to figure
out which way to set INTERACTIVE.

I can't make out what that bit of the doc string means without a
considerable investment of intellectual effort.

Again, the question: why should `newline' indent when we've got the specific
command `newline-and-indent'?  I think a good way to resolve the current
confusion would be to restrict electric-indent-mode to indenting ONLY the
line in which the character is typed, and leaving the indentation of any
new line to `newline-and-indent'.

>        Stefan

-- 
Alan Mackenzie (Nuremberg, Germany).