all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Ergus via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Alan Mackenzie <acm@muc.de>
Cc: 42319@debbugs.gnu.org
Subject: bug#42319: 28.0.50; c-mode issue with electric-pair-mode
Date: Sat, 11 Jul 2020 15:15:12 +0200	[thread overview]
Message-ID: <20200711131512.gur5wyzn5nlhibst@ergus> (raw)
In-Reply-To: <20200711102653.35732.qmail@mail.muc.de>

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





  reply	other threads:[~2020-07-11 13:15 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 [this message]
2020-07-12 10:54         ` Alan Mackenzie

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=20200711131512.gur5wyzn5nlhibst@ergus \
    --to=bug-gnu-emacs@gnu.org \
    --cc=42319@debbugs.gnu.org \
    --cc=acm@muc.de \
    --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.