From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Vince West Newsgroups: gmane.emacs.bugs Subject: bug#52340: Improper auto-indentation in C++-mode Date: Mon, 6 Dec 2021 16:09:32 -0600 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="0000000000007f316505d2818402" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39953"; mail-complaints-to="usenet@ciao.gmane.io" To: 52340@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Dec 07 00:31:14 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1muNRy-000AE2-LM for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 07 Dec 2021 00:31:14 +0100 Original-Received: from localhost ([::1]:34228 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1muNRx-0005bn-54 for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 06 Dec 2021 18:31:13 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:45494) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1muNRn-0005b9-2b for bug-gnu-emacs@gnu.org; Mon, 06 Dec 2021 18:31:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:52349) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1muNRm-0000vB-RI for bug-gnu-emacs@gnu.org; Mon, 06 Dec 2021 18:31:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1muNRm-0006VV-Mn for bug-gnu-emacs@gnu.org; Mon, 06 Dec 2021 18:31:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Vince West Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 06 Dec 2021 23:31:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 52340 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.163883342824968 (code B ref -1); Mon, 06 Dec 2021 23:31:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 6 Dec 2021 23:30:28 +0000 Original-Received: from localhost ([127.0.0.1]:35662 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1muNRD-0006Ud-KP for submit@debbugs.gnu.org; Mon, 06 Dec 2021 18:30:28 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:39502) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1muMBR-0002GA-3V for submit@debbugs.gnu.org; Mon, 06 Dec 2021 17:10:05 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:60302) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1muMBQ-0007NG-34 for bug-gnu-emacs@gnu.org; Mon, 06 Dec 2021 17:10:04 -0500 Original-Received: from [2a00:1450:4864:20::42a] (port=41607 helo=mail-wr1-x42a.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1muMBN-0004sX-VT for bug-gnu-emacs@gnu.org; Mon, 06 Dec 2021 17:10:03 -0500 Original-Received: by mail-wr1-x42a.google.com with SMTP id a9so25291494wrr.8 for ; Mon, 06 Dec 2021 14:10:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:from:date:message-id:subject:to; bh=ro3h2F8acimtINQar3EsxegjN7ctxRzR1tJ8zy3CENw=; b=MXlUY65yt5zmNdHaaKlXcXc5wezUeWewaIrv1Gf3DiQzzvAagL+yBcZBndKCApkzfB /x40e5P9Hu+h1RI3eMG/BxsbZKyQcrQO0XeXCjrGODoRPDD8XT4+X3S1qlFRYvsRZBZT hTLB+wMOkRxsUNkaol8q4pNsf4Z8Flk95g+dZkEuCzUO5QCSIQkD3F3KdvlV6yiF/jCk 73dAr2YIVl5GjMc28jGql85gY30PZ3B16ZEUAP8JUeB51cQs8hl75E1WyD6qftstmL9Q qhhmhyEZflXC+HNTQoEieU2WmU4wk2ZgnszUC7Y6bI4Ik8Ct5g1bWbJFD0eB698TFRrU NtwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=ro3h2F8acimtINQar3EsxegjN7ctxRzR1tJ8zy3CENw=; b=Qwph2L/llMQzHGAjlzFdxqVtC02Hp95/ELqXpcT1UMmx12XLQUk3Rh+K3YlqUjOOAy B9IzvX4/Ql55o0BVMlFZkapDP3czLjfDtKc7vINya4lUudI/lYt+G3zNbcWr096shPC+ Ts36dMH66HluAalo+fgRZsHuzlXlVpzWy4KL34/KomExEpOKp2s7qJ0DwnYa+ge4Lw/G /YQ43YMwuZxrdwXASLwrLvjX6b91CxaNf8jpY/Z07p5xJl5N4GAKbzULLXh+9brnU/G8 hdZRMjxOWuhb7oXKgQZWiLrkpQAYEpQpKWbclYyt4qmR9woJSgY85md0BSH2DrcwJ55J q3Ew== X-Gm-Message-State: AOAM531RwE6reMalyA/kSNWBIoRJd4+Lj5+68bG9zWyPSJcTaILoGPuY PaMzoV6pJMtI3XvcB993Zs3EJ5u0YCfZHSXHRH4JLI/cX/0= X-Google-Smtp-Source: ABdhPJzXG0Z/LJQ9rJTYgFG0IyQC/PiPQJK9cvqcD9QKTl2hk3hjZNIxpOGO+L3HB0tfbO1LWzcEW63d/KS+scolhOw= X-Received: by 2002:adf:e391:: with SMTP id e17mr45982431wrm.613.1638828599094; Mon, 06 Dec 2021 14:09:59 -0800 (PST) X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::42a (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::42a; envelope-from=dvincentwest@gmail.com; helo=mail-wr1-x42a.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, PDS_HP_HELO_NORDNS=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Mon, 06 Dec 2021 18:30:27 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:221795 Archived-At: --0000000000007f316505d2818402 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable `indent-region` is giving some weird results in c++-mode. I will just paste the main function here: ```C++ int main() { // looks good to me float nums[9] =3D { 1., 2., 3., 4., 5., 6., 7., 8., 9., }; // wtf float * numsp =3D new float[9] { 1., 2., 3., 4., 5., 6., 7., 8., 9., }; } ``` In c-mode, the indentation looks fine: ```C int main() { // looks good to me float nums[9] =3D { 1., 2., 3., 4., 5., 6., 7., 8., 9., }; // looks fine in C-mode float * numsp =3D new float[9] { 1., 2., 3., 4., 5., 6., 7., 8., 9., }; } ``` In GNU Emacs 27.2 (build 1, x86_64-apple-darwin18.7.0, NS appkit-1671.60 Version 10.14.6 (Build 18G95)) of 2021-03-27 built on builder10-14.porkrind.org Windowing system distributor 'Apple', version 10.3.2022 System Description: macOS 11.6.1 Recent messages: Undo Making completion list... Indenting region... done You can run the command =E2=80=98indent-region=E2=80=99 with C-M-\ Indenting region... done previous-line: Beginning of buffer Mark activated Indenting region... done previous-line: Beginning of buffer [2 times] Making completion list... [2 times] Configured using: 'configure --with-ns '--enable-locallisppath=3D/Library/Application Support/Emacs/${version}/site-lisp:/Library/Application Support/Emacs/site-lisp' --with-modules' Configured features: NOTIFY KQUEUE ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS NS MODULES THREADS JSON PDUMPER GMP Important settings: value of $LANG: en_US.UTF-8 locale-coding-system: utf-8-unix 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 emacsbug sendmail mail-extr 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 mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045 mm-util ietf-drums mail-prsvr mailabbrev mail-utils gmm-utils mailheader thingatpt cl-extra seq byte-opt gv bytecomp byte-compile cconv help-mode novice 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 tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel term/ns-win ns-win ucs-normalize mule-util 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 kqueue cocoa ns multi-tty make-network-process emacs) Memory information: ((conses 16 69710 8231) (symbols 48 8632 1) (strings 32 22129 1555) (string-bytes 1 831409) (vectors 16 13165) (vector-slots 8 160910 15816) (floats 8 31 31) (intervals 56 433 6) (buffers 1000 14)) --0000000000007f316505d2818402 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

