emacs-devel
[Top][All Lists]
Advanced

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

Re: [Emacs-diffs] trunk r116461: Connect electric-indent-mode up with CC


From: Dmitry Gutov
Subject: Re: [Emacs-diffs] trunk r116461: Connect electric-indent-mode up with CC Mode. Bug #15478.
Date: Mon, 31 Mar 2014 20:11:58 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0

On 30.03.2014 17:57, Alan Mackenzie wrote:

This could be considered a reason to improve the indent-line-function in
text-mode. `indent-relative' offers behavior that's pretty close. Maybe
it could be made to follow the behavior of auto-fill even closer.

Notice, here, how we're no longer talking about electric indentation, but
rather about newline-and-indent.  The two topics are distinct.

Yes, but I think we're discussing both in this thread. FWIW, I think we're in agreement about electric indentation on RET. See my message here, and also Stefan's reply:

http://lists.gnu.org/archive/html/emacs-devel/2014-03/msg00936.html
http://lists.gnu.org/archive/html/emacs-devel/2014-03/msg00957.html

Yes, but how?  fundamental-mode is a non-programming mode, so the global
key map needs RET set up for newline, C-j for newline-and-indent.  That
leaves lots of mode key maps to be set up.  At this point, your
suggestion and mine become the same.

Maybe.

I usually think of html, markdown, and such like, as the "etc." in
"programming modes (etc.)".

Yeah, okay. Which other modes exactly need newline-and-indent on RET could be a matter of debate, but one possible criteria is "mode has a meaningful/specialized indentation function".

If you edit the non-code blocks a lot in text mode, `fill-paragraph' is
_exactly_ what's wanted to restore the filling.

If the filling algorithm is perfect, then yes, it could be what's wanted.

I think RET should do the most natural sort of newline, and C-j the
subsidiary one, whatever they may happen to be for a particular mode.

Sounds okay, I guess.

As long as this new mode is divorced from electric-indent-mode, I'd be
happy.

This is a key point.

It could be something called like `old-newline-keys-mode'. Appropriate major modes would swap RET and C-j bindings, and the above minor mode would force them all back to (RET C-j) -> (newline newline-and-indent).

This specific behavior is a consequence of using `newline-and-indent'.

No, not at all.  It's a consequence of electric behaviour getting
entangled with newline-and-indent.

It's the same if I disable `electric-indent-mode' but bind RET to `newline-and-indent'.

And if `electric-indent-mode' didn't do `-and-indent' but retained the electric indent on RET, a similar example is easy to demonstrate:

foo
  bar|

Press RET, see the same result.

IOW, text-mode could be considered in trouble if RET triggers call to indentation at any line.

The two are completely non-competing situations.  RMS's happened because
electric indentation was active where it shouldn't be.

AFAICT it's the opposite, but see the scenario above.

To quote the bug report: "and point is at the start of the second line"

Your situation is
a matter of binding (RET C-j) to ('newline 'newline-and-indent) the
appropriate way round.  Don't confuse these.

Indeed, for my usage the above binding is sufficient.



reply via email to

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