From unknown Mon Aug 11 21:14:20 2025 X-Loop: don@donarmstrong.com Subject: bug#341: c-indent-command misindents? Reply-To: "Ralovich, =?UTF-8?Q?Krist=C3=B3f"?= , 341@debbugs.gnu.org Resent-From: "Ralovich, =?UTF-8?Q?Krist=C3=B3f"?= Resent-To: bug-submit-list@lists.donarmstrong.com Resent-CC: Emacs Bugs Resent-Date: Sat, 31 May 2008 15:20:03 +0000 Resent-Message-ID: Resent-Sender: don@donarmstrong.com X-Emacs-PR-Message: report 341 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Received: via spool by submit@emacsbugs.donarmstrong.com id=B.121224683719765 (code B ref -1); Sat, 31 May 2008 15:20:03 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02 (2007-08-08) on rzlab.ucr.edu X-Spam-Level: X-Spam-Status: No, score=-5.0 required=4.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW autolearn=ham version=3.2.3-bugs.debian.org_2005_01_02 Received: (at submit) by emacsbugs.donarmstrong.com; 31 May 2008 15:13:57 +0000 Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m4VFDsvB019759 for ; Sat, 31 May 2008 08:13:55 -0700 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1K2SmH-0002K2-I3 for bug-gnu-emacs@gnu.org; Sat, 31 May 2008 11:13:53 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1K2SmG-0002Jq-Gk for bug-gnu-emacs@gnu.org; Sat, 31 May 2008 11:13:53 -0400 Received: from [199.232.76.173] (port=54743 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K2SmG-0002Jn-DY for bug-gnu-emacs@gnu.org; Sat, 31 May 2008 11:13:52 -0400 Received: from yw-out-1718.google.com ([74.125.46.155]:17613) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1K2SmG-0004KJ-DQ for bug-gnu-emacs@gnu.org; Sat, 31 May 2008 11:13:52 -0400 Received: by yw-out-1718.google.com with SMTP id 9so470403ywk.66 for ; Sat, 31 May 2008 08:13:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:mime-version:content-type; bh=lqoMmRVfFS9QMgT+JQ68fA/cmQiG8lcWfqpQxDxLLhE=; b=QP7GbEG3bq+xv0gXfqjmjnC6lB+GwIgOhL8Qog2+CTB6Juprf8xoOzRIV0E8VCNLtJ6RNZ/2kFGxdh7xRCJyGjeP9YF0+jbbxoRmgdFrzAjOxK36SxM/8eY0CPHoDeYDqhQXdOkwp0BMRuQSLUOzshAZDQ6HSda6HJ3/r8tqaK8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type; b=GhpbvXGyW6WholUNzDbGaqdS4faQFq3NPmdspTlvvBvKVFoTr5OTxRqMCSE+o6uGcZysDsIxua9LUHQMJUKfaOAVr7Eroh0VbZmmRnBb2dkGK2WDM++FOPduH2XYC4tBjhefaYPtdvPmdCzj001OnvzqXJMBCRboNLpnyg1SOUM= Received: by 10.150.68.2 with SMTP id q2mr3172767yba.90.1212246829528; Sat, 31 May 2008 08:13:49 -0700 (PDT) Received: by 10.151.83.8 with HTTP; Sat, 31 May 2008 08:13:49 -0700 (PDT) Message-ID: <5712ce4f0805310813oea4c69bub98e6bc1f5877943@mail.gmail.com> Date: Sat, 31 May 2008 17:13:49 +0200 From: "Ralovich, =?UTF-8?Q?Krist=C3=B3f"?= To: bug-gnu-emacs@gnu.org, bug-cc-mode@gnu.org MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_22668_8006542.1212246829516" X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 2) ------=_Part_22668_8006542.1212246829516 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: base64 Content-Disposition: inline SGksCgpJIGhvcGUgdGhpcyBsZXR0ZXIgZW5kcyB1cCBhdCB0aGUgcmlnaHQgbWFpbnRhaW5lcnMh CgpNeSBwcm9ibGVtIGlzIHdoZW4gcnVubmluZyBjLWluZGVudC1jb21tYW5kIChieSBwcmVzc2lu ZyBUQUIgb3IKY2FsbGluZyBpdCBkaXJlY3RseSkgb24gdGhlIDR0aCBsaW5lIG9mIHRoZSBmb2xs b3dpbmcgc21hbGwgc25pcHBldAooc2FtZSBhcyBhdHRhY2hlZCBmaWxlKToKCjE6ICNpZmRlZiBB CjI6IGludCBmb28oaW50IGEsIGludCBiKQozOiAjZWxzZQo0OiBpbnQgYmFyKGludCBhLCBpbnQg YikKNTogI2VuZGlmCjY6IHsKNzogICByZXR1cm4gYStiOwo4OiB9Cgp0aGUgbGluZSBpcyBnZXR0 aW5nIGluZGVudGVkIGZhbHNlbHk6CgoxOiAjaWZkZWYgQQoyOiBpbnQgZm9vKGludCBhLCBpbnQg YikKMzogI2Vsc2UKNDogICBpbnQgYmFyKGludCBhLCBpbnQgYikKNTogI2VuZGlmCjY6IHsKNzog ICByZXR1cm4gYStiOwo4OiB9CgpJIHRoaW5rLCBpdCBzaG91bGQgbm90IGdldCBpbmRlbnRlZCwg cGxlYXNlIGNvcnJlY3QgbWUgaWYgSSBhbSB3cm9uZyEKCkkgYW0gdXNpbmcgZW1hY3MgMjIuMiB3 aXRoIGl0J3MgZGVmYXVsdCBjYy1tb2RlLgoKTG9va2luZyBmb3J3YXJkIHRvIGhlYXJpbmcgZnJv bSB5b3UhCgoKS3Jpc3TDs2YK ------=_Part_22668_8006542.1212246829516 Content-Type: text/x-csrc; name=cc-mode-bug.c Content-Transfer-Encoding: base64 X-Attachment-Id: f_fgwc7hh10 Content-Disposition: attachment; filename=cc-mode-bug.c I2lmZGVmIEEKaW50IGZvbyhpbnQgYSwgaW50IGIpCiNlbHNlCmludCBiYXIoaW50IGEsIGludCBi KQojZW5kaWYKewogIHJldHVybiBhK2I7Cn0K ------=_Part_22668_8006542.1212246829516-- From debbugs-submit-bounces@debbugs.gnu.org Fri Jan 29 14:06:48 2010 Received: (at control) by debbugs.gnu.org; 29 Jan 2010 19:06:49 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NawB6-0006Th-CT for submit@debbugs.gnu.org; Fri, 29 Jan 2010 14:06:48 -0500 Received: from fencepost.gnu.org ([140.186.70.10]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NawB3-0006TR-9S for control@debbugs.gnu.org; Fri, 29 Jan 2010 14:06:47 -0500 Received: from rgm by fencepost.gnu.org with local (Exim 4.69) (envelope-from ) id 1NawAz-0008CX-1L; Fri, 29 Jan 2010 14:06:41 -0500 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <19299.12736.832508.282592@fencepost.gnu.org> Date: Fri, 29 Jan 2010 14:06:40 -0500 From: Glenn Morris To: control Subject: control X-Attribution: GM X-Mailer: VM (www.wonderworks.com/vm), GNU Emacs (www.gnu.org/software/emacs) X-Hue: blue X-Ran: VO&ud[`?6f;MPwH!mdZU0Da5EQb;q|^:M@[G'\N`mS1c#>^/W4D}F4Lh'i,;0o1zMzi=T& X-Debbugs-No-Ack: yes X-Spam-Score: -4.9 (----) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.9 (----) noowner 644 noowner 193 noowner 341 noowner 523 noowner 299 noowner 50 unarchive 113 noowner 113 reassign 113 emacs,cc-mode unarchive 512 noowner 512 unarchive 13 noowner 13 reassign 13 emacs,cc-mode unarchive 17 unmerge 17 noowner 16 unarchive 343 noowner 343 reassign 343 emacs,cc-mode unarchive 145 noowner 145 unarchive 45 noowner 45 unarchive 53 noowner 53 From debbugs-submit-bounces@debbugs.gnu.org Mon Oct 03 16:08:04 2011 Received: (at control) by debbugs.gnu.org; 3 Oct 2011 20:08:04 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1RAonz-00028k-OG for submit@debbugs.gnu.org; Mon, 03 Oct 2011 16:08:04 -0400 Received: from fencepost.gnu.org ([140.186.70.10]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1RAonx-00028M-R2 for control@debbugs.gnu.org; Mon, 03 Oct 2011 16:08:02 -0400 Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1RAoma-0004mF-Sn for control@debbugs.gnu.org; Mon, 03 Oct 2011 16:06:36 -0400 Date: Mon, 03 Oct 2011 16:06:36 -0400 Message-Id: Subject: control message for bug 341 To: X-Mailer: mail (GNU Mailutils 2.1) From: Glenn Morris X-Spam-Score: -6.4 (------) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.4 (------) found 341 24.0.90 From unknown Mon Aug 11 21:14:20 2025 X-Loop: help-debbugs@gnu.org Subject: bug#341: c-indent-command misindents? Resent-From: Andrew Hyatt Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org, bug-cc-mode@gnu.org Resent-Date: Tue, 29 Dec 2015 04:07:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 341 X-GNU-PR-Package: emacs,cc-mode X-GNU-PR-Keywords: To: Ralovich, =?UTF-8?Q?Krist=C3=B3f?= Cc: 341@debbugs.gnu.org X-Debbugs-Original-Cc: bug-cc-mode@gnu.org, bug-gnu-emacs@gnu.org, 341@debbugs.gnu.org Received: via spool by submit@debbugs.gnu.org id=B.145136201832161 (code B ref -1); Tue, 29 Dec 2015 04:07:01 +0000 Received: (at submit) by debbugs.gnu.org; 29 Dec 2015 04:06:58 +0000 Received: from localhost ([127.0.0.1]:47169 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aDlYo-0008MZ-CO for submit@debbugs.gnu.org; Mon, 28 Dec 2015 23:06:58 -0500 Received: from eggs.gnu.org ([208.118.235.92]:36725) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aDiSr-0001E0-82 for submit@debbugs.gnu.org; Mon, 28 Dec 2015 19:48:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aDiSl-00063d-Eq for submit@debbugs.gnu.org; Mon, 28 Dec 2015 19:48:32 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM, T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:57232) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aDiSl-00063Z-Br for submit@debbugs.gnu.org; Mon, 28 Dec 2015 19:48:31 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55928) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aDiSk-0001zo-Cj for bug-gnu-emacs@gnu.org; Mon, 28 Dec 2015 19:48:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aDiSj-00063E-I3 for bug-gnu-emacs@gnu.org; Mon, 28 Dec 2015 19:48:30 -0500 Received: from mail-qg0-x236.google.com ([2607:f8b0:400d:c04::236]:33449) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aDiSf-000632-Mm; Mon, 28 Dec 2015 19:48:25 -0500 Received: by mail-qg0-x236.google.com with SMTP id b35so27076026qge.0; Mon, 28 Dec 2015 16:48:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:in-reply-to:references:user-agent:date :message-id:mime-version:content-type:content-transfer-encoding; bh=eKywAdW6x4C+GBfrJewREvE2wQftaj/UjcDf6bKG9O0=; b=hHNz3A0sRxxNAZYlXhRAVLianafWUde7PR/g85VsXUYw/Bg0088kYHgjJDrFb5SB74 qX8JnJIBHJNxUdouEl5IWrp/zTJ2A5zNiiEb7MFeiM/E/OlGb15XWRchpKkOD+VURrdL IbVt+JhxF1Aop15/MoacEtrIwuORexyJ7X/G3EkQ7TCcLO37aqBZeXww52r1Z5shuI2N nIHtrVyb+Jcq3zNtEraFiQWDbKaKXFAThL8J8LVFxPXY0HFTiuSabKloMQJTiRWCnlwg ir9/n4EzvHqR5TBmyRMcUxZaW5x6+V4456DVUYMtGC6NnrfyF9Qrqy5Q/xwaTDmVr5+l oD9Q== X-Received: by 10.140.43.9 with SMTP id d9mr73717657qga.51.1451350105292; Mon, 28 Dec 2015 16:48:25 -0800 (PST) Received: from Andrews-MacBook-Pro.local.ahyatt-laptop (cpe-74-73-128-199.nyc.res.rr.com. [74.73.128.199]) by smtp.gmail.com with ESMTPSA id z2sm28030431qhz.38.2015.12.28.16.48.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 28 Dec 2015 16:48:24 -0800 (PST) From: Andrew Hyatt In-Reply-To: <5712ce4f0805310813oea4c69bub98e6bc1f5877943@mail.gmail.com> (Ralovich's message of "Sat, 31 May 2008 17:13:49 +0200") References: <5712ce4f0805310813oea4c69bub98e6bc1f5877943@mail.gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (darwin) Date: Mon, 28 Dec 2015 19:48:22 -0500 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Mailman-Approved-At: Mon, 28 Dec 2015 23:06:57 -0500 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: -4.0 (----) I've reproduced this bug in emacs 25. It seems like a real problem, thanks (belatedly) for reporting! "Ralovich, "Krist=C3=B3f\"" writes: > Hi, > > I hope this letter ends up at the right maintainers! > > My problem is when running c-indent-command (by pressing TAB or > calling it directly) on the 4th line of the following small snippet > (same as attached file): > > 1: #ifdef A > 2: int foo(int a, int b) > 3: #else > 4: int bar(int a, int b) > 5: #endif > 6: { > 7: return a+b; > 8: } > > the line is getting indented falsely: > > 1: #ifdef A > 2: int foo(int a, int b) > 3: #else > 4: int bar(int a, int b) > 5: #endif > 6: { > 7: return a+b; > 8: } > > I think, it should not get indented, please correct me if I am wrong! > > I am using emacs 22.2 with it's default cc-mode. > > Looking forward to hearing from you! > > > Krist=C3=B3f From unknown Mon Aug 11 21:14:20 2025 X-Loop: help-debbugs@gnu.org Subject: bug#341: c-indent-command misindents? Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org, bug-cc-mode@gnu.org Resent-Date: Tue, 29 Dec 2015 20:31:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 341 X-GNU-PR-Package: emacs,cc-mode X-GNU-PR-Keywords: To: Andrew Hyatt Cc: Ralovich@debbugs.gnu.org, 341@debbugs.gnu.org, =?UTF-8?Q?Krist=C3=B3f?= Received: via spool by 341-submit@debbugs.gnu.org id=B341.14514210545549 (code B ref 341); Tue, 29 Dec 2015 20:31:02 +0000 Received: (at 341) by debbugs.gnu.org; 29 Dec 2015 20:30:54 +0000 Received: from localhost ([127.0.0.1]:48940 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aE0v0-0001RQ-3M for submit@debbugs.gnu.org; Tue, 29 Dec 2015 15:30:54 -0500 Received: from mail.muc.de ([193.149.48.3]:14593) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aE0uy-0001RH-4E for 341@debbugs.gnu.org; Tue, 29 Dec 2015 15:30:52 -0500 Received: (qmail 56686 invoked by uid 3782); 29 Dec 2015 20:30:50 -0000 Received: from acm.muc.de (p579E804C.dip0.t-ipconnect.de [87.158.128.76]) by colin.muc.de (tmda-ofmipd) with ESMTP; Tue, 29 Dec 2015 21:30:49 +0100 Received: (qmail 20296 invoked by uid 1000); 29 Dec 2015 20:33:07 -0000 Date: Tue, 29 Dec 2015 20:33:07 +0000 Message-ID: <20151229203307.GC1884@acm.fritz.box> References: <5712ce4f0805310813oea4c69bub98e6bc1f5877943@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) X-Delivery-Agent: TMDA/1.1.12 (Macallan) From: Alan Mackenzie X-Primary-Address: acm@muc.de X-Spam-Score: -0.0 (/) 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 Andrew and Kristóf. On Mon, Dec 28, 2015 at 07:48:22PM -0500, Andrew Hyatt wrote: > I've reproduced this bug in emacs 25. > It seems like a real problem, thanks (belatedly) for reporting! Yes, it's a known problem in CC Mode, and it's seriously difficult to fix. Parsing happens mainly in the backwards direction, and in general, the #ifdefs in a file form a tree structure. Which is the line previous to line 6? It could be L4, it could be L2. Typically, such "parallel" text lines aren't nice and compatible, the way they are in this example. Indeed, it's possible to construct an example where L6 has two alternative syntactic contexts, depending on whether A is defined. In fact, something like: #ifdef A int foo(int a, int b) #else int bar(int a, int b) { if (a > b) #endif { return a+b; } would do it. I don't know if this problem will ever be fixed. > "Ralovich, "Kristóf\"" writes: > > Hi, > > I hope this letter ends up at the right maintainers! > > My problem is when running c-indent-command (by pressing TAB or > > calling it directly) on the 4th line of the following small snippet > > (same as attached file): > > 1: #ifdef A > > 2: int foo(int a, int b) > > 3: #else > > 4: int bar(int a, int b) > > 5: #endif > > 6: { > > 7: return a+b; > > 8: } > > the line is getting indented falsely: > > 1: #ifdef A > > 2: int foo(int a, int b) > > 3: #else > > 4: int bar(int a, int b) > > 5: #endif > > 6: { > > 7: return a+b; > > 8: } > > I think, it should not get indented, please correct me if I am wrong! > > I am using emacs 22.2 with it's default cc-mode. > > Looking forward to hearing from you! > > Kristóf -- Alan Mackenzie (Nuremberg, Germany). From unknown Mon Aug 11 21:14:20 2025 X-Loop: help-debbugs@gnu.org Subject: bug#341: c-indent-command misindents? Resent-From: Andrew Hyatt Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org, bug-cc-mode@gnu.org Resent-Date: Tue, 29 Dec 2015 20:39:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 341 X-GNU-PR-Package: emacs,cc-mode X-GNU-PR-Keywords: To: Alan Mackenzie Cc: Ralovich@debbugs.gnu.org, 341@debbugs.gnu.org, =?UTF-8?Q?Krist=C3=B3f?= Received: via spool by 341-submit@debbugs.gnu.org id=B341.14514215226296 (code B ref 341); Tue, 29 Dec 2015 20:39:01 +0000 Received: (at 341) by debbugs.gnu.org; 29 Dec 2015 20:38:42 +0000 Received: from localhost ([127.0.0.1]:48944 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aE12X-0001dT-TE for submit@debbugs.gnu.org; Tue, 29 Dec 2015 15:38:42 -0500 Received: from mail-vk0-f50.google.com ([209.85.213.50]:33599) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aE12W-0001dA-6F for 341@debbugs.gnu.org; Tue, 29 Dec 2015 15:38:40 -0500 Received: by mail-vk0-f50.google.com with SMTP id a188so197787711vkc.0; Tue, 29 Dec 2015 12:38:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-type; bh=SkOPfoIhVwGggIkRuhikTxL39do8TzM6NHHlp4X4foM=; b=PyO1997eZBUsEKFnAhpW1od4GbtFnmTjnjM46q6uBCb458HxWAsF354LyutMkhO51u /IqheLi33Y0eN8+Qu0hbVoXl51EoqZYIn5ftPl6Ckm6S6yIVZYbZ8GJGdieWFfCch3hq TII4BuGMmXMvYycehXPOtkZMr+uGMG1kXIaex6geXvtA9lzP4M2DVzD9b+V4jZJ4R4QV 5jnO633+N9m8OqcrRMJxA912pm7F5rU2/2Yj+Qmab0XLVPAD+EYWH2LhDGwaEGjHRS6G zq0lvi9LSt9O12KeeLvP+IpLaAWE9TH+5yJSUvLFh5a+oxDHf2yTMdYY1NrCL+E0vGj9 WLjA== X-Received: by 10.31.47.200 with SMTP id v191mr42082156vkv.116.1451421514577; Tue, 29 Dec 2015 12:38:34 -0800 (PST) MIME-Version: 1.0 References: <5712ce4f0805310813oea4c69bub98e6bc1f5877943@mail.gmail.com> <20151229203307.GC1884@acm.fritz.box> In-Reply-To: <20151229203307.GC1884@acm.fritz.box> From: Andrew Hyatt Date: Tue, 29 Dec 2015 20:38:24 +0000 Message-ID: Content-Type: multipart/alternative; boundary=001a1143fae0cbc0d805280f673a 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 (/) --001a1143fae0cbc0d805280f673a Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Tue, Dec 29, 2015 at 3:30 PM Alan Mackenzie wrote: > Hello Andrew and Krist=C3=B3f. > > On Mon, Dec 28, 2015 at 07:48:22PM -0500, Andrew Hyatt wrote: > > > I've reproduced this bug in emacs 25. > > > It seems like a real problem, thanks (belatedly) for reporting! > > Yes, it's a known problem in CC Mode, and it's seriously difficult to > fix. Parsing happens mainly in the backwards direction, and in general, > the #ifdefs in a file form a tree structure. Which is the line previous > to line 6? It could be L4, it could be L2. Typically, such "parallel" > text lines aren't nice and compatible, the way they are in this example. > Indeed, it's possible to construct an example where L6 has two > alternative syntactic contexts, depending on whether A is defined. In > fact, something like: > > #ifdef A > int foo(int a, int b) > #else > int bar(int a, int b) > { > if (a > b) > #endif > { > return a+b; > } > > would do it. > > I don't know if this problem will ever be fixed. > Perhaps the right thing to do is to mark it as "wontfix" since it's unlikely to be possible without a big rewrite. What do you think? > > > "Ralovich, "Krist=C3=B3f\"" writes: > > > > Hi, > > > > I hope this letter ends up at the right maintainers! > > > > My problem is when running c-indent-command (by pressing TAB or > > > calling it directly) on the 4th line of the following small snippet > > > (same as attached file): > > > > 1: #ifdef A > > > 2: int foo(int a, int b) > > > 3: #else > > > 4: int bar(int a, int b) > > > 5: #endif > > > 6: { > > > 7: return a+b; > > > 8: } > > > > the line is getting indented falsely: > > > > 1: #ifdef A > > > 2: int foo(int a, int b) > > > 3: #else > > > 4: int bar(int a, int b) > > > 5: #endif > > > 6: { > > > 7: return a+b; > > > 8: } > > > > I think, it should not get indented, please correct me if I am wrong! > > > > I am using emacs 22.2 with it's default cc-mode. > > > > Looking forward to hearing from you! > > > > > Krist=C3=B3f > > -- > Alan Mackenzie (Nuremberg, Germany). > --001a1143fae0cbc0d805280f673a Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable


