Subject: Re: bug#5586: 23.1.92.1; Electric indentation and hungry backspace deletion in JavaScript mode (js-mode)

From: Daniel Colascione <[email-masked]>
Date: Sun, 28 Mar 2010 16:59:14 -0400

On 3/28/10 4:46 PM, Chong Yidong wrote:
> I am still not happy about the way it's implemented in either mode---I
> think Emacs needs some kind of centralized mechanism for this---but that
> is a longer-term project.  

The chief difficulty I see is that in some modes, indentation isn't
idempotent: if you ran indent-line-function from some generic electric
code, it might change the indentation of the current line in unwanted
ways. (Imagine python-mode, where indent-line-function cycles through
feasible indentation levels for a given line.)

At best, modes would have to opt-in, and if each mode needs some glue
anyway, why not just let each mode handle electric characters itself?

> In the meantime, I've restored the deleted
> code in the branch.

Thanks.

> One difference, however, is that espresso-mode did electric punctuation
> for `+-.'.  I didn't restore this yet, since CC mode does not do
> electric punctuation for these characters.  Is there any reason we need
> to do this specially for Javascript?

There's no particular reason, no. The cc-mode set of electric characters
is probably fine.