emacs-devel
[Top][All Lists]
Advanced

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

Re: Default behaviour of RET.


From: Stephen J. Turnbull
Subject: Re: Default behaviour of RET.
Date: Thu, 24 Oct 2013 08:43:50 +0900

Alan Mackenzie writes:
 > On Tue, Oct 22, 2013 at 12:04:32AM +0400, Dmitry Gutov wrote:

 >> I really have to wonder when anyone would wish to use RET bound to
 >> newline.

Because it doesn't autosense style, it is especially useful where
style is inconsistent.  For example, I sometimes write patches in
sequences where the last patch just fixes up the whitespace, and
previous patches do the actual work but avoid whitespace changes for
ease of review.  (Sure the reviewer can use --ignore-space-change, but
it's an annoyance.  And review tools should know how to ignore ws
changes, but not everybody uses them.)

 >> Why? Does some popular major mode provide inadequate indentation
 >> function, so that you have to pick whether to indent the next line
 >> automatically or not?

In the above use case, they all do.

 > `newline' is the Right Thing to do in non-programming modes like Text
 > Mode, at least a lot of the time.
 > 
 > For example, it is if you have paragraphs indented like this one, where
 >     you use auto-fill-mode to calculate a non-null fill prefix to indent
 >     subsequent lines of the paragraph and RET to start a new paragraph at
 >     column zero.

To be accurate, at the current left margin, which is usually zero.

 > Even in programming modes, you might want to start a whole-line comment
 > at column zero, even where (or especially where) the code is deeply
 > indented.

Sure, but all of these use cases are relatively infrequent (though not
rare).  I think you should concentrate on the consistency of semantics:

 > I would be most unhappy if the `newline' functionality were to be
 > obliterated, even in restricted circumstances like
 > `electric-indent-mode' being enabled and \n being in
 > `electric-indent-chars'.

Indeed, that change is horrible.  `newline' has well-defined
semantics, which do not include indentation.  Programs should be able
to rely on them, given that it's trivial to define a minor mode which
does nothing but install a space keymap that swaps the command
bindings of C-j and RET.

It might even be reasonable to make { RET: newline-and-indent, C-j:
newline } the default for the sake of the youngsters.



reply via email to

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