`indent-region` is giving some weird results in c++-mo= de.=C2=A0 I will just
paste the main function here:

```C++
int main() {

=C2=A0 // looks good to me
=C2= =A0 float nums[9] =3D
=C2=A0 =C2=A0 {
=C2=A0 =C2=A0 =C2=A0 1., 2., 3.= ,
=C2=A0 =C2=A0 =C2=A0 4., 5., 6.,
=C2=A0 =C2=A0 =C2=A0 7., 8., 9.,=C2=A0 =C2=A0 };

=C2=A0 // wtf
=C2=A0 float * numsp =3D new flo= at[9]
=C2=A0 {
=C2=A0 =C2=A0 1., 2., 3.,
=C2=A0 =C2=A0 =C2=A0 4., = 5., 6.,
=C2=A0 =C2=A0 =C2=A0 7., 8., 9.,
=C2=A0 =C2=A0 =C2=A0 };
<= br>}
```


In c-mode, the indentation looks fine:
```C
int main() {

=C2=A0 // looks good to me=C2=A0 float nums[9] =3D
=C2=A0 =C2=A0 {
=C2=A0 =C2=A0 =C2=A0 1., 2.= , 3.,
=C2=A0 =C2=A0 =C2=A0 4., 5., 6.,
=C2=A0 =C2=A0 =C2=A0 7., 8., 9= .,
=C2=A0 =C2=A0 };

=C2=A0 // looks fine in C-mode
=C2=A0 floa= t * numsp =3D new float[9]
=C2=A0 =C2=A0 {
=C2=A0 =C2=A0 =C2=A0 1., 2= ., 3.,
=C2=A0 =C2=A0 =C2=A0 4., 5., 6.,
=C2=A0 =C2=A0 =C2=A0 7., 8., = 9.,
=C2=A0 =C2=A0 };

}

```



