GNU bug report logs - #48992
cc-mode initialize list indentation bug

Previous Next

Packages: cc-mode, emacs;

Reported by: 王斌波 <binbowang1987 <at> 163.com>

Date: Sun, 13 Jun 2021 00:13:01 UTC

Severity: minor

Tags: fixed

Fixed in version 28.1

Done: Stefan Kangas <stefan <at> marxist.se>

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 48992 in the body.
You can then email your comments to 48992 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 bug-gnu-emacs <at> gnu.org:
bug#48992; Package emacs. (Sun, 13 Jun 2021 00:13:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to 王斌波 <binbowang1987 <at> 163.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 13 Jun 2021 00:13:02 GMT) Full text and rfc822 format available.

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

From: 王斌波 <binbowang1987 <at> 163.com>
To: "bug-gnu-emacs <at> gnu.org" <bug-gnu-emacs <at> gnu.org>
Subject: cc-mode initialize list indentation bug
Date: Sun, 13 Jun 2021 07:29:55 +0800 (GMT+08:00)
[Message part 1 (text/plain, inline)]
class A {
public:
  static std::set<int> setA;
};


std::set<int> A::setA {
  1,
    2,
    3
}


The indentation in setA initialize list is not correct. I want it like the following.
class A {
public:
  static std::set<int> setA;
};


std::set<int> A::setA {
  1,
  2,
  3
}




In GNU Emacs 27.1 (build 1, x86_64-w64-mingw32)
 of 2020-08-22 built on CIRROCUMULUS
Repository revision: 86d8d76aa36037184db0b2897c434cdaab1a9ae8
Repository branch: HEAD
Windowing system distributor 'Microsoft Corp.', version 10.0.19042
System Description: Microsoft Windows 10 Pro (v10.0.2009.19042.1052)


Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Quit
Mark set [3 times]
(New file)
next-line: End of buffer
Saving file d:/test-indent.cpp...
Wrote d:/test-indent.cpp
Making completion list...


Configured using:
 'configure --without-dbus --host=x86_64-w64-mingw32
 --without-compress-install 'CFLAGS=-O2 -static''


Configured features:
XPM JPEG TIFF GIF PNG RSVG SOUND NOTIFY W32NOTIFY ACL GNUTLS LIBXML2
HARFBUZZ ZLIB TOOLKIT_SCROLL_BARS MODULES THREADS JSON PDUMPER LCMS2 GMP


Important settings:
  value of $LANG: CHS
  locale-coding-system: cp936


Major mode: C++//l


Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t
  abbrev-mode: t


Load-path shadows:
None found.


Features:
(shadow sort mail-extr emacsbug message rmc puny dired dired-loaddefs
format-spec rfc822 mml mml-sec password-cache epa derived epg epg-config
gnus-util rmail rmail-loaddefs text-property-search time-date subr-x seq
byte-opt gv bytecomp byte-compile cconv mm-decode mm-bodies mm-encode
mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047
rfc2045 ietf-drums mm-util mail-prsvr mail-utils cc-mode cc-fonts
easymenu cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars
cc-defs cl-loaddefs cl-lib china-util tooltip eldoc electric uniquify
ediff-hook vc-hooks lisp-float-type mwheel dos-w32 ls-lisp disp-table
term/w32-win w32-win w32-vars term/common-win tool-bar dnd fontset image
regexp-opt fringe tabulated-list replace newcomment text-mode elisp-mode
lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch
timer select scroll-bar mouse jit-lock font-lock syntax facemenu
font-core term/tty-colors frame minibuffer cl-generic cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese composite charscript charprop
case-table epa-hook jka-cmpr-hook help simple abbrev obarray
cl-preloaded nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote threads w32notify w32
lcms2 multi-tty make-network-process emacs)


Memory information:
((conses 16 70013 6507)
 (symbols 48 8690 1)
 (strings 32 23033 1767)
 (string-bytes 1 829378)
 (vectors 16 12421)
 (vector-slots 8 210397 12036)
 (floats 8 24 228)
 (intervals 56 453 4)
 (buffers 1000 13))