On Tue= , Dec 29, 2015 at 3:30 PM Alan Mackenzie <= acm@muc.de> wrote:
Hello An= drew and Krist=C3=B3f.

On Mon, Dec 28, 2015 at 07:48:22PM -0500, Andrew Hyatt wrote:

> I've reproduced this bug in emacs 25.

> It seems like a real problem, thanks (belatedly) for reporting!

Yes, it's a known problem in CC Mode, and it's seriously difficult = to
fix.=C2=A0 Parsing happens mainly in the backwards direction, and in genera= l,
the #ifdefs in a file form a tree structure.=C2=A0 Which is the line previo= us
to line 6?=C2=A0 It could be L4, it could be L2.=C2=A0 Typically, such &quo= t;parallel"
text lines aren't nice and compatible, the way they are in this example= .
Indeed, it's possible to construct an example where L6 has two
alternative syntactic contexts, depending on whether A is defined.=C2=A0 In=
fact, something like:

#ifdef A
int foo(int a, int b)
#else
int bar(int a, int b)
{
=C2=A0 if (a > b)
#endif
{
=C2=A0 return a+b;
}

would do it.

I don't know if this problem will ever be fixed.
<= br>
Perhaps the right thing to do is to mark it as "wontfix&= quot; since it's unlikely to be possible without a big rewrite.=C2=A0 W= hat do you think?
=C2=A0

> "Ralovich, "Krist=C3=B3f\"" <kristof.ralovich@gmail.com> writes:

> > Hi,

> > I hope this letter ends up at the right maintainers!

> > My problem is when running c-indent-command (by pressing TAB or > > calling it directly) on the 4th line of the following small snipp= et
> > (same as attached file):

> > 1: #ifdef A
> > 2: int foo(int a, int b)
> > 3: #else
> > 4: int bar(int a, int b)
> > 5: #endif
> > 6: {
> > 7:=C2=A0 =C2=A0return a+b;
> > 8: }

> > the line is getting indented falsely:

> > 1: #ifdef A
> > 2: int foo(int a, int b)
> > 3: #else
> > 4:=C2=A0 =C2=A0int bar(int a, int b)
> > 5: #endif
> > 6: {
> > 7:=C2=A0 =C2=A0return a+b;
> > 8: }

> > I think, it should not get indented, please correct me if I am wr= ong!

> > I am using emacs 22.2 with it's default cc-mode.

> > Looking forward to hearing from you!


> > Krist=C3=B3f

--
Alan Mackenzie (Nuremberg, Germany).
--001a1143fae0cbc0d805280f673a-- From unknown Mon Aug 11 21:14:20 2025 X-Loop: help-debbugs@gnu.org Subject: bug#341: c-indent-command misindents? Resent-From: Andrew Hyatt Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org, bug-cc-mode@gnu.org Resent-Date: Mon, 11 Jan 2016 03:13:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 341 X-GNU-PR-Package: emacs,cc-mode X-GNU-PR-Keywords: To: Alan Mackenzie Cc: Ralovich@debbugs.gnu.org, =?UTF-8?Q?Krist=C3=B3f?= , 341@debbugs.gnu.org Received: via spool by 341-submit@debbugs.gnu.org id=B341.145248197013176 (code B ref 341); Mon, 11 Jan 2016 03:13:01 +0000 Received: (at 341) by debbugs.gnu.org; 11 Jan 2016 03:12:50 +0000 Received: from localhost ([127.0.0.1]:45859 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aISuY-0003QR-00 for submit@debbugs.gnu.org; Sun, 10 Jan 2016 22:12:50 -0500 Received: from mail-qk0-f169.google.com ([209.85.220.169]:34709) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aISuW-0003QF-Dd for 341@debbugs.gnu.org; Sun, 10 Jan 2016 22:12:48 -0500 Received: by mail-qk0-f169.google.com with SMTP id r67so24398253qke.1; Sun, 10 Jan 2016 19:12:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type:content-transfer-encoding; bh=jfA2yqTcYFkKieIvAykZrhW7IyWxFYMhUNFC/9NesFE=; b=OYAlMC0GMBbl9tgcyOfxD5R7h3J8GExmhfWThg7gSHXw0elx0sq1pWjDsaW85R6qp9 1qyasjXIqxHw1NrxTKtS/ObqVJsnPj2KWlkb/hpaG+y0IyCZfq8H+AA4hY+TlkgBVDj9 PaDKObjvtb1MJPHX1dnHYxDx60IbWzhko6DY1xU9wWnUkYzQ+jX2iiFzALmK4CiJg+rs 0x0EErzLc8GsIIy2oDzzBzuEGaFVcfDcusKL4P/KBsseQmhF4K1X+sQ2Fbmu5wTnPDiT SpTA6DMSJcu0cAdQOaW/RYb/3fEQxeCeUo4k1b6pM7c6EcgQhX97+d67ps7VmZW3aVwa nGGw== X-Received: by 10.55.53.78 with SMTP id c75mr103886217qka.7.1452481963044; Sun, 10 Jan 2016 19:12:43 -0800 (PST) Received: from Andrews-MacBook-Pro.local.ahyatt-laptop (cpe-74-73-128-199.nyc.res.rr.com. [74.73.128.199]) by smtp.gmail.com with ESMTPSA id i5sm34733743qhi.18.2016.01.10.19.12.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 10 Jan 2016 19:12:41 -0800 (PST) From: Andrew Hyatt References: <5712ce4f0805310813oea4c69bub98e6bc1f5877943@mail.gmail.com> <20151229203307.GC1884@acm.fritz.box> Date: Sun, 10 Jan 2016 22:12:40 -0500 In-Reply-To: (Andrew Hyatt's message of "Tue, 29 Dec 2015 20:38:24 +0000") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (darwin) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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 (/) Andrew Hyatt writes: > On Tue, Dec 29, 2015 at 3:30 PM Alan Mackenzie wrote: > > > Hello Andrew and Krist=C3=B3f. > > On Mon, Dec 28, 2015 at 07:48:22PM -0500, Andrew Hyatt wrote: > > > I've reproduced this bug in emacs 25. > > > It seems like a real problem, thanks (belatedly) for reporting! > > Yes, it's a known problem in CC Mode, and it's seriously difficult to > fix. Parsing happens mainly in the backwards direction, and in general, > the #ifdefs in a file form a tree structure. Which is the line previous > to line 6? It could be L4, it could be L2. Typically, such "parallel" > text lines aren't nice and compatible, the way they are in this example. > Indeed, it's possible to construct an example where L6 has two > alternative syntactic contexts, depending on whether A is defined. In > fact, something like: > > #ifdef A > int foo(int a, int b) > #else > int bar(int a, int b) > { > if (a > b) > #endif > { > return a+b; > } > > would do it. > > I don't know if this problem will ever be fixed. > > > Perhaps the right thing to do is to mark it as "wontfix" since it's unlik= ely to be possible without a big rewrite. What do you think? I'm going to go ahead and do that, due to lack of opposition. Please unmark or just let me know if you disagree. > > > > "Ralovich, "Krist=C3=B3f\"" writes: > > > > Hi, > > > > I hope this letter ends up at the right maintainers! > > > > My problem is when running c-indent-command (by pressing TAB or > > > calling it directly) on the 4th line of the following small snippet > > > (same as attached file): > > > > 1: #ifdef A > > > 2: int foo(int a, int b) > > > 3: #else > > > 4: int bar(int a, int b) > > > 5: #endif > > > 6: { > > > 7: return a+b; > > > 8: } > > > > the line is getting indented falsely: > > > > 1: #ifdef A > > > 2: int foo(int a, int b) > > > 3: #else > > > 4: int bar(int a, int b) > > > 5: #endif > > > 6: { > > > 7: return a+b; > > > 8: } > > > > I think, it should not get indented, please correct me if I am wrong! > > > > I am using emacs 22.2 with it's default cc-mode. > > > > Looking forward to hearing from you! > > > > Krist=C3=B3f > > -- > Alan Mackenzie (Nuremberg, Germany). From debbugs-submit-bounces@debbugs.gnu.org Sun Jan 10 22:13:01 2016 Received: (at control) by debbugs.gnu.org; 11 Jan 2016 03:13:01 +0000 Received: from localhost ([127.0.0.1]:45862 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aISuj-0003Qp-8D for submit@debbugs.gnu.org; Sun, 10 Jan 2016 22:13:01 -0500 Received: from mail-qg0-f51.google.com ([209.85.192.51]:33863) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aISuh-0003Qc-K9 for control@debbugs.gnu.org; Sun, 10 Jan 2016 22:12:59 -0500 Received: by mail-qg0-f51.google.com with SMTP id 6so315862484qgy.1 for ; Sun, 10 Jan 2016 19:12:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:message-id:to:from:subject; bh=yaqN2z5V4jfwEdvLzy5tzwsU/yaGQfvBglANn3Fuggc=; b=PhEZA+azrHH7hK2nc6X0FB9GWv06RVPNPT+BNjk5vhdeR+cSTK2kR/7I2doXgyja7s vQQtIUo0CKen9Ot5HUccCwoLF8v4EyLPTHBKcpL8KjwxUL9XD7QYrYbkEHkOyCv4TSon a4yPqemCdJQB/sil/MUblEO+wxnxRjCcXALmE9e3WcxzmC51pGpp7x6I/STAO4WZZADL vZ27gm9I8uRBCFV4UCJBHCrxQjIIpgSSVp7JvgDfCXMXva/Z9rIMPZSboNA6pcuKjYUL JeEGC+MQQu7VfZ03ZEF/HznhcIAZCKSU7u18RPJUVh2jeR7PT9xFIbpag3QYKoyCmttC JrOA== X-Received: by 10.140.102.11 with SMTP id v11mr156190727qge.39.1452481974343; Sun, 10 Jan 2016 19:12:54 -0800 (PST) Received: from Andrews-MacBook-Pro.local.ahyatt-laptop (cpe-74-73-128-199.nyc.res.rr.com. [74.73.128.199]) by smtp.gmail.com with ESMTPSA id d62sm53481925qga.41.2016.01.10.19.12.53 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 10 Jan 2016 19:12:53 -0800 (PST) Date: Sun, 10 Jan 2016 22:12:52 -0500 Message-Id: To: control@debbugs.gnu.org From: Andrew Hyatt Subject: control message for bug #341 X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: control 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 (/) tags 341 wontfix close 341 From unknown Mon Aug 11 21:14:20 2025 X-Loop: help-debbugs@gnu.org Subject: bug#341: c-indent-command misindents? Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org, bug-cc-mode@gnu.org Resent-Date: Mon, 11 Jan 2016 13:34:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 341 X-GNU-PR-Package: emacs,cc-mode X-GNU-PR-Keywords: wontfix To: Andrew Hyatt Cc: Ralovich@debbugs.gnu.org, =?UTF-8?Q?Krist=C3=B3f?= , 341@debbugs.gnu.org Received: via spool by 341-submit@debbugs.gnu.org id=B341.145251921130824 (code B ref 341); Mon, 11 Jan 2016 13:34:02 +0000 Received: (at 341) by debbugs.gnu.org; 11 Jan 2016 13:33:31 +0000 Received: from localhost ([127.0.0.1]:46027 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aIcbD-000816-53 for submit@debbugs.gnu.org; Mon, 11 Jan 2016 08:33:31 -0500 Received: from mail.muc.de ([193.149.48.3]:44780) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aIcbB-00080v-7M for 341@debbugs.gnu.org; Mon, 11 Jan 2016 08:33:29 -0500 Received: (qmail 23902 invoked by uid 3782); 11 Jan 2016 13:33:28 -0000 Received: from acm.muc.de (p5B1460B3.dip0.t-ipconnect.de [91.20.96.179]) by colin.muc.de (tmda-ofmipd) with ESMTP; Mon, 11 Jan 2016 14:33:27 +0100 Received: (qmail 12509 invoked by uid 1000); 11 Jan 2016 13:35:49 -0000 Date: Mon, 11 Jan 2016 13:35:48 +0000 Message-ID: <20160111133548.GA11318@acm.fritz.box> References: <5712ce4f0805310813oea4c69bub98e6bc1f5877943@mail.gmail.com> <20151229203307.GC1884@acm.fritz.box> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) X-Delivery-Agent: TMDA/1.1.12 (Macallan) From: Alan Mackenzie X-Primary-Address: acm@muc.de X-Spam-Score: -0.0 (/) 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, Andrew. On Sun, Jan 10, 2016 at 10:12:40PM -0500, Andrew Hyatt wrote: > Andrew Hyatt writes: > > On Tue, Dec 29, 2015 at 3:30 PM Alan Mackenzie wrote: > > Hello Andrew and Kristóf. > > On Mon, Dec 28, 2015 at 07:48:22PM -0500, Andrew Hyatt wrote: > > > I've reproduced this bug in emacs 25. > > > It seems like a real problem, thanks (belatedly) for reporting! > > Yes, it's a known problem in CC Mode, and it's seriously difficult to > > fix. Parsing happens mainly in the backwards direction, and in general, > > the #ifdefs in a file form a tree structure. Which is the line previous > > to line 6? It could be L4, it could be L2. Typically, such "parallel" > > text lines aren't nice and compatible, the way they are in this example. > > Indeed, it's possible to construct an example where L6 has two > > alternative syntactic contexts, depending on whether A is defined. In > > fact, something like: > > #ifdef A > > int foo(int a, int b) > > #else > > int bar(int a, int b) > > { > > if (a > b) > > #endif > > { > > return a+b; > > } > > would do it. > > I don't know if this problem will ever be fixed. > > Perhaps the right thing to do is to mark it as "wontfix" since it's > > unlikely to be possible without a big rewrite. What do you think? > I'm going to go ahead and do that, due to lack of opposition. Please > unmark or just let me know if you disagree. Yes, I suppose that's the best thing to do, although I'm ambivalent about it. Maybe sometime in the distant future there will perhaps be extra support in the syntax functionality which would make a fix for this easier to design and implement. Maybe. . So, yes, please go ahead and close it as "won't fix". [ .... ] -- Alan Mackenzie (Nuremberg, Germany).