[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#42319: 28.0.50; c-mode issue with electric-pair-mode
From: |
Ergus |
Subject: |
bug#42319: 28.0.50; c-mode issue with electric-pair-mode |
Date: |
Sat, 11 Jul 2020 15:15:12 +0200 |
User-agent: |
NeoMutt/20180716 |
On Sat, Jul 11, 2020 at 10:26:53AM -0000, Alan Mackenzie wrote:
Hello, Ergus.
This happens because of the missing semicolon after the class. CC Mode
indents the otherwise empty line as a 'topmost-intro-cont line,
I supposed so.
since it appears still to be within the class.
But this is an issue right? because after that } it is already out of
the class; ... even without the `;` there is not a class scope to indent
right? The same applies to nested classes.
Actually AFAIK without the `;` there is a syntax error if we insert
anything else except for inline class/variable declarations like:
class A {
} var;
or
typedef class A {
} type_A;
But then the new line after the } should never be added?
One workaround for this is to
configure CC Mode not to insert a newline after this particular type of
brace. For example
(push '(class-close before) c-hanging-braces-alist)
, to try it out (it's a buffer local variable).
This works, thanks. I think that this should be the default as it is the
most general/expected behavior and doesn't insert extra
newline/spaces. This work around seems to be a cleaner solution than the
cleanup ;p because it works easier for:
=========
For: };
class A {
};
#
=========
And for: } var;
class A {
} var;
#
I think the user never wants this:
==========
class A {
}
;
#
=========
or
=========
class A {
}
var;
#
And for sure not this:
=========
class A {
}
var;
#
=========
But I am probably wrong.
The problem is actually worst if defun-close-semi is in c-cleanup-list
because it doesn't work.
That surprises me. It works for me, here. What happens/fails to happen
in these circumstances?
Ohh, my bad. I forgot to add defun-close-semi when using -Q for
reporting. So please forget it and forgive me.
I need to remove the extra spaces first to make it work.
That indeed feels like a bug. Could you perhaps post your CC Mode
configuration (generated by C-c C-b), please, which should help me to
reproduce the bug.
I discovered myself error with this... very useful. Thanks.
So probably if you don't think that the extra indentation is an issue
you can close this bug.
Off-topic:
I reported another issue (bug#42270) related with attributes and
indentation. did you see it?
Very Thanks,
Ergus