In GNU Emacs = 27.2 (build 1, x86_64-apple-darwin18.7.0, NS appkit-1671.60 Version 10.14.6= (Build 18G95))
=C2=A0of 2021-03-27 built on builder10-14.porkrind.org
Windowing system distrib= utor 'Apple', version 10.3.2022
System Description: =C2=A0macOS = 11.6.1

Recent messages:
Undo
Making completion list...
Inde= nting region... done
You can run the command =E2=80=98indent-region=E2= =80=99 with C-M-\
Indenting region... done
previous-line: Beginning o= f buffer
Mark activated
Indenting region... done
previous-line: Be= ginning of buffer [2 times]
Making completion list... [2 times]

C= onfigured using:
=C2=A0'configure --with-ns '--enable-locallispp= ath=3D/Library/Application
=C2=A0Support/Emacs/${version}/site-lisp:/Lib= rary/Application
=C2=A0Support/Emacs/site-lisp' --with-modules'<= br>
Configured features:
NOTIFY KQUEUE ACL GNUTLS LIBXML2 ZLIB TOOLKI= T_SCROLL_BARS NS MODULES
THREADS JSON PDUMPER GMP

Important setti= ngs:
=C2=A0 value of $LANG: en_US.UTF-8
=C2=A0 locale-coding-system: = utf-8-unix

Major mode: C++//l

Minor modes in effect:
=C2= =A0 tooltip-mode: t
=C2=A0 global-eldoc-mode: t
=C2=A0 electric-inden= t-mode: t
=C2=A0 mouse-wheel-mode: t
=C2=A0 tool-bar-mode: t
=C2= =A0 menu-bar-mode: t
=C2=A0 file-name-shadow-mode: t
=C2=A0 global-fo= nt-lock-mode: t
=C2=A0 font-lock-mode: t
=C2=A0 blink-cursor-mode: t<= br>=C2=A0 auto-composition-mode: t
=C2=A0 auto-encryption-mode: t
=C2= =A0 auto-compression-mode: t
=C2=A0 line-number-mode: t
=C2=A0 transi= ent-mark-mode: t
=C2=A0 abbrev-mode: t

Load-path shadows:
None= found.

Features:
(shadow sort emacsbug sendmail mail-extr messag= e rmc puny dired
dired-loaddefs format-spec rfc822 mml mml-sec password-= cache epa derived
epg epg-config gnus-util rmail rmail-loaddefs text-pro= perty-search
time-date subr-x mm-decode mm-bodies mm-encode mail-parse r= fc2231
rfc2047 rfc2045 mm-util ietf-drums mail-prsvr mailabbrev mail-uti= ls
gmm-utils mailheader thingatpt cl-extra seq byte-opt gv bytecomp
b= yte-compile cconv help-mode novice 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 tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-ty= pe mwheel term/ns-win ns-win ucs-normalize mule-util
term/common-win too= l-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomm= ent 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 c= ham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao k= orean japanese eucjp-ms
cp51932 hebrew greek romanian slovak czech europ= ean ethiopic indian
cyrillic chinese composite charscript charprop case-= table epa-hook
jka-cmpr-hook help simple abbrev obarray cl-preloaded nad= vice loaddefs
button faces cus-face macroexp files text-properties overl= ay sha1 md5
base64 format env code-pages mule custom widget hashtable-pr= int-readable
backquote threads kqueue cocoa ns multi-tty make-network-pr= ocess emacs)

Memory information:
((conses 16 69710 8231)
=C2= =A0(symbols 48 8632 1)
=C2=A0(strings 32 22129 1555)
=C2=A0(string-by= tes 1 831409)
=C2=A0(vectors 16 13165)
=C2=A0(vector-slots 8 160910 1= 5816)
=C2=A0(floats 8 31 31)
=C2=A0(intervals 56 433 6)
=C2=A0(buf= fers 1000 14))
--0000000000007f316505d2818402--