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: Alan Mackenzie
Subject: Re: [Emacs-diffs] trunk r116461: Connect electric-indent-mode up with CC Mode. Bug #15478.
Date: Wed, 19 Mar 2014 22:42:31 +0000
User-agent: Mutt/1.5.21 (2010-09-15)

Hello, Stefan.

On Mon, Mar 17, 2014 at 11:48:16AM -0400, Stefan wrote:
> >> Right.  But I don't see what is so special about the C language that
> >> makes c-electric-flag (aka electric-indent-mode) indispensable in c-mode.
> > CC Mode modes don't indent correctly automatically without electric
> > indentation.

> And the same holds true for all other programming modes.

No it doesn't.  We both agree that Emacs Lisp Mode has no use whatsoever
for electric indentation.  Clearly, only languages where a line's
indentation is dependent on the contents of that line can benefit from
electric indentation.

> Nothing special here.

> I don't know of any mode where electric behavior of something else than
> the newline character is needed for the "typical case where lines of
> code are being typed in, line by line".

Then I suggest you think hard about the disadvantages of RET as an
electric indentation key.  If there weren't such disadvantages, CC Mode
would have been using it for 20 years.

> But since this "typical case" is not that typical, several major modes
> elect to make a few other keys electric so as to try and maintain
> indentation even when code is being modified rather than just being
> written linearly.

Yes.

> Maybe the special part of c-mode is that you used a set of electric
> chars which is sufficient and yet does not include newline.

Newline is a poor choice for an electric indentation key.

> > Not quite.  I want the default for CC Mode modes to be t, regardless of
> > any system wide default.

> I know you steadfastly refuse to recognize that this is your personal
> preference rather than a requirement of the languages you support.

You're not going to accept reasoned argument here, so I think there's no
point continuing this line of discussion.

> > I think you are wrong in your tacit assumption that liking of e-i-m is
> > person dependent rather than major mode dependent.

> There are details about *how* e-i-m works which depend on the mode.
> Yes.  That's why e-i-m has mode-local settings (e.g. which keys are
> electric, or whether the indentation algorithm can reliably reindent).

Any "indentation algorithm" can reliably reindent.  It is the context in
which the algorithm is used which is important, not the algorithm itself.

> But the global e-i-m setting is about deciding whether the user wants
> his code to be automatically indented as he types (to the extent
> possible).  It is *defined* as a person-dependent preference.

Clearly.  I am pointing out that this definition is perhaps a suboptimal
one.  Your scheme makes it difficult for a user to set up a major mode as
being non e-i-m, or even an individual buffer.

> > The way electric-indent-mode was implemented seems optimised to maximise
> > the difficulty of integrating CC Mode with it.

> Of course, my main objective was to piss you off and make your
> life miserable.  It hasn't worked as well as planned, but this is not
> quite over yet ;-)

Not even that.  You were in so much of a hurry to reinvent the wheel,
that you were oblivious of perfectly round wheels with smooth bearings
which had been in existence for ~20 years.

>         Stefan

-- 
Alan Mackenzie (Nuremberg, Germany).



reply via email to

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