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: Stefan
Subject: Re: [Emacs-diffs] trunk r116461: Connect electric-indent-mode up with CC Mode. Bug #15478.
Date: Sun, 23 Mar 2014 21:37:09 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

> The actual definition of "electricity" is found in the Emacs manual, page

Use in other packages shows that people have understood the notion of
"electric" to mean many other things beside the very restricted
semantics you point to.

>> In Elisp, without electric-indent you have to use C-j or TAB if you
>> want your code indented.  So whether the user hits C-j or RET is
>> relevant.
> No.  To keep Elisp properly indented, you merely have to depress
> whichever key is bound to `newline-and-indent', whether that be RET, or
> C-j, or whatever.

"whichever key is bound to `newline-and-indent'" would be C-j and not
RET in all Emacsen released so far, so I see we violently agree.

> Electric indentation doesn't come into it.

Of course it does because electric-indent changes the behavior such that
RET can be (or has to be in 24.4) used instead of C-j.  But you knew
that, obviously.

> Yes, but the point still stands.  You open up a fresh line, by RET, and
> type code into it, but don't want to type RET/C-j at the end of it.

Fine.  Feel free to provide a patch to make split-line auto-indent when
electric-indent is enabled.

> You'll want electric indentation on some other character you've just
> typed.

Indeed that's also good.  But I don't know of any such character we
could use globally in electric-indent-chars, so it's up to each major
mode to specify which chars to use.

> No.  If electric indentation has already happened after typing the
> semicolon/comma/brace, the alignment of the subsequent comment will
> remain undisturbed.  If RET puts the alignment out, you're cursing it.

Then I misunderstood and don't know what you're talking about.  Can you
give a scenario?

>> What would be more optimal?
> A mode-dependent or buffer-local dependent setting, as well as, rather
> than instead of.

We have that: electric-indent-local-mode and electric-indent-inhibit.

> Why can't we simply have RET bound to `newline-and-indent' and C-j
> bound to `newline' in programming modes, as discussed and, pretty much
> agreed on, in emacs-devel last autumn?

Lack of patch implementing this (supposed) simple change?

> Incidentally, in Emacs -Q, Text Mode and Fundamental Mode have gone back
> to the unwanted state of RET doing `newline-and-indent'.  Should I raise
> another bug report?

You can, but it's not a bug.  It's a feature (not sure what you mean by
"back" since it's been this way ever since I enabled
electric-indent-mode by default, AFAIK).
So make this bug report specific about a particular circumstance where
the behavior is undesirable, or about how hard it is to disable it.


        Stefan



reply via email to

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