GNU bug report logs - #35347
CC Mode 5.33.2 (C++//l); An improper space is being added to the tabbing of a access specifier label inside of a class.

Previous Next

Package: cc-mode;

Reported by: Dylan Johnson <dylanatasmsa <at> gmail.com>

Date: Sat, 20 Apr 2019 18:08:02 UTC

Severity: normal

Tags: notabug

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

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 35347 in the body.
You can then email your comments to 35347 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to help-debbugs <at> gnu.org:
bug#35347; Package debbugs.gnu.org. (Sat, 20 Apr 2019 18:08:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Dylan Johnson <dylanatasmsa <at> gmail.com>:
New bug report received and forwarded. Copy sent to help-debbugs <at> gnu.org. (Sat, 20 Apr 2019 18:08:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Dylan Johnson <dylanatasmsa <at> gmail.com>
To: submit <at> debbugs.gnu.org
Subject: CC Mode 5.33.2 (C++//l); An improper space is being added to the
 tabbing of a access specifier label inside of a class.
Date: Sat, 20 Apr 2019 11:50:25 -0600
[Message part 1 (text/plain, inline)]
When you define a class with a macro between the ``class'' specifier and

the name of the class you will observe that the access labels ``public:''

and ``private:'' are interpreted as a labels by the autoformatter

and an incorrect space is added to its tabbing. Attempts to correct this

with ``C - c C - o'' failed.


Here is an example:


\\\


class TEST_MACRO Test_class

{

public:

Test_class();

virtual ~Test_class();

void method1();

int member1();

};


\\\


Thanks,

Dylan


Emacs : GNU Emacs 26.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.5)

of 2019-04-13

Package: CC Mode 5.33.2 (C++//l)

Buffer Style: gnu

c-emacs-features: (pps-extended-state col-0-paren posix-char-classes
gen-string-delim gen-comment-delim syntax-properties 1-bit)


current state:

==============

(setq

c-basic-offset 2

c-comment-only-line-offset '(0 . 0)

c-indent-comment-alist '((anchored-comment column . 0) (end-block space . 1)

(cpp-end-block space . 2))

c-indent-comments-syntactically-p nil

c-block-comment-prefix ""

c-comment-prefix-regexp '((pike-mode . "//+!?\\|\\**") (awk-mode . "
[Message part 2 (text/html, inline)]

bug reassigned from package 'debbugs.gnu.org' to 'cc-mode'. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Sat, 20 Apr 2019 18:09:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-cc-mode <at> gnu.org:
bug#35347; Package cc-mode. (Sat, 20 Apr 2019 18:43:01 GMT) Full text and rfc822 format available.

Message #10 received at 35347 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: 35347 <at> debbugs.gnu.org
Cc: Dylan Johnson <dylanatasmsa <at> gmail.com>
Subject: Re: bug#35347: CC Mode 5.33.2 (C++//l);
 An improper space is being added to the tabbing of a access specifier
 label inside of a class.
Date: Sat, 20 Apr 2019 14:41:55 -0400
Report reassigned to cc-mode.

Dylan Johnson wrote:

> When you define a class with a macro between the ``class'' specifier and
>
> the name of the class you will observe that the access labels ``public:''
>
> and ``private:'' are interpreted as a labels by the autoformatter
>
> and an incorrect space is added to its tabbing. Attempts to correct this
>
> with ``C - c C - o'' failed.
>
>
> Here is an example:
>
>
> \\\
>
>
> class TEST_MACRO Test_class
>
> {
>
> public:
>
> Test_class();
>
> virtual ~Test_class();
>
> void method1();
>
> int member1();
>
> };
>
>
> \\\
>
>
> Thanks,
>
> Dylan
>
>
> Emacs : GNU Emacs 26.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.5)
>
> of 2019-04-13
>
> Package: CC Mode 5.33.2 (C++//l)
>
> Buffer Style: gnu
>
> c-emacs-features: (pps-extended-state col-0-paren posix-char-classes
> gen-string-delim gen-comment-delim syntax-properties 1-bit)
>
>
> current state:
>
> ==============
>
> (setq
>
> c-basic-offset 2
>
> c-comment-only-line-offset '(0 . 0)
>
> c-indent-comment-alist '((anchored-comment column . 0) (end-block space . 1)
>
> (cpp-end-block space . 2))
>
> c-indent-comments-syntactically-p nil
>
> c-block-comment-prefix ""
>
> c-comment-prefix-regexp '((pike-mode . "//+!?\\|\\**") (awk-mode . "




Information forwarded to bug-cc-mode <at> gnu.org:
bug#35347; Package cc-mode. (Sat, 20 Apr 2019 19:10:01 GMT) Full text and rfc822 format available.

Message #13 received at 35347 <at> debbugs.gnu.org (full text, mbox):

From: Alan Mackenzie <acm <at> muc.de>
To: Dylan Johnson <dylanatasmsa <at> gmail.com>
Cc: 35347 <at> debbugs.gnu.org
Subject: Re: bug#35347: CC Mode 5.33.2 (C++//l); An improper space is being
 added to the tabbing of a access specifier label inside of a class.
Date: Sat, 20 Apr 2019 19:09:19 +0000
Hello, Dylan.

On Sat, Apr 20, 2019 at 11:50:25 -0600, Dylan Johnson wrote:
> When you define a class with a macro between the ``class'' specifier and
> the name of the class you will observe that the access labels ``public:''
> and ``private:'' are interpreted as a labels by the autoformatter
> and an incorrect space is added to its tabbing. Attempts to correct this
> with ``C - c C - o'' failed.

> Here is an example:

> \\\

> class TEST_MACRO Test_class
> {
> public:
> Test_class();
> virtual ~Test_class();
> void method1();
> int member1();
> };

> \\\

I think you need to register "TEST_MACRO" as a "noise macro", i.e. one
which takes up space, but has no syntactic significance.  The best place
for this is probably in a mode hook (either c++-mode-hook or
c-mode-common-hook), and the Lisp code to do it will look something like:

(defun dj-c-mode-common-hook ()
  (push "TEST_MACRO" c-noise-macro-names)
  (c-make-noise-macro-regexps))
(add-hook 'c-mode-common-hook 'dj-c-mode-common-hook)

.  It's all explained in the fantastic manual, the CC Mode manual, on
page "Noise Macros".

Please let us know how well this works.  If it doesn't work, then we've
probably got a bug to fix.

Thanks for the report!

> Thanks,

> Dylan


> Emacs : GNU Emacs 26.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.5)
> of 2019-04-13
> Package: CC Mode 5.33.2 (C++//l)
> Buffer Style: gnu
> c-emacs-features: (pps-extended-state col-0-paren posix-char-classes
> gen-string-delim gen-comment-delim syntax-properties 1-bit)

> current state:
> ==============
> (setq
> c-basic-offset 2
> c-comment-only-line-offset '(0 . 0)
> c-indent-comment-alist '((anchored-comment column . 0) (end-block space . 1)
> (cpp-end-block space . 2))
> c-indent-comments-syntactically-p nil
> c-block-comment-prefix ""
> c-comment-prefix-regexp '((pike-mode . "//+!?\\|\\**") (awk-mode . "

-- 
Alan Mackenzie (Nuremberg, Germany).




Information forwarded to bug-cc-mode <at> gnu.org:
bug#35347; Package cc-mode. (Sat, 20 Apr 2019 21:04:01 GMT) Full text and rfc822 format available.

Message #16 received at 35347 <at> debbugs.gnu.org (full text, mbox):

From: Dylan Johnson <dylanatasmsa <at> gmail.com>
To: Alan Mackenzie <acm <at> muc.de>
Cc: 35347 <at> debbugs.gnu.org
Subject: Re: bug#35347: CC Mode 5.33.2 (C++//l); An improper space is being
 added to the tabbing of a access specifier label inside of a class.
Date: Sat, 20 Apr 2019 15:02:47 -0600
[Message part 1 (text/plain, inline)]
Alan,

I was not aware of this cc-mode feature. It resolved my issue.

Thanks,
Dylan



On Sat, Apr 20, 2019 at 1:09 PM Alan Mackenzie <acm <at> muc.de> wrote:

> Hello, Dylan.
>
> On Sat, Apr 20, 2019 at 11:50:25 -0600, Dylan Johnson wrote:
> > When you define a class with a macro between the ``class'' specifier and
> > the name of the class you will observe that the access labels ``public:''
> > and ``private:'' are interpreted as a labels by the autoformatter
> > and an incorrect space is added to its tabbing. Attempts to correct this
> > with ``C - c C - o'' failed.
>
> > Here is an example:
>
> > \\\
>
> > class TEST_MACRO Test_class
> > {
> > public:
> > Test_class();
> > virtual ~Test_class();
> > void method1();
> > int member1();
> > };
>
> > \\\
>
> I think you need to register "TEST_MACRO" as a "noise macro", i.e. one
> which takes up space, but has no syntactic significance.  The best place
> for this is probably in a mode hook (either c++-mode-hook or
> c-mode-common-hook), and the Lisp code to do it will look something like:
>
> (defun dj-c-mode-common-hook ()
>   (push "TEST_MACRO" c-noise-macro-names)
>   (c-make-noise-macro-regexps))
> (add-hook 'c-mode-common-hook 'dj-c-mode-common-hook)
>
> .  It's all explained in the fantastic manual, the CC Mode manual, on
> page "Noise Macros".
>
> Please let us know how well this works.  If it doesn't work, then we've
> probably got a bug to fix.
>
> Thanks for the report!
>
> > Thanks,
>
> > Dylan
>
>
> > Emacs : GNU Emacs 26.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version
> 3.24.5)
> > of 2019-04-13
> > Package: CC Mode 5.33.2 (C++//l)
> > Buffer Style: gnu
> > c-emacs-features: (pps-extended-state col-0-paren posix-char-classes
> > gen-string-delim gen-comment-delim syntax-properties 1-bit)
>
> > current state:
> > ==============
> > (setq
> > c-basic-offset 2
> > c-comment-only-line-offset '(0 . 0)
> > c-indent-comment-alist '((anchored-comment column . 0) (end-block space
> . 1)
> > (cpp-end-block space . 2))
> > c-indent-comments-syntactically-p nil
> > c-block-comment-prefix ""
> > c-comment-prefix-regexp '((pike-mode . "//+!?\\|\\**") (awk-mode . "
>
> --
> Alan Mackenzie (Nuremberg, Germany).
>
[Message part 2 (text/html, inline)]

Added tag(s) notabug. Request was from Alan Mackenzie <acm <at> muc.de> to control <at> debbugs.gnu.org. (Sun, 21 Apr 2019 09:48:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 35347 <at> debbugs.gnu.org and Dylan Johnson <dylanatasmsa <at> gmail.com> Request was from Alan Mackenzie <acm <at> muc.de> to control <at> debbugs.gnu.org. (Sun, 21 Apr 2019 09:48:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-cc-mode <at> gnu.org:
bug#35347; Package cc-mode. (Sun, 21 Apr 2019 10:07:01 GMT) Full text and rfc822 format available.

Message #23 received at 35347 <at> debbugs.gnu.org (full text, mbox):

From: Alan Mackenzie <acm <at> muc.de>
To: Dylan Johnson <dylanatasmsa <at> gmail.com>
Cc: 35347 <at> debbugs.gnu.org
Subject: Re: bug#35347: CC Mode 5.33.2 (C++//l); An improper space is being
 added to the tabbing of a access specifier label inside of a class.
Date: Sun, 21 Apr 2019 10:06:46 +0000
Hello again, Dylan.

On Sat, Apr 20, 2019 at 15:02:47 -0600, Dylan Johnson wrote:
> Alan,

> I was not aware of this cc-mode feature. It resolved my issue.

That's great to hear!

I've closed the bug as "not a bug".

But I do wonder whether some documentation for "noise macros" could be
improved, somehow, maybe writing something about them somewhere where it
would get read.  Macros are a problem in the C/C++/... family, since
they can expand to literally anything (including nothing), making it
difficult to analyse their "syntax".

Thanks again for the report!

> Thanks,
> Dylan

-- 
Alan Mackenzie (Nuremberg, Germany).




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 19 May 2019 11:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 341 days ago.

Previous Next


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