From unknown Mon Aug 18 19:30:07 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#23775 <23775@debbugs.gnu.org> To: bug#23775 <23775@debbugs.gnu.org> Subject: Status: 25.0.95.2; c-mode: Incorrect indentation and function bundery detection Reply-To: bug#23775 <23775@debbugs.gnu.org> Date: Tue, 19 Aug 2025 02:30:07 +0000 retitle 23775 25.0.95.2; c-mode: Incorrect indentation and function bundery= detection reassign 23775 emacs,cc-mode submitter 23775 Rolf Ade severity 23775 minor tag 23775 wontfix thanks From debbugs-submit-bounces@debbugs.gnu.org Wed Jun 15 21:06:20 2016 Received: (at submit) by debbugs.gnu.org; 16 Jun 2016 01:06:20 +0000 Received: from localhost ([127.0.0.1]:42719 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bDLlD-0007NU-W5 for submit@debbugs.gnu.org; Wed, 15 Jun 2016 21:06:20 -0400 Received: from eggs.gnu.org ([208.118.235.92]:37044) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bDLlC-0007NI-Ej for submit@debbugs.gnu.org; Wed, 15 Jun 2016 21:06:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bDLl6-0003px-JG for submit@debbugs.gnu.org; Wed, 15 Jun 2016 21:06:13 -0400 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 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:52551) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bDLl6-0003pl-GF for submit@debbugs.gnu.org; Wed, 15 Jun 2016 21:06:12 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56236) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bDLl4-0008Jx-Bx for bug-gnu-emacs@gnu.org; Wed, 15 Jun 2016 21:06:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bDLl0-0003pK-1D for bug-gnu-emacs@gnu.org; Wed, 15 Jun 2016 21:06:09 -0400 Received: from mxout3.interscholz.de ([85.236.196.238]:33519) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bDLkz-0003op-R8 for bug-gnu-emacs@gnu.org; Wed, 15 Jun 2016 21:06:05 -0400 Received: from localhost (mxout3 [127.0.0.1]) by mxout3.interscholz.de (Postfix) with ESMTP id D6F12216BF for ; Thu, 16 Jun 2016 03:06:01 +0200 (CEST) X-Virus-Scanned: interscholz amavisd-new at mxout3.interscholz.de Received: from server.web01.interscholz.net (server.web01.interscholz.net [85.236.196.138]) by mxout3.interscholz.de (Postfix) with ESMTP id 8708A208F3 for ; Thu, 16 Jun 2016 03:05:45 +0200 (CEST) Received: from linux-qg7d.fritz.box (p4FFBE0F0.dip0.t-ipconnect.de [79.251.224.240]) by server.web01.interscholz.net (Postfix) with ESMTPSA id DD4E0340362; Thu, 16 Jun 2016 03:05:43 +0200 (CEST) From: Rolf Ade To: bug-gnu-emacs@gnu.org Subject: 25.0.95.2; c-mode: Incorrect indentation and function bundery detection Date: Thu, 16 Jun 2016 03:05:43 +0200 Message-ID: <8760tac594.fsf@linux-qg7d.fritz.box> MIME-Version: 1.0 Content-Type: text/plain 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: -5.0 (-----) 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: -5.0 (-----) emacs -Q Open some empty buffer foo.c and put it into c-mode if already is (M-x c-mdoe). Insert this C code into it: #define foo int main (void) { int a=0; int b=0; #ifdef foo if (a==0) { #else if (b==0) { #endif return 0; } } I've inserted it here as emacs -Q indents it, this is the indentation part of the report. Place the point at the beginning of function foo, then call c-end-of-defun, C-M-e by default in emacs -Q. Bell rings, point is before the last charater of the first line of main, here: int main (void) _P_{ (which is clearly not the end of the function) and prompts me in the mini-buffer: "forward-sexp: Scan error: "Unbalanced parentheses", 29, 133" However well advised such code is, gcc foo.c just compilies. From debbugs-submit-bounces@debbugs.gnu.org Wed Jun 15 21:34:20 2016 Received: (at 23775) by debbugs.gnu.org; 16 Jun 2016 01:34:20 +0000 Received: from localhost ([127.0.0.1]:42725 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bDMCK-00081d-Bh for submit@debbugs.gnu.org; Wed, 15 Jun 2016 21:34:20 -0400 Received: from mail-oi0-f45.google.com ([209.85.218.45]:33142) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bDMCI-00081N-2S for 23775@debbugs.gnu.org; Wed, 15 Jun 2016 21:34:19 -0400 Received: by mail-oi0-f45.google.com with SMTP id u201so47407574oie.0 for <23775@debbugs.gnu.org>; Wed, 15 Jun 2016 18:34:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=wfvO2V1ckGvce3us3DPJLWR7tniJn+mDyn3wNofyeyE=; b=iNsNo5o9GRu8K4WQE//snfpZydPDCHQPoAz48ExTrvNOcDWy1L+cyGIxIKR8ptVa0H 2tUoIpbTlRN11aOnyWI3ywUhhGBnQewVFdC4d9r8HyX3RNdTwObI3PLY5v1jB1ZWFSUo LO9A2INm2Y/XalvYOsyXM1GksJK/L4evK0AvHNQSqJvk/P7Lyov51zcwc+puELv2Mm+V aSAppq8k0nDSYpj4FDXyi+nFbOUMNPIjXZbnZDPXW9TTepDW7PGB9XLOsXUSvWGOQY39 X6vlOl6FZrMJ3bH3FifMUba2zI5TAvWT8Xgf05bPeESmKHzoD4bIZJMhbdZiiVco7Nh6 qi+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=wfvO2V1ckGvce3us3DPJLWR7tniJn+mDyn3wNofyeyE=; b=X42aq6ANotOg5ry/4wLjZSQrRHY0T/KG9VGhReB3jONU4YfymIB6yKZ2rLgp09wQ5u mQfXtjzRb3f+HhTMdi4nGaHPXOo0dqldhbzjPX2jVly6iHp5kwFCGEBVFsOTNINJ39sl QcQURVUV1M1RQElejF2FfeN3e5Ca98/aYjDSU21540fD1ukY1l+deCXm6CeWfXKkoKZ9 fHb6LGjG0tQUeHvfzv10oXV2/4AO1Z0Zx/IciRvNu3kqTDaGP4jzIXaiUgvvmtULKjw3 f3psZA2kR2yWWh8trmmW2J+A+dQ8gThwZzIzE9xHiL0gs9kMR58tilTkXymAASrSixHU 4QcA== X-Gm-Message-State: ALyK8tIwQ7JAeEQ496QmlsVMwJGOqYHYDb1NtiKo5GTmx1r8tPCQ8cjdZAiWS62e7sHqS5K35cDF498QuuKUww== X-Received: by 10.157.1.107 with SMTP id 98mr1069649otu.17.1466040852479; Wed, 15 Jun 2016 18:34:12 -0700 (PDT) MIME-Version: 1.0 Received: by 10.157.44.103 with HTTP; Wed, 15 Jun 2016 18:34:11 -0700 (PDT) In-Reply-To: <8760tac594.fsf@linux-qg7d.fritz.box> References: <8760tac594.fsf@linux-qg7d.fritz.box> From: Noam Postavsky Date: Wed, 15 Jun 2016 21:34:11 -0400 X-Google-Sender-Auth: Zl34kihnUxXS0W3dvDA_7xgzKJk Message-ID: Subject: Re: bug#23775: 25.0.95.2; c-mode: Incorrect indentation and function bundery detection To: Rolf Ade Content-Type: text/plain; charset=UTF-8 X-Spam-Score: -0.5 (/) X-Debbugs-Envelope-To: 23775 Cc: 23775@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.5 (/) On Wed, Jun 15, 2016 at 9:05 PM, Rolf Ade wrote: > However well advised such code is, gcc foo.c just compilies. s/well/ill/? gcc compiles the below as well, but IMO you can't expect Emacs to be able to properly handle every horrible trick that's possible with the preprocessor. #define BEGIN { #define STOP ; int main() BEGIN int a, b STOP if (a == 0) BEGIN if (b==0) { return 0 STOP } } } From debbugs-submit-bounces@debbugs.gnu.org Thu Jun 16 05:18:47 2016 Received: (at 23775) by debbugs.gnu.org; 16 Jun 2016 09:18:48 +0000 Received: from localhost ([127.0.0.1]:42891 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bDTRn-0003wE-O5 for submit@debbugs.gnu.org; Thu, 16 Jun 2016 05:18:47 -0400 Received: from mail.muc.de ([193.149.48.3]:44357) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bDTRi-0003vv-VN for 23775@debbugs.gnu.org; Thu, 16 Jun 2016 05:18:46 -0400 Received: (qmail 6927 invoked by uid 3782); 16 Jun 2016 09:18:39 -0000 Date: 16 Jun 2016 09:18:39 -0000 Message-ID: <20160616091839.6925.qmail@mail.muc.de> From: Alan Mackenzie To: 23775@debbugs.gnu.org Subject: Re: bug#23775: 25.0.95.2; c-mode: Incorrect indentation and function bundery detection 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-p4 (amd64)) X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: 23775 Cc: Rolf Ade 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: -1.4 (-) Hello, Rolf. In article you wrote: > emacs -Q > Open some empty buffer foo.c and put it into c-mode if already is > (M-x c-mdoe). Insert this C code into it: > #define foo > int main (void) { > int a=0; > int b=0; > #ifdef foo > if (a==0) { > #else > if (b==0) { > #endif > return 0; > } > } > I've inserted it here as emacs -Q indents it, this is the indentation > part of the report. > Place the point at the beginning of function foo, then call > c-end-of-defun, C-M-e by default in emacs -Q. Bell rings, point is > before the last charater of the first line of main, here: > int main (void) _P_{ > (which is clearly not the end of the function) and prompts me in the > mini-buffer: "forward-sexp: Scan error: "Unbalanced parentheses", 29, > 133" > However well advised such code is, gcc foo.c just compilies. Yes, this has come up before. Unbalanced braces in preprocessor statements[*] are horrendously difficult to parse - what should be done, for example, when two arms of a #if construct have different numbers of braces? [*] ...by which I mean the part inside a particular arm of a preprocessor conditional has unbalanced braces. I tried once before to solve this problem, but didn't get very far. What was obvious, at the time, was that a solution would slow CC Mode down, possibly quite a bit. So, we've collectively decided that this bug, although real, won't be fixed. The best advice we can give is to arrange the C code such that unbalanced braces in #if arms don't happen. Sorry. -- Alan Mackenzie (Nuremberg, Germany). From debbugs-submit-bounces@debbugs.gnu.org Thu Jun 16 12:36:46 2016 Received: (at control) by debbugs.gnu.org; 16 Jun 2016 16:36:46 +0000 Received: from localhost ([127.0.0.1]:43489 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bDaHe-0007t0-5u for submit@debbugs.gnu.org; Thu, 16 Jun 2016 12:36:46 -0400 Received: from eggs.gnu.org ([208.118.235.92]:41731) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bDaHc-0007sm-Qd for control@debbugs.gnu.org; Thu, 16 Jun 2016 12:36:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bDaHW-0006Nl-VH for control@debbugs.gnu.org; Thu, 16 Jun 2016 12:36:39 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:49280) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bDaHW-0006Nc-Rs for control@debbugs.gnu.org; Thu, 16 Jun 2016 12:36:38 -0400 Received: from rgm by fencepost.gnu.org with local (Exim 4.82) (envelope-from ) id 1bDaHW-00011m-CO for control@debbugs.gnu.org; Thu, 16 Jun 2016 12:36:38 -0400 Subject: control message for bug 23775 To: X-Mailer: mail (GNU Mailutils 2.99.98) Message-Id: From: Glenn Morris Date: Thu, 16 Jun 2016 12:36:38 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -6.4 (------) 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: -6.4 (------) tag 23775 wontfix close 23775 From debbugs-submit-bounces@debbugs.gnu.org Tue Jun 21 19:16:13 2016 Received: (at 23775) by debbugs.gnu.org; 21 Jun 2016 23:16:13 +0000 Received: from localhost ([127.0.0.1]:50158 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bFUtx-0002hv-CA for submit@debbugs.gnu.org; Tue, 21 Jun 2016 19:16:13 -0400 Received: from mxout3.interscholz.de ([85.236.196.238]:34142) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bFUtu-0002hl-NK for 23775@debbugs.gnu.org; Tue, 21 Jun 2016 19:16:11 -0400 Received: from localhost (mxout3 [127.0.0.1]) by mxout3.interscholz.de (Postfix) with ESMTP id F179921421; Wed, 22 Jun 2016 01:16:08 +0200 (CEST) X-Virus-Scanned: interscholz amavisd-new at mxout3.interscholz.de Received: from server.web01.interscholz.net (server.web01.interscholz.net [85.236.196.138]) by mxout3.interscholz.de (Postfix) with ESMTP id B725320752; Wed, 22 Jun 2016 01:16:06 +0200 (CEST) Received: from linux-qg7d.site (p4FFBE34E.dip0.t-ipconnect.de [79.251.227.78]) by server.web01.interscholz.net (Postfix) with ESMTPSA id 3B388340292; Wed, 22 Jun 2016 01:16:01 +0200 (CEST) Message-ID: <5769CAB0.3080708@pointsman.de> Date: Wed, 22 Jun 2016 01:16:00 +0200 From: Rolf Ade User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: Alan Mackenzie , 23775@debbugs.gnu.org Subject: Re: bug#23775: 25.0.95.2; c-mode: Incorrect indentation and function bundery detection References: <20160616091839.6925.qmail@mail.muc.de> In-Reply-To: <20160616091839.6925.qmail@mail.muc.de> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 23775 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 (/) Hello Alan, Am 06/16/2016 11:18 AM, Alan Mackenzie wrote: > [...] > I tried once before to solve this problem, but didn't get very far. What > was obvious, at the time, was that a solution would slow CC Mode down, > possibly quite a bit. > > So, we've collectively decided that this bug, although real, won't be > fixed. The best advice we can give is to arrange the C code such that > unbalanced braces in #if arms don't happen. > > Sorry. Just for the record: I stumbled about that in the wild. This function: http://core.tcl.tk/tdom/artifact/3a53ac985a15644d?ln=2142-2535 triggers the bug. I stripped down to a minimal example from that, not from the idea to do "preprocessor tricks" to fool c-mode. From debbugs-submit-bounces@debbugs.gnu.org Tue Jun 28 19:22:36 2016 Received: (at 23775) by debbugs.gnu.org; 28 Jun 2016 23:22:36 +0000 Received: from localhost ([127.0.0.1]:59476 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bI2Kx-0005Uh-Ta for submit@debbugs.gnu.org; Tue, 28 Jun 2016 19:22:36 -0400 Received: from mxout3.interscholz.de ([85.236.196.238]:34548) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bI2Kv-0005UY-Tk for 23775@debbugs.gnu.org; Tue, 28 Jun 2016 19:22:34 -0400 Received: from localhost (mxout3 [127.0.0.1]) by mxout3.interscholz.de (Postfix) with ESMTP id C388521554; Wed, 29 Jun 2016 01:22:32 +0200 (CEST) X-Virus-Scanned: interscholz amavisd-new at mxout3.interscholz.de Received: from server.web01.interscholz.net (server.web01.interscholz.net [85.236.196.138]) by mxout3.interscholz.de (Postfix) with ESMTP id E7412201E6; Wed, 29 Jun 2016 01:22:31 +0200 (CEST) Received: from linux-qg7d.site (p4FFBEB86.dip0.t-ipconnect.de [79.251.235.134]) by server.web01.interscholz.net (Postfix) with ESMTPSA id 7AC2C34034C; Wed, 29 Jun 2016 01:22:28 +0200 (CEST) Message-ID: <577306B3.5030501@pointsman.de> Date: Wed, 29 Jun 2016 01:22:27 +0200 From: Rolf Ade User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: Alan Mackenzie , 23775@debbugs.gnu.org Subject: Re: bug#23818: 25.0.95.3: c-beginning-of-defun misbehaviour References: <20160624150234.66344.qmail@mail.muc.de> In-Reply-To: <20160624150234.66344.qmail@mail.muc.de> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 23775 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 (/) Hello Alan, sorry for replying late, was off road. Am 06/24/2016 05:02 PM, Alan Mackenzie wrote: > [...] > There are two things here. The first is that you must configure "DBG" as > a "macro with a semicolon", as detailed in the CC Mode manual, page > "Macros with ;". For example, you could put the following into your > c-mode-common-hook: > > (setq c-macro-names-with-semicolon '("DBG")) > (c-make-macro-with-semi-re) > > [...] > The second part of the fix is an actual bug where the software fails to > check for "macros with semicolons" at a critical point. For that, could > you install the following patch, please, then byte-compile cc-engine.el: > > > > diff -r 4c8ccaedfd6a cc-engine.el > --- a/cc-engine.el Fri Jun 24 13:06:30 2016 +0000 > +++ b/cc-engine.el Fri Jun 24 14:55:30 2016 +0000 > @@ -9135,7 +9135,8 @@ > (/= last-stmt-start (point)) > (progn > (c-backward-syntactic-ws lim) > - (not (memq (char-before) '(?\; ?} ?: nil)))) > + (not (or (memq (char-before) '(?\; ?} ?: nil)) > + (c-at-vsemi-p)))) > (save-excursion > (backward-char) > (not (looking-at "\\s("))) > Did so. Patched, byte-compiled, evaluated the configuration in a emacs -Q: Yes, this works now as expected. With the example file and with the real case out of the wild (http://core.tcl.tk/tdom/artifact/2cf83fbbaefad3ef?ln=3268-3362), from which I stripped my reported example down. Much more pleasant, now. Thanks. I wasn't aware of chapter 12 "Customizing Macros" of the cc mode manual, in some sense I obviously expected that to "just work". Since I now have looked into chapter 12 of the manual I must say I also naive expected that to 'just' work ... Probably this should all work a completetly other way. As emacs -Q M-: (require 'cc-mode) RET C-h v c-macro-names-with-semicolon RET suggests. The last paragraph reads: "Note that currently (2008-11-04) this variable is a prototype, and is likely to disappear or change its form soon." That docstring may need revisiting. From debbugs-submit-bounces@debbugs.gnu.org Wed Jun 29 16:26:17 2016 Received: (at 23775) by debbugs.gnu.org; 29 Jun 2016 20:26:17 +0000 Received: from localhost ([127.0.0.1]:60356 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bIM3t-0005wg-87 for submit@debbugs.gnu.org; Wed, 29 Jun 2016 16:26:17 -0400 Received: from mail.muc.de ([193.149.48.3]:21294) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bIM3r-0005wX-NS for 23775@debbugs.gnu.org; Wed, 29 Jun 2016 16:26:16 -0400 Received: (qmail 7717 invoked by uid 3782); 29 Jun 2016 20:26:14 -0000 Received: from acm.muc.de (p4FC4603C.dip0.t-ipconnect.de [79.196.96.60]) by colin.muc.de (tmda-ofmipd) with ESMTP; Wed, 29 Jun 2016 22:26:12 +0200 Received: (qmail 21195 invoked by uid 1000); 29 Jun 2016 20:26:22 -0000 Date: Wed, 29 Jun 2016 20:26:22 +0000 To: Rolf Ade Subject: Re: bug#23818: 25.0.95.3: c-beginning-of-defun misbehaviour Message-ID: <20160629202622.GB5327@acm.fritz.box> References: <20160624150234.66344.qmail@mail.muc.de> <577306B3.5030501@pointsman.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <577306B3.5030501@pointsman.de> 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: -1.3 (-) X-Debbugs-Envelope-To: 23775 Cc: 23775@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: -1.3 (-) Hello, Rolf. On Wed, Jun 29, 2016 at 01:22:27AM +0200, Rolf Ade wrote: > Hello Alan, > sorry for replying late, was off road. No problems. > Am 06/24/2016 05:02 PM, Alan Mackenzie wrote: > > [...] > > There are two things here. The first is that you must configure "DBG" as > > a "macro with a semicolon", as detailed in the CC Mode manual, page > > "Macros with ;". For example, you could put the following into your > > c-mode-common-hook: > > (setq c-macro-names-with-semicolon '("DBG")) > > (c-make-macro-with-semi-re) > > [...] > > The second part of the fix is an actual bug where the software fails to > > check for "macros with semicolons" at a critical point. For that, could > > you install the following patch, please, then byte-compile cc-engine.el: > > diff -r 4c8ccaedfd6a cc-engine.el > > --- a/cc-engine.el Fri Jun 24 13:06:30 2016 +0000 > > +++ b/cc-engine.el Fri Jun 24 14:55:30 2016 +0000 > > @@ -9135,7 +9135,8 @@ > > (/= last-stmt-start (point)) > > (progn > > (c-backward-syntactic-ws lim) > > - (not (memq (char-before) '(?\; ?} ?: nil)))) > > + (not (or (memq (char-before) '(?\; ?} ?: nil)) > > + (c-at-vsemi-p)))) > > (save-excursion > > (backward-char) > > (not (looking-at "\\s("))) > Did so. Patched, byte-compiled, evaluated the configuration in a emacs > -Q: Yes, this works now as expected. With the example file and with > the real case out of the wild > (http://core.tcl.tk/tdom/artifact/2cf83fbbaefad3ef?ln=3268-3362), from > which I stripped my reported example down. Much more pleasant, now. > Thanks. Thank you. > I wasn't aware of chapter 12 "Customizing Macros" of the cc mode > manual, in some sense I obviously expected that to "just work". > Since I now have looked into chapter 12 of the manual I must say I > also naive expected that to 'just' work ... > Probably this should all work a completetly other way. As > emacs -Q > M-: (require 'cc-mode) RET > C-h v c-macro-names-with-semicolon RET > suggests. The last paragraph reads: > "Note that currently (2008-11-04) this variable is a prototype, > and is likely to disappear or change its form soon." > That docstring may need revisiting. Whoops! It needed revisiting 7½ years ago, but better late than never! I've committed the changes, to the CC Mode repository, the Emacs master branch and the XEmacs package repository. I'm going to close the bug. -- Alan Mackenzie (Nuremberg, Germany). From debbugs-submit-bounces@debbugs.gnu.org Wed Jun 29 16:27:39 2016 Received: (at 23775-done) by debbugs.gnu.org; 29 Jun 2016 20:27:39 +0000 Received: from localhost ([127.0.0.1]:60360 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bIM5D-0005yf-Iw for submit@debbugs.gnu.org; Wed, 29 Jun 2016 16:27:39 -0400 Received: from mail.muc.de ([193.149.48.3]:33186) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bIM5C-0005yW-Bd for 23775-done@debbugs.gnu.org; Wed, 29 Jun 2016 16:27:38 -0400 Received: (qmail 7993 invoked by uid 3782); 29 Jun 2016 20:27:37 -0000 Received: from acm.muc.de (p4FC4603C.dip0.t-ipconnect.de [79.196.96.60]) by colin.muc.de (tmda-ofmipd) with ESMTP; Wed, 29 Jun 2016 22:27:37 +0200 Received: (qmail 21203 invoked by uid 1000); 29 Jun 2016 20:27:46 -0000 Date: Wed, 29 Jun 2016 20:27:46 +0000 To: 23775-done@debbugs.gnu.org Subject: Re: bug#23818: 25.0.95.3: c-beginning-of-defun misbehaviour Message-ID: <20160629202746.GC5327@acm.fritz.box> References: <20160624150234.66344.qmail@mail.muc.de> <577306B3.5030501@pointsman.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <577306B3.5030501@pointsman.de> 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: -1.3 (-) X-Debbugs-Envelope-To: 23775-done 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: -1.3 (-) Bug fixed in master branch. -- Alan Mackenzie (Nuremberg, Germany). From unknown Mon Aug 18 19:30:07 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Thu, 28 Jul 2016 11:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator