From: Alan Mackenzie <acm@muc.de>
To: Ergus <spacibba@aol.com>
Cc: 42319@debbugs.gnu.org
Subject: bug#42319: 28.0.50; c-mode issue with electric-pair-mode
Date: Sun, 12 Jul 2020 10:54:59 +0000 [thread overview]
Message-ID: <20200712105459.GA10951@ACM> (raw)
In-Reply-To: <20200711131512.gur5wyzn5nlhibst@ergus>
Hello, Ergus.
On Sat, Jul 11, 2020 at 15:15:12 +0200, Ergus wrote:
> On Sat, Jul 11, 2020 at 10:26:53AM -0000, Alan Mackenzie wrote:
> >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.
The same also applies to structs and unions. Each of these constructs is
incomplete without the closing semicolon.
> Actually AFAIK without the `;` there is a syntax error if we insert
> anything else except for inline class/variable declarations like:
Precisely!
> class A {
> } var;
> or
> typedef class A {
> } type_A;
> But then the new line after the } should never be added?
You could well be right, here. I'd have to check carefully all the
things that can generate a 'class-close syntax before changing the
defaults.
> >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.
My experience is that there's virtually _no_ form of indentation which no
user wants. But I think I'll look at changing that default.
> >> 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.
No problems! Far better than there actually being a bug. ;-)
> >> 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.
I think that indentation is correct, even if a bit awkward. That's why
that cleanup is available. So, yes, I'll close the bug, thanks.
> Off-topic:
> I reported another issue (bug#42270) related with attributes and
> indentation. did you see it?
Yes, I started working on it on Thursday. Most of that time, I've "just
been an hour away from finishing it", so it didn't feel necessary to
acknowledge the bug. That was a mistake, sorry. Actually, there're
quite a few tricky things in there to sort out and clean up, so it could
take a few days yet.
> Very Thanks,
> Ergus
--
Alan Mackenzie (Nuremberg, Germany).
prev parent reply other threads:[~2020-07-12 10:54 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20200711083013.t2p6cocfgctcgsev.ref@ergus>
2020-07-11 8:30 ` bug#42319: 28.0.50; c-mode issue with electric-pair-mode Ergus via Bug reports for GNU Emacs, the Swiss army knife of text editors
[not found] ` <mailman.82.1594456263.2306.bug-gnu-emacs@gnu.org>
2020-07-11 10:26 ` Alan Mackenzie
2020-07-11 13:15 ` Ergus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-07-12 10:54 ` Alan Mackenzie [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200712105459.GA10951@ACM \
--to=acm@muc.de \
--cc=42319@debbugs.gnu.org \
--cc=spacibba@aol.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.