GNU bug report logs - #15478
cc-mode does not obey electric-indent-mode

Previous Next

Packages: cc-mode, emacs;

Reported by: Stefan Monnier <monnier <at> iro.umontreal.ca>

Date: Sat, 28 Sep 2013 18:12:02 UTC

Severity: normal

Found in version 24.3.50

Done: Alan Mackenzie <acm <at> muc.de>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Alan Mackenzie <acm <at> muc.de>
Cc: gnu-emacs-bug <at> moderators.isc.org
Subject: bug#15478: cc-mode does not obey electric-indent-mode
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




This bug report was last modified 11 years and 92 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.