Discussion:
Indentation difference between Emacs and SourceForge CC-Mode
Philipp Stephani
2016-10-31 14:46:17 UTC
Permalink
Hi,

here's another difference between CC-Mode 5.33 from SourceForge and the one
shipped with Emacs: Create a C++ buffer with the contents

int main() {
aa;
}

(note, no indent of the 'aa' statement)
Then, mark the buffer (C-x h) and hit TAB to indent. In the CC-Mode from
Emacs, 'aa;' gets indented, but not in the CC-Mode from SourceForge. Is
that a bug in the SourceForge version?
Thanks!
Philipp Stephani
2016-11-15 18:17:15 UTC
Permalink
Post by Philipp Stephani
Hi,
here's another difference between CC-Mode 5.33 from SourceForge and the
one shipped with Emacs: Create a C++ buffer with the contents
int main() {
aa;
}
(note, no indent of the 'aa' statement)
Then, mark the buffer (C-x h) and hit TAB to indent. In the CC-Mode from
Emacs, 'aa;' gets indented, but not in the CC-Mode from SourceForge. Is
that a bug in the SourceForge version?
Thanks!
Friendly ping?
Alan Mackenzie
2016-11-15 22:13:46 UTC
Permalink
Hi, Philipp.
Post by Philipp Stephani
Post by Philipp Stephani
Hi,
here's another difference between CC-Mode 5.33 from SourceForge and the
one shipped with Emacs: Create a C++ buffer with the contents
int main() {
aa;
}
(note, no indent of the 'aa' statement)
Then, mark the buffer (C-x h) and hit TAB to indent. In the CC-Mode from
Emacs, 'aa;' gets indented, but not in the CC-Mode from SourceForge. Is
that a bug in the SourceForge version?
Thanks!
Friendly ping?
Sorry, I've been a bit preoccupied with things in the real world.

I don't think the situation you've described is a bug. The Emacs version
of CC Mode only indents the "aa;" when transient-mark-mode is enabled (I
think). The <tab> key is bound to different commands in the two versions
of CC Mode, c-indent-line and c-indent-line-or-region.

c-indent-line is the traditional binding for <tab> in CC Mode. There's
no particular reason emphatically to prefer either of the two bindings.
Each of them has its merits. c-i-l-o-r conforms to a fairly recent Emacs
convention about <tab> (which I don't believe exists in XEmacs), c-i-l
"does one thing and does it well".

It's a matter of taste, really. Maybe I should just change stand alone
CC Mode to c-i-l-o-r. But there's nothing stopping a user making this
key binding herself, say in c-initialization-hook.
--
Alan Mackenzie (Nuremberg, Germany).

------------------------------------------------------------------------------
Philipp Stephani
2016-11-23 19:38:36 UTC
Permalink
Post by Alan Mackenzie
Hi, Philipp.
um
Post by Philipp Stephani
Post by Philipp Stephani
Hi,
here's another difference between CC-Mode 5.33 from SourceForge and the
one shipped with Emacs: Create a C++ buffer with the contents
int main() {
aa;
}
(note, no indent of the 'aa' statement)
Then, mark the buffer (C-x h) and hit TAB to indent. In the CC-Mode
from
Post by Philipp Stephani
Post by Philipp Stephani
Emacs, 'aa;' gets indented, but not in the CC-Mode from SourceForge. Is
that a bug in the SourceForge version?
Thanks!
Friendly ping?
Sorry, I've been a bit preoccupied with things in the real world.
No worries, I'm very slow to respond myself. Just wanted to make sure you
didn't miss this.
Post by Alan Mackenzie
I don't think the situation you've described is a bug. The Emacs version
of CC Mode only indents the "aa;" when transient-mark-mode is enabled (I
think). The <tab> key is bound to different commands in the two versions
of CC Mode, c-indent-line and c-indent-line-or-region.
c-indent-line is the traditional binding for <tab> in CC Mode. There's
no particular reason emphatically to prefer either of the two bindings.
Each of them has its merits. c-i-l-o-r conforms to a fairly recent Emacs
convention about <tab> (which I don't believe exists in XEmacs), c-i-l
"does one thing and does it well".
It's a matter of taste, really. Maybe I should just change stand alone
CC Mode to c-i-l-o-r. But there's nothing stopping a user making this
key binding herself, say in c-initialization-hook.
Thanks for the explanation. Is there a document explaining the differences
between SourceForge and Emacs CC-Mode somewhere? If not, should this be
added to the manual?

Loading...