From unknown Mon Jun 23 18:32:43 2025 X-Loop: help-debbugs@gnu.org Subject: bug#24431: 25.1.50; Wrong indentation in C++ mode when calling constructors with braces Resent-From: Matthias Meulien Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 13 Sep 2016 21:12:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 24431 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 24431@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.147380111814326 (code B ref -1); Tue, 13 Sep 2016 21:12:02 +0000 Received: (at submit) by debbugs.gnu.org; 13 Sep 2016 21:11:58 +0000 Received: from localhost ([127.0.0.1]:58954 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bjuzl-0003j0-Rh for submit@debbugs.gnu.org; Tue, 13 Sep 2016 17:11:58 -0400 Received: from eggs.gnu.org ([208.118.235.92]:49566) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bjuzj-0003il-TC for submit@debbugs.gnu.org; Tue, 13 Sep 2016 17:11:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bjuzd-0001Di-Jd for submit@debbugs.gnu.org; Tue, 13 Sep 2016 17:11:50 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: * X-Spam-Status: No, score=1.3 required=5.0 tests=BAYES_50,FREEMAIL_FROM, RCVD_IN_SORBS_SPAM,T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:57444) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bjuzd-0001Cp-H0 for submit@debbugs.gnu.org; Tue, 13 Sep 2016 17:11:49 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40520) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bjuza-0000WF-Uj for bug-gnu-emacs@gnu.org; Tue, 13 Sep 2016 17:11:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bjuzW-000193-KU for bug-gnu-emacs@gnu.org; Tue, 13 Sep 2016 17:11:45 -0400 Received: from mail-wm0-f50.google.com ([74.125.82.50]:38307) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bjuzW-0000xE-DQ for bug-gnu-emacs@gnu.org; Tue, 13 Sep 2016 17:11:42 -0400 Received: by mail-wm0-f50.google.com with SMTP id 1so224105120wmz.1 for ; Tue, 13 Sep 2016 14:11:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:subject:from:to:date:mime-version :content-transfer-encoding; bh=Y08oYXM+f9InF9MlTfor010qWiwf3/GQOqbNfzO8BU4=; b=nvX+zikPlu7CpgVeAtnBrHlPrUXzv7nfGnBfgEGJx1fHfx37iLBoYDPOPlimskD168 uu0uUp5VWFj5nEY0GV5qcWlXjoTROQ6qib72zfDpgjBArYGhD2lSJ5OW7Yrgls9Ee64z 0mfCfk9gL4BQWB+tXAUxAeX+pDI9AhK0Vu1RHehc3vCq16r3tyxbq0T8AExbwXci37jk tJoyjRFAS3lQYF3RiutxNfxfdviLLD1FSEtdWtl1SvDB2kdxzCpZHJJw2TEwqZL6yPiE 1cJ5mcrL81PIh23RN/r+8icA7hd6OGI9ZBqBPsW8kDiriLfgX4NztzA48cJqy5PKZB1C cXWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:subject:from:to:date:mime-version :content-transfer-encoding; bh=Y08oYXM+f9InF9MlTfor010qWiwf3/GQOqbNfzO8BU4=; b=CSDdHvzyTH+8IXyvntmO97oazU+/2lhpiHjtLUstLzmOS/ubhCtkqsztsI0Ji3zDh/ UiOYFkJZDHVK6zexftdmuo5wV9+ApMdwvYjV5dbgM4eQi3VZryU5NPJ3rBbBJAdTnR1V XPdysYLraS2xIlXOtIRZXWeRKv5EPspWt9eKVeQxX2CrB4e46V0L+BtuWj3uVRLIalce 7wkKtiS4reyrc9aWK2i8Jqoete7BYhK2/yqS361yrfCEZy/2DPTB9xm60acKMjRFv/9x vUlH7hT+2e4Zr8MGeM7RluFsbdd7imF2KTJFCcqTiDxHrKezShIe/iuj05+qIGU0ZydN BVcw== X-Gm-Message-State: AE9vXwNsjqpiHR72gRHu+JqGFJGuVUk60L2Oz8WluqvR/g61q1xVWYvC58VfIWDBY0Iwbw== X-Received: by 10.28.21.193 with SMTP id 184mr2708915wmv.26.1473801018972; Tue, 13 Sep 2016 14:10:18 -0700 (PDT) Received: from carbon ([2a01:e35:2ef1:4540:4e34:88ff:fe04:cfe5]) by smtp.gmail.com with ESMTPSA id i195sm7196692wmg.14.2016.09.13.14.10.17 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Sep 2016 14:10:18 -0700 (PDT) Message-ID: <1473801016.1281.17.camel@gmail.com> From: Matthias Meulien Date: Tue, 13 Sep 2016 23:10:16 +0200 Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.20.5 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -3.5 (---) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.5 (---) Just type the following lines in a buffer with c++-mode enabled: struct line_t; struct point_t; void set_line(line_t); set_line(line_t(point_t(0.4, 0.2), point_t(0.2, 0.5))); set_line(line_t{point_t{0.4, 0.2},       point_t{0.2, 0.5}}); // wrong identation In GNU Emacs 25.1.50.2 (x86_64-unknown-linux-gnu, GTK+ Version 3.20.9)  of 2016-08-27 built on carbon Repository revision: 1c7166a3ba399efbefc65feb8a6a41ef0dfa33a4 Windowing system distributor 'The X.Org Foundation', version 11.0.11804000 System Description: Arch Linux Recent messages: For information about GNU Emacs and the GNU system, type C-h C-a. Mark set [2 times] next-line: End of buffer [2 times] Configured features: XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GCONF GSETTINGS NOTIFY ACL GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 LIBSYSTEMD Important settings:   value of $LANG: fr_FR.UTF-8   value of $XMODIFIERS: @im=ibus   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   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 cl-macs subr-x puny seq byte- opt bytecomp byte-compile cl-extra help-mode cconv dired dired-loaddefs format-spec rfc822 mml mml-sec password-cache epa derived epg epg- config gnus-util rmail rmail-loaddefs 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 gv cl-loaddefs pcase cl-lib time-date mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment elisp-mode lisp-mode prog-mode register page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core term/tty-colors frame 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 charscript case-table epa-hook jka-cmpr-hook help simple abbrev obarray minibuffer 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 dbusbind inotify dynamic-setting system-font-setting font-render-setting move-toolbar gtk x-toolkit x multi-tty make-network-process emacs) Memory information: ((conses 16 119083 7504)  (symbols 48 23053 0)  (miscs 40 110 129)  (strings 32 23513 4635)  (string-bytes 1 842378)  (vectors 16 16890)  (vector-slots 8 475357 2393)  (floats 8 192 56)  (intervals 56 535 172)  (buffers 976 12)) From unknown Mon Jun 23 18:32:43 2025 X-Loop: help-debbugs@gnu.org Subject: bug#24431: 25.1.50; Wrong indentation in C++ mode when calling constructors with braces References: <1473801016.1281.17.camel@gmail.com> Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org, bug-cc-mode@gnu.org Resent-Date: Thu, 15 Sep 2016 08:43:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24431 X-GNU-PR-Package: emacs,cc-mode X-GNU-PR-Keywords: To: Matthias Meulien Cc: 24431@debbugs.gnu.org Received: via spool by 24431-submit@debbugs.gnu.org id=B24431.14739289585664 (code B ref 24431); Thu, 15 Sep 2016 08:43:02 +0000 Received: (at 24431) by debbugs.gnu.org; 15 Sep 2016 08:42:38 +0000 Received: from localhost ([127.0.0.1]:60006 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bkSFh-0001TI-Uf for submit@debbugs.gnu.org; Thu, 15 Sep 2016 04:42:38 -0400 Received: from mail.muc.de ([193.149.48.3]:48803) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bkSFg-0001T7-FO for 24431@debbugs.gnu.org; Thu, 15 Sep 2016 04:42:37 -0400 Received: (qmail 16624 invoked by uid 3782); 15 Sep 2016 08:42:34 -0000 Date: 15 Sep 2016 08:42:34 -0000 Message-ID: <20160915084234.16623.qmail@mail.muc.de> From: Alan Mackenzie Organization: muc.de e.V. In-Reply-To: X-Newsgroups: gnu.emacs.bug User-Agent: tin/2.3.1-20141224 ("Tallant") (UNIX) (FreeBSD/10.3-RELEASE-p7 (amd64)) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.2 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.2 (--) Hello, Matthias In article you wrot= e: > Just type the following lines in a buffer with c++-mode enabled: > struct line_t; > struct point_t; > void set_line(line_t); > set_line(line_t(point_t(0.4, 0.2), > point_t(0.2, 0.5))); > set_line(line_t{point_t{0.4, 0.2}, > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0point_t{0.2, 0.5}}); // wrong ident= ation What, exactly, is wrong about that indentation? What would you like to see there, and why? When I do C-c C-s on that last line, I get: Syntactic analysis: ((arglist-cont-nonempty 130 138) (defun-block-int= ro 130) (statement-cont 130)) , which seems to be incorrect, since neither of the anchor points in the last two of the three elements point at locations within the internal C++ constructs. Amongst other things. > In GNU Emacs 25.1.50.2 (x86_64-unknown-linux-gnu, GTK+ Version 3.20.9) > =C2=A0of 2016-08-27 built on carbon > Repository revision: 1c7166a3ba399efbefc65feb8a6a41ef0dfa33a4 > Windowing system distributor 'The X.Org Foundation', version > 11.0.11804000 > System Description: Arch Linux [ .... ] --=20 Alan Mackenzie (Nuremberg, Germany). From unknown Mon Jun 23 18:32:43 2025 X-Loop: help-debbugs@gnu.org Subject: bug#24431: 25.1.50; Wrong indentation in C++ mode when calling constructors with braces Resent-From: Matthias Meulien Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org, bug-cc-mode@gnu.org Resent-Date: Thu, 15 Sep 2016 12:10:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24431 X-GNU-PR-Package: emacs,cc-mode X-GNU-PR-Keywords: To: Alan Mackenzie Cc: 24431@debbugs.gnu.org Received: via spool by 24431-submit@debbugs.gnu.org id=B24431.147394138630940 (code B ref 24431); Thu, 15 Sep 2016 12:10:02 +0000 Received: (at 24431) by debbugs.gnu.org; 15 Sep 2016 12:09:46 +0000 Received: from localhost ([127.0.0.1]:60085 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bkVU9-00082x-S8 for submit@debbugs.gnu.org; Thu, 15 Sep 2016 08:09:46 -0400 Received: from mail-lf0-f42.google.com ([209.85.215.42]:34043) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bkVU7-00082l-Vs for 24431@debbugs.gnu.org; Thu, 15 Sep 2016 08:09:44 -0400 Received: by mail-lf0-f42.google.com with SMTP id u14so32639947lfd.1 for <24431@debbugs.gnu.org>; Thu, 15 Sep 2016 05:09:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:subject:from:to:cc:date:in-reply-to:references :mime-version; bh=oy8KSlMDOU91yKva0tYQDfvAczLjxA9N7Baf2KVGTqs=; b=hhZBbiFLexe50rw0nN5YSFsTMtLhu4+JD3zntPP/ocEvAC+SoMz8eq4ths3hjCD7tF Yf/aHND9rPily7sk8rbnXiDyvo8B2xbvbIvhFro1y9t0HacpI9s7Y6fiVqPqrYPKbufY HiiuLoZ2pxay6j/6gRWkPW9g6L+GsPKxvCyr2Vf2oSowRWzKiiKy5VXaFDLiMEFXRf4c yhn92NLOpBLfqqRsx1Wy2ViyuwgK/wOz83KcAzkYaxizglxIPALDKfhu8p9TPjNbiKVt qwmEQcvXK2jV74insFJ7l0IzseY1pE3YYwPWISKmwCg9yub8I7Z1vhTl3Yic6ZrLl5CC DPlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:mime-version; bh=oy8KSlMDOU91yKva0tYQDfvAczLjxA9N7Baf2KVGTqs=; b=jNjxh15WBQUROjgBk8zfhcWFSG132g4RSHT2tYUDc8UwpltNcq9v5PSzLqCAGVX9dg fMQW4hDCUhV/zWRs9osFYw5cEOxNu0hO61obSaeEuOPT4sS5WaF250G/WG+jfx1Is6SK CGjhoiNNHM4vT3Hpfzb+oa5Dp48e3m/VrlJcxhrjF6VImWR94uetwdM5L7X8iH419yqk 6O4uNDWSVkJllgQwG4LnbE/3HUkt3M8I2sfCv341B50xneE7sJ8r7IgRgkoNRbpFqI5/ 53H/1zL3bihaEk2YB1+sEmSDzd90Vvl1mBqj5wSlawPeMSfkq4H8u8058n4a5GLVZiLL inHg== X-Gm-Message-State: AE9vXwO9wVZ3pKR75VsRh+wtqj4qe9KUz0/ZI4Sjg9jKkOT+pzk2CK1sPwOOfZBdeNAOdA== X-Received: by 10.28.12.133 with SMTP id 127mr2563992wmm.119.1473941375863; Thu, 15 Sep 2016 05:09:35 -0700 (PDT) Received: from carbon (eth-west-pareq2-46-193-0-50.wb.wifirst.net. [46.193.0.50]) by smtp.gmail.com with ESMTPSA id m5sm2556015wmd.1.2016.09.15.05.09.34 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 15 Sep 2016 05:09:35 -0700 (PDT) Message-ID: <1473941364.1627.6.camel@gmail.com> From: Matthias Meulien Date: Thu, 15 Sep 2016 14:09:24 +0200 In-Reply-To: <20160915084234.16623.qmail@mail.muc.de> References: <20160915084234.16623.qmail@mail.muc.de> Content-Type: multipart/alternative; boundary="=-pRq+ZpXLkrs3knqnnNzb" X-Mailer: Evolution 3.20.5 Mime-Version: 1.0 X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) --=-pRq+ZpXLkrs3knqnnNzb Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit Hi Alan, Sorry, my report lacks of precision. > > set_line(line_t(point_t(0.4, 0.2), > >                 point_t(0.2, 0.5))); > > > > > set_line(line_t{point_t{0.4, 0.2}, > >       point_t{0.2, 0.5}}); // wrong identation > > > What, exactly, is wrong about that indentation?  What would you like to see there, and why? I am expecting to see the same indentation whatever I'm using, brackets or parenthesis; That is: set_line(line_t{point_t{0.4, 0.2},                 point_t{0.2, 0.5}}); > --  Matthias --=-pRq+ZpXLkrs3knqnnNzb Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable
Hi Alan,

