Subject: Re: bug#15478: cc-mode does not obey electric-indent-mode

From: Stefan Monnier <[email-masked]>
Date: Mon, 07 Oct 2013 19:08:40 -0400

>> I can assure you it doesn't work 100%: in many circumstances you have to
>> hit TAB (or M-C-\ or M-C-q) manually before the text's indentation
>> reflects the modifications that took place.
> Electric indentation only works on the current line, and I'm not sure
> extending it to subsequent lines would be a good idea.  Could you specify
> cases where it doesn't work on the current line?

I don't care to try and remember the cases where TAB is needed, because
hitting TAB is like second nature anyway, but at least C-y and M-d are
obvious cases.

>> I don't think it's a failure of your code, tho (and
>> electric-indent-mode fails in the exact same way).
> How do they fail?

They leave the code mis-indented because the action did not
trigger reindentation.

>> > How about aliasing `c-electric-mode' and `electric-indent-mode' and
>> > making them buffer-local in CC Mode buffers?  Then setting CC Mode's
>> > value of `electric-indent-chars' to nil, for now, and in the medium
>> > future (once e-i-m has percolated through to old versions and XEmacs)
>> > integrating CC Mode into electric-indent-mode properly?
>> Poor, but does satisfy the requirements.
> Do you want to elaborate?

Off hand, things lacking compared to the ideal:
- the keys should be bound to self-insert-command.
- the user should be able to control the behavior via electric-indent-chars,
  like with all other modes.
but as I said, it does satisfy the requirements.

> Electric indentation is precisely about the *re*indation of the current
> line, isn't it?  indent-according-to-mode after NL isn't electric
> indentation.

It is very much part of electric-indent-mode (the default value of
electric-indent-chars is just '(?\n)).

        Stefan