[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org, bug-cc-mode <at> gnu.org:
bug#48992; Package emacs,cc-mode. (Sat, 21 Aug 2021 17:58:01 GMT) Full text and rfc822 format available.

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

From: Alan Mackenzie <acm <at> muc.de>
To: 王斌波 <binbowang1987 <at> 163.com>
Cc: acm <at> muc.de, 48992 <at> debbugs.gnu.org
Subject: Re: bug#48992: cc-mode initialize list indentation bug
Date: Sat, 21 Aug 2021 17:57:33 +0000
[Message part 1 (text/plain, inline)]
Hello, Binbowang.

On Sun, Jun 13, 2021 at 07:29:55 +0800, 王斌波 wrote:
> class A {
> public:
>   static std::set<int> setA;
> };


> std::set<int> A::setA {
>   1,
>     2,
>     3
> }


> The indentation in setA initialize list is not correct. I want it like the following.
> class A {
> public:
>   static std::set<int> setA;
> };


> std::set<int> A::setA {
>   1,
>   2,
>   3
> }

The indentation was indeed incorrect.  CC Mode was mis-analysing the
brace list as a function.  I think the patch attached should fix this.

Would you please apply the patch to your CC Mode (in directory
..../emacs/lisp/progmodes), byte compile that file, load it into your
Emacs and try it out on your real C++ source code.  Then please let me
know if the bug is indeed fixed.  (If you would like any help with the
patching or byte compilation, feel free to send me private email.)


> In GNU Emacs 27.1 (build 1, x86_64-w64-mingw32)
>  of 2020-08-22 built on CIRROCUMULUS
> Repository revision: 86d8d76aa36037184db0b2897c434cdaab1a9ae8
> Repository branch: HEAD
> Windowing system distributor 'Microsoft Corp.', version 10.0.19042
> System Description: Microsoft Windows 10 Pro (v10.0.2009.19042.1052)

[ .... ]

-- 
Alan Mackenzie (Nuremberg, Germany).

[diff.20210821.diff (text/plain, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org, bug-cc-mode <at> gnu.org:
bug#48992; Package emacs,cc-mode. (Sat, 28 Aug 2021 05:38:02 GMT) Full text and rfc822 format available.

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

From: 王斌波 <binbowang1987 <at> 163.com>
To: "acm <at> muc.de" <acm <at> muc.de>
Cc: "acm <at> muc.de" <acm <at> muc.de>, "48992 <at> debbugs.gnu.org" <48992 <at> debbugs.gnu.org>
Subject: Re:  bug#48992: cc-mode initialize list indentation bug
Date: Sat, 28 Aug 2021 09:40:20 +0800 (GMT+08:00)
[Message part 1 (text/plain, inline)]
Hello, Alan.
  Thank you for your great work. I applyed the path, and the problem fixed. What i did is like this:
  1. apply the patch
  2. recompile the cc-engine.el
  3. restart emacs, edit a real cpp file. The indentation was correct now.


Binbo Wang (ChongQing, China).
On 8/22/2021 01:57,Alan Mackenzie<acm <at> muc.de> wrote:
Hello, Binbowang.

On Sun, Jun 13, 2021 at 07:29:55 +0800, 王斌波 wrote:
class A {
public:
static std::set<int> setA;
};


std::set<int> A::setA {
1,
2,
3
}


The indentation in setA initialize list is not correct. I want it like the following.
class A {
public:
static std::set<int> setA;
};


std::set<int> A::setA {
1,
2,
3
}

The indentation was indeed incorrect.  CC Mode was mis-analysing the
brace list as a function.  I think the patch attached should fix this.

Would you please apply the patch to your CC Mode (in directory
..../emacs/lisp/progmodes), byte compile that file, load it into your
Emacs and try it out on your real C++ source code.  Then please let me
know if the bug is indeed fixed.  (If you would like any help with the
patching or byte compilation, feel free to send me private email.)


In GNU Emacs 27.1 (build 1, x86_64-w64-mingw32)
of 2020-08-22 built on CIRROCUMULUS
Repository revision: 86d8d76aa36037184db0b2897c434cdaab1a9ae8
Repository branch: HEAD
Windowing system distributor 'Microsoft Corp.', version 10.0.19042
System Description: Microsoft Windows 10 Pro (v10.0.2009.19042.1052)

[ .... ]

--
Alan Mackenzie (Nuremberg, Germany).

[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org, bug-cc-mode <at> gnu.org:
bug#48992; Package emacs,cc-mode. (Sun, 29 Aug 2021 14:57:02 GMT) Full text and rfc822 format available.

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

From: Alan Mackenzie <acm <at> muc.de>
To: 王斌波 <binbowang1987 <at> 163.com>
Cc: "48992-done <at> debbugs.gnu.org" <48992 <at> debbugs.gnu.org>
Subject: Re: bug#48992: cc-mode initialize list indentation bug
Date: Sun, 29 Aug 2021 14:56:17 +0000
Hello, Binbo.

On Sat, Aug 28, 2021 at 09:40:20 +0800, 王斌波 wrote:
> Hello, Alan.
>   Thank you for your great work. I applyed the path, and the problem fixed. What i did is like this:
>   1. apply the patch
>   2. recompile the cc-engine.el
>   3. restart emacs, edit a real cpp file. The indentation was correct now.

Thank you indeed for carrying out these tests.  I have merged the patch
into the Emacs master branch, and I am thus closing the bug with this
post.

> Binbo Wang (ChongQing, China).
> On 8/22/2021 01:57,Alan Mackenzie<acm <at> muc.de> wrote:
> Hello, Binbowang.

-- 
Alan Mackenzie (Nuremberg, Germany).




Added tag(s) fixed. Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Wed, 29 Sep 2021 11:50:02 GMT) Full text and rfc822 format available.

bug marked as fixed in version 28.1, send any further explanations to 48992 <at> debbugs.gnu.org and 王斌波 <binbowang1987 <at> 163.com> Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Wed, 29 Sep 2021 11:50:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 28 Oct 2021 11:24:08 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 318 days ago.

Previous Next


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