Sorry, my r= eport lacks of precision.

set_line(line_t(point_t(0.4, 0.2),
&n= bsp;            = ;   point_t(0.2, 0.5)));


set_line(line_t{point_t{0.4, 0.= 2},
      point_t{0.2, 0.5}}); // w= rong identation

What, exactly, is wro= ng about that indentation?  What would you like to see there, and= why?

I am expecting to see the same = indentation whatever I'm using, brackets or parenthesis; That is:

set_line(line_t{point_t{0.4, 0.2},
    =
            point_t{0.2, 0.5}});
-- 
Matthias=
--=-pRq+ZpXLkrs3knqnnNzb-- From unknown Mon Jun 23 18:32:43 2025 X-Loop: help-debbugs@gnu.org Subject: bug#24431: 25.1.50; Wrong indentation in C++ mode when calling constructors with braces Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org, bug-cc-mode@gnu.org Resent-Date: Sun, 01 Jan 2017 14:33:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24431 X-GNU-PR-Package: emacs,cc-mode X-GNU-PR-Keywords: To: Matthias Meulien Cc: 24431@debbugs.gnu.org Received: via spool by 24431-submit@debbugs.gnu.org id=B24431.148328117614419 (code B ref 24431); Sun, 01 Jan 2017 14:33:01 +0000 Received: (at 24431) by debbugs.gnu.org; 1 Jan 2017 14:32:56 +0000 Received: from localhost ([127.0.0.1]:33773 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cNhBw-0003kU-5e for submit@debbugs.gnu.org; Sun, 01 Jan 2017 09:32:56 -0500 Received: from ocolin.muc.de ([193.149.48.4]:37778 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1cNhBu-0003kM-1I for 24431@debbugs.gnu.org; Sun, 01 Jan 2017 09:32:54 -0500 Received: (qmail 73600 invoked by uid 3782); 1 Jan 2017 14:32:51 -0000 Received: from acm.muc.de (p4FC469E3.dip0.t-ipconnect.de [79.196.105.227]) by colin.muc.de (tmda-ofmipd) with ESMTP; Sun, 01 Jan 2017 15:32:50 +0100 Received: (qmail 10661 invoked by uid 1000); 1 Jan 2017 14:32:29 -0000 Date: Sun, 1 Jan 2017 14:32:29 +0000 Message-ID: <20170101143228.GB8392@acm.fritz.box> References: <20160915084234.16623.qmail@mail.muc.de> <1473941364.1627.6.camel@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1473941364.1627.6.camel@gmail.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-Delivery-Agent: TMDA/1.1.12 (Macallan) From: Alan Mackenzie X-Primary-Address: acm@muc.de X-Spam-Score: -3.2 (---) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.2 (---) Hello, Matthias. Happy New Year! On Thu, Sep 15, 2016 at 02:09:24PM +0200, Matthias Meulien wrote: > Hi Alan, > Sorry, my report lacks of precision. > > > set_line(line_t(point_t(0.4, 0.2), > > >                 point_t(0.2, 0.5))); > > > set_line(line_t{point_t{0.4, 0.2}, > > >       point_t{0.2, 0.5}}); // wrong identation > > > What, exactly, is wrong about that indentation?  What would you like > to see there, and why? > I am expecting to see the same indentation whatever I'm using, brackets > or parenthesis; That is: > set_line(line_t{point_t{0.4, 0.2}, >                 point_t{0.2, 0.5}}); This bug proved quite challenging to fix, and I'm still not finished with it. The syntactic analysis of the construct, at the deepest level of CC Mode, was faulty, and I had to add a new facility to the indentation engine for "an absolute column which won't be amended by further relative offsets" (but don't worry about that). With the patch below, the troublesome line gets indented how we would both want it. Please note that at the moment, this only works in the CC Mode style "gnu", but you've got that set in your file local variables anyway. After applying the patch and recompiling CC Mode, if you are in a running Emacs, please do "M-: (makunbound 'c-style-alist)" and then M-x load-file .../lisp/progmodes/cc-styles.elc . This will cause the variable c-style-alist to be updated to its new value, which simple loading of the file wouldn't achieve. What doesn't work so well is that if that construct is expanded onto several lines (with each brace on its own line) it indents like this: set_line(line_t { point_t { 0.4, 0.2 }, point_t { 0.2, 0.5 } } ); , and also the syntactic analysis shows 'statement-block-intro where it should really be 'brace-list-intro, and so on. I'll be working to fix this. Anyhow, here's the patch. Please try it out, and let me know how well (or how badly) it works. As I said, I'm still working to fix some things. diff -r ea743536b883 cc-align.el --- a/cc-align.el Fri Dec 30 15:19:21 2016 +0000 +++ b/cc-align.el Sun Jan 01 14:17:56 2017 +0000 @@ -278,7 +278,7 @@ (beginning-of-line) (backward-up-list 1) (skip-chars-forward " \t" (c-point 'eol)) - (vector (1+ (current-column))))) + (vector (list (1+ (current-column)))))) (defun c-lineup-arglist-close-under-paren (langelem) "Line up a line under the enclosing open paren. diff -r ea743536b883 cc-engine.el --- a/cc-engine.el Fri Dec 30 15:19:21 2016 +0000 +++ b/cc-engine.el Sun Jan 01 14:17:56 2017 +0000 @@ -10382,6 +10382,30 @@ (c-at-statement-start-p)) (make-obsolete 'c-looking-at-bos 'c-at-statement-start-p nil) +(defun c-looking-at-statement-block () + ;; Point is at an opening brace. If this is a statement block (i.e. the + ;; elements in it are terminated by semicolons) return t. Otherwise, return + ;; nil. + (let ((here (point))) + (prog1 + (if (c-go-list-forward) + (let ((there (point))) + (backward-char) + (c-syntactic-skip-backward + "^;," here t) + (cond + ((eq (char-before) ?\;) t) + ((eq (char-before) ?,) nil) + (t (goto-char here) + (forward-char) + (and (c-syntactic-re-search-forward "{" there t t) + (progn (backward-char) + (c-looking-at-statement-block)))))) + (forward-char) + (and (c-syntactic-re-search-forward "[;,]" nil t t) + (eq (char-before) ?\;))) + (goto-char here)))) + (defun c-looking-at-inexpr-block (lim containing-sexp &optional check-at-end) ;; Return non-nil if we're looking at the beginning of a block ;; inside an expression. The value returned is actually a cons of @@ -10537,15 +10561,7 @@ (and (c-major-mode-is 'c++-mode) (save-excursion (goto-char block-follows) - (if (c-go-list-forward) - (progn - (backward-char) - (c-syntactic-skip-backward - "^;," block-follows t) - (not (eq (char-before) ?\;))) - (or (not (c-syntactic-re-search-forward - "[;,]" nil t t)) - (not (eq (char-before) ?\;))))))) + (not (c-looking-at-statement-block))))) nil (cons 'inexpr-statement (point))))) @@ -10871,6 +10887,14 @@ (cdr (assoc (match-string 1) c-other-decl-block-key-in-symbols-alist)) (max (c-point 'boi paren-pos) (point)))) + ((save-excursion + (goto-char paren-pos) + (c-looking-at-or-maybe-in-bracelist containing-sexp)) + (if (save-excursion + (goto-char paren-pos) + (c-looking-at-statement-block)) + (c-add-syntax 'defun-block-intro nil) + (c-add-syntax 'brace-list-intro nil))) (t (c-add-syntax 'defun-block-intro nil)))) (c-add-syntax 'statement-block-intro nil))) @@ -12692,7 +12716,10 @@ nil)))) (if (or (null res) (integerp res) - (and (vectorp res) (= (length res) 1) (integerp (aref res 0)))) + (and (vectorp res) (= (length res) 1) + (or (integerp (aref res 0)) + (and (consp (aref res 0)) + (integerp (car (aref res 0))))))) res (c-benign-error "Error evaluating offset %S for %s: Got invalid value %S" offset symbol res) @@ -12750,25 +12777,34 @@ (while langelems (let* ((c-syntactic-element (car langelems)) (res (c-calc-offset c-syntactic-element))) - - (if (vectorp res) - ;; Got an absolute column that overrides any indentation - ;; we've collected so far, but not the relative - ;; indentation we might get for the nested structures - ;; further down the langelems list. - (setq indent (elt res 0) - anchor (point-min)) ; A position at column 0. - + (cond + ((and (vectorp res) (consp (elt res 0))) + ;; Got an absolute column that overrides any indentation we've + ;; collected so far. This can only be superseded by another + ;; absolute column (another vector). + (setq indent res + anchor (point-min))) ; A position at column 0. + ((vectorp res) + ;; Got an absolute column that overrides any indentation + ;; we've collected so far, but not the relative + ;; indentation we might get for the nested structures + ;; further down the langelems list. + (setq indent (elt res 0) + anchor (point-min))) ; A position at column 0. + (t ;; Got a relative change of the current calculated ;; indentation. - (setq indent (+ indent res)) + (if (not (vectorp indent)) + (setq indent (+ indent res))) ;; Use the anchor position from the first syntactic ;; element with one. (unless anchor - (setq anchor (c-langelem-pos (car langelems))))) + (setq anchor (c-langelem-pos (car langelems)))))) (setq langelems (cdr langelems)))) + (if (vectorp indent) + (setq indent (car (elt indent 0)))) (if anchor (+ indent (save-excursion diff -r ea743536b883 cc-styles.el --- a/cc-styles.el Fri Dec 30 15:19:21 2016 +0000 +++ b/cc-styles.el Sun Jan 01 14:17:56 2017 +0000 @@ -72,6 +72,7 @@ (arglist-close . c-lineup-arglist) (inline-open . 0) (brace-list-open . +) + (brace-list-intro . c-lineup-arglist-intro-after-paren) (topmost-intro-cont . (first c-lineup-topmost-intro-cont c-lineup-gnu-DEFUN-intro-cont)))) > --  > Matthias -- Alan Mackenzie (Nuremberg, Germany). From unknown Mon Jun 23 18:32:43 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Matthias Meulien Subject: bug#24431: closed (Re: bug#24431: 25.1.50; Wrong indentation in C++ mode when calling constructors with braces) Message-ID: References: <20170201203259.GA2513@acm> <1473801016.1281.17.camel@gmail.com> X-Gnu-PR-Message: they-closed 24431 X-Gnu-PR-Package: emacs,cc-mode Reply-To: 24431@debbugs.gnu.org Date: Wed, 01 Feb 2017 20:34:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1485981242-11189-1" This is a multi-part message in MIME format... ------------=_1485981242-11189-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #24431: 25.1.50; Wrong indentation in C++ mode when calling constructors wi= th braces which was filed against the emacs,cc-mode package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 24431@debbugs.gnu.org. --=20 24431: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D24431 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1485981242-11189-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 24431-done) by debbugs.gnu.org; 1 Feb 2017 20:33:21 +0000 Received: from localhost ([127.0.0.1]:53655 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cZ1aj-0002tY-0Z for submit@debbugs.gnu.org; Wed, 01 Feb 2017 15:33:21 -0500 Received: from ocolin.muc.de ([193.149.48.4]:31493 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1cZ1ah-0002tQ-35 for 24431-done@debbugs.gnu.org; Wed, 01 Feb 2017 15:33:19 -0500 Received: (qmail 98980 invoked by uid 3782); 1 Feb 2017 20:33:17 -0000 Received: from acm.muc.de (p548C7459.dip0.t-ipconnect.de [84.140.116.89]) by colin.muc.de (tmda-ofmipd) with ESMTP; Wed, 01 Feb 2017 21:33:16 +0100 Received: (qmail 5154 invoked by uid 1000); 1 Feb 2017 20:32:59 -0000 Date: Wed, 1 Feb 2017 20:32:59 +0000 To: Matthias Meulien Subject: Re: bug#24431: 25.1.50; Wrong indentation in C++ mode when calling constructors with braces Message-ID: <20170201203259.GA2513@acm> References: <20160915084234.16623.qmail@mail.muc.de> <1473941364.1627.6.camel@gmail.com> <20170101143228.GB8392@acm.fritz.box> <1484684938.1197.11.camel@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1484684938.1197.11.camel@gmail.com> User-Agent: Mutt/1.7.2 (2016-11-26) X-Delivery-Agent: TMDA/1.1.12 (Macallan) From: Alan Mackenzie X-Primary-Address: acm@muc.de X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 24431-done Cc: 24431-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) Hello again, Matthias. On Tue, Jan 17, 2017 at 21:28:58 +0100, Matthias Meulien wrote: > Le dimanche 01 janvier 2017 à 14:32 +0000, Alan Mackenzie a écrit : > I am sorry I am in the process of leaving my current living place and > I've not found time to test your diff.  I don't know when I'll do it > since I've so much work to do in my new apartment. Once more, I am > really sorry... Hope the move has gone/is going OK. In the end, I discovered the patch I sent you was only half finished. I've now finished the fix, and committed it, both to CC Mode and to Emacs savannah. I'd still be happy to hear of any testing you manage to get done on it, particularly if anything is still buggy. In the meantime, I'm closing the bug. > --  > Matthias -- Alan Mackenzie (Nuremberg, Germany). ------------=_1485981242-11189-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 13 Sep 2016 21:11:58 +0000 Received: from localhost ([127.0.0.1]:58954 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bjuzl-0003j0-Rh for submit@debbugs.gnu.org; Tue, 13 Sep 2016 17:11:58 -0400 Received: from eggs.gnu.org ([208.118.235.92]:49566) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bjuzj-0003il-TC for submit@debbugs.gnu.org; Tue, 13 Sep 2016 17:11:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bjuzd-0001Di-Jd for submit@debbugs.gnu.org; Tue, 13 Sep 2016 17:11:50 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: * X-Spam-Status: No, score=1.3 required=5.0 tests=BAYES_50,FREEMAIL_FROM, RCVD_IN_SORBS_SPAM,T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:57444) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bjuzd-0001Cp-H0 for submit@debbugs.gnu.org; Tue, 13 Sep 2016 17:11:49 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40520) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bjuza-0000WF-Uj for bug-gnu-emacs@gnu.org; Tue, 13 Sep 2016 17:11:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bjuzW-000193-KU for bug-gnu-emacs@gnu.org; Tue, 13 Sep 2016 17:11:45 -0400 Received: from mail-wm0-f50.google.com ([74.125.82.50]:38307) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bjuzW-0000xE-DQ for bug-gnu-emacs@gnu.org; Tue, 13 Sep 2016 17:11:42 -0400 Received: by mail-wm0-f50.google.com with SMTP id 1so224105120wmz.1 for ; Tue, 13 Sep 2016 14:11:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:subject:from:to:date:mime-version :content-transfer-encoding; bh=Y08oYXM+f9InF9MlTfor010qWiwf3/GQOqbNfzO8BU4=; b=nvX+zikPlu7CpgVeAtnBrHlPrUXzv7nfGnBfgEGJx1fHfx37iLBoYDPOPlimskD168 uu0uUp5VWFj5nEY0GV5qcWlXjoTROQ6qib72zfDpgjBArYGhD2lSJ5OW7Yrgls9Ee64z 0mfCfk9gL4BQWB+tXAUxAeX+pDI9AhK0Vu1RHehc3vCq16r3tyxbq0T8AExbwXci37jk tJoyjRFAS3lQYF3RiutxNfxfdviLLD1FSEtdWtl1SvDB2kdxzCpZHJJw2TEwqZL6yPiE 1cJ5mcrL81PIh23RN/r+8icA7hd6OGI9ZBqBPsW8kDiriLfgX4NztzA48cJqy5PKZB1C cXWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:subject:from:to:date:mime-version :content-transfer-encoding; bh=Y08oYXM+f9InF9MlTfor010qWiwf3/GQOqbNfzO8BU4=; b=CSDdHvzyTH+8IXyvntmO97oazU+/2lhpiHjtLUstLzmOS/ubhCtkqsztsI0Ji3zDh/ UiOYFkJZDHVK6zexftdmuo5wV9+ApMdwvYjV5dbgM4eQi3VZryU5NPJ3rBbBJAdTnR1V XPdysYLraS2xIlXOtIRZXWeRKv5EPspWt9eKVeQxX2CrB4e46V0L+BtuWj3uVRLIalce 7wkKtiS4reyrc9aWK2i8Jqoete7BYhK2/yqS361yrfCEZy/2DPTB9xm60acKMjRFv/9x vUlH7hT+2e4Zr8MGeM7RluFsbdd7imF2KTJFCcqTiDxHrKezShIe/iuj05+qIGU0ZydN BVcw== X-Gm-Message-State: AE9vXwNsjqpiHR72gRHu+JqGFJGuVUk60L2Oz8WluqvR/g61q1xVWYvC58VfIWDBY0Iwbw== X-Received: by 10.28.21.193 with SMTP id 184mr2708915wmv.26.1473801018972; Tue, 13 Sep 2016 14:10:18 -0700 (PDT) Received: from carbon ([2a01:e35:2ef1:4540:4e34:88ff:fe04:cfe5]) by smtp.gmail.com with ESMTPSA id i195sm7196692wmg.14.2016.09.13.14.10.17 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Sep 2016 14:10:18 -0700 (PDT) Message-ID: <1473801016.1281.17.camel@gmail.com> Subject: 25.1.50; Wrong indentation in C++ mode when calling constructors with braces From: Matthias Meulien To: bug-gnu-emacs@gnu.org Date: Tue, 13 Sep 2016 23:10:16 +0200 Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.20.5 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -3.5 (---) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.5 (---) Just type the following lines in a buffer with c++-mode enabled: struct line_t; struct point_t; void set_line(line_t); set_line(line_t(point_t(0.4, 0.2), point_t(0.2, 0.5))); set_line(line_t{point_t{0.4, 0.2},       point_t{0.2, 0.5}}); // wrong identation In GNU Emacs 25.1.50.2 (x86_64-unknown-linux-gnu, GTK+ Version 3.20.9)  of 2016-08-27 built on carbon Repository revision: 1c7166a3ba399efbefc65feb8a6a41ef0dfa33a4 Windowing system distributor 'The X.Org Foundation', version 11.0.11804000 System Description: Arch Linux Recent messages: For information about GNU Emacs and the GNU system, type C-h C-a. Mark set [2 times] next-line: End of buffer [2 times] Configured features: XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GCONF GSETTINGS NOTIFY ACL GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 LIBSYSTEMD Important settings:   value of $LANG: fr_FR.UTF-8   value of $XMODIFIERS: @im=ibus   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   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 cl-macs subr-x puny seq byte- opt bytecomp byte-compile cl-extra help-mode cconv dired dired-loaddefs format-spec rfc822 mml mml-sec password-cache epa derived epg epg- config gnus-util rmail rmail-loaddefs 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 gv cl-loaddefs pcase cl-lib time-date mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment elisp-mode lisp-mode prog-mode register page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core term/tty-colors frame 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 charscript case-table epa-hook jka-cmpr-hook help simple abbrev obarray minibuffer 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 dbusbind inotify dynamic-setting system-font-setting font-render-setting move-toolbar gtk x-toolkit x multi-tty make-network-process emacs) Memory information: ((conses 16 119083 7504)  (symbols 48 23053 0)  (miscs 40 110 129)  (strings 32 23513 4635)  (string-bytes 1 842378)  (vectors 16 16890)  (vector-slots 8 475357 2393)  (floats 8 192 56)  (intervals 56 535 172)  (buffers 976 12)) ------------=_1485981242-11189-1--