From debbugs-submit-bounces@debbugs.gnu.org Tue Jun 21 20:19:45 2016 Received: (at submit) by debbugs.gnu.org; 22 Jun 2016 00:19:45 +0000 Received: from localhost ([127.0.0.1]:50178 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bFVtR-0004DN-Jp for submit@debbugs.gnu.org; Tue, 21 Jun 2016 20:19:45 -0400 Received: from eggs.gnu.org ([208.118.235.92]:47617) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bFVtQ-0004DB-M5 for submit@debbugs.gnu.org; Tue, 21 Jun 2016 20:19:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bFVtK-0006NY-HX for submit@debbugs.gnu.org; Tue, 21 Jun 2016 20:19: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=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:38722) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFVtK-0006NR-EU for submit@debbugs.gnu.org; Tue, 21 Jun 2016 20:19:38 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38576) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFVtI-0003by-A6 for bug-gnu-emacs@gnu.org; Tue, 21 Jun 2016 20:19:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bFVtD-0006Mq-Vi for bug-gnu-emacs@gnu.org; Tue, 21 Jun 2016 20:19:35 -0400 Received: from mxout3.interscholz.de ([85.236.196.238]:50458) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFVtD-0006MZ-P3 for bug-gnu-emacs@gnu.org; Tue, 21 Jun 2016 20:19:31 -0400 Received: from localhost (mxout3 [127.0.0.1]) by mxout3.interscholz.de (Postfix) with ESMTP id 91E262142B for ; Wed, 22 Jun 2016 02:19:25 +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 062A72047C for ; Wed, 22 Jun 2016 02:19:25 +0200 (CEST) Received: from linux-qg7d.fritz.box (p4FFBE34E.dip0.t-ipconnect.de [79.251.227.78]) by server.web01.interscholz.net (Postfix) with ESMTPSA id 2945D34030E; Wed, 22 Jun 2016 02:19:22 +0200 (CEST) From: Rolf Ade To: bug-gnu-emacs@gnu.org Subject: 25.0.95.3: c-beginning-of-defun misbehaviour Date: Wed, 22 Jun 2016 02:19:21 +0200 Message-ID: <87ziqeaxdi.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 (-----) The same in 24.5 and 25.0.95.3: emacs -Q Open some random emtpy buffer foo.c, put it in c-mode (M-x c-mode) and insert the following C code: #define DBG(x) x DBG( static void __dbgAttr () { /* something */ } ) int main (void) { int i; i++; i++; return i; } int foo () { int i; i++; i++; return 1; } Put the point inside function main and C-M-home (or M-x c-beginning-of-defun). Instead of the beginning of main() the point is here: _P_DBG( ... Far away from _P_int main(void) ... This isn't "unbalanced braces in preprocessor statements are horrendously difficult to parse" as in bug #23775, there are no unbalanced braces everywhere. It's that some code above the code of a syntactical correct function disturbs c-beginning-of-defun in finding the beginning of the function. Put the point into or at the end of function foo, do C-M-home and you are at the beginning of function foo. Do C-M-home again, and you are not at the beginning of main, but of the beginning of DBG. Remove the DBG(). Now C-M-home works, even if the point is inside or the end of main(). From debbugs-submit-bounces@debbugs.gnu.org Wed Jun 22 04:54:33 2016 Received: (at 23818) by debbugs.gnu.org; 22 Jun 2016 08:54:33 +0000 Received: from localhost ([127.0.0.1]:50332 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bFdvd-0008BA-I9 for submit@debbugs.gnu.org; Wed, 22 Jun 2016 04:54:33 -0400 Received: from mail.muc.de ([193.149.48.3]:19377) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bFdvb-0008Ay-6C for 23818@debbugs.gnu.org; Wed, 22 Jun 2016 04:54:31 -0400 Received: (qmail 17447 invoked by uid 3782); 22 Jun 2016 08:54:29 -0000 Date: 22 Jun 2016 08:54:29 -0000 Message-ID: <20160622085429.17438.qmail@mail.muc.de> From: Alan Mackenzie To: 23818@debbugs.gnu.org Subject: Re: bug#23818: 25.0.95.3: c-beginning-of-defun misbehaviour 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: 23818 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. Thanks for the bug report. I can reproduce it. I will work on it in the coming hours and days. -- Alan Mackenzie (Nuremberg, Germany). In article you wrote: > The same in 24.5 and 25.0.95.3: > emacs -Q > Open some random emtpy buffer foo.c, put it in c-mode (M-x c-mode) and > insert the following C code: > #define DBG(x) x > DBG( > static void __dbgAttr () { > /* something */ > } > ) > int main (void) > { > int i; > i++; > i++; > return i; > } > int foo () > { > int i; > i++; > i++; > return 1; > } > Put the point inside function main and C-M-home (or M-x > c-beginning-of-defun). Instead of the beginning of main() the point is > here: > _P_DBG( > ... > Far away from > _P_int main(void) > ... > This isn't "unbalanced braces in preprocessor statements are > horrendously difficult to parse" as in bug #23775, there are no > unbalanced braces everywhere. It's that some code above the code of a > syntactical correct function disturbs c-beginning-of-defun in finding > the beginning of the function. > Put the point into or at the end of function foo, do C-M-home and you > are at the beginning of function foo. Do C-M-home again, and you are not > at the beginning of main, but of the beginning of DBG. > Remove the DBG(). Now C-M-home works, even if the point is inside or the > end of main(). From debbugs-submit-bounces@debbugs.gnu.org Wed Jun 22 11:15:35 2016 Received: (at 23818) by debbugs.gnu.org; 22 Jun 2016 15:15:35 +0000 Received: from localhost ([127.0.0.1]:51301 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bFjsM-0005FO-Pp for submit@debbugs.gnu.org; Wed, 22 Jun 2016 11:15:34 -0400 Received: from eggs.gnu.org ([208.118.235.92]:45973) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bFjsK-0005FA-G1 for 23818@debbugs.gnu.org; Wed, 22 Jun 2016 11:15:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bFjsE-0001ZW-Gb for 23818@debbugs.gnu.org; Wed, 22 Jun 2016 11:15:27 -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.9 required=5.0 tests=BAYES_05,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:41611) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFjs5-0001XF-3s; Wed, 22 Jun 2016 11:15:17 -0400 Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:1870 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1bFjs3-0005l2-3N; Wed, 22 Jun 2016 11:15:15 -0400 Date: Wed, 22 Jun 2016 18:14:27 +0300 Message-Id: <83ziqd45nw.fsf@gnu.org> From: Eli Zaretskii To: Alan Mackenzie In-reply-to: <20160622085429.17438.qmail@mail.muc.de> (message from Alan Mackenzie on 22 Jun 2016 08:54:29 -0000) Subject: Re: bug#23818: 25.0.95.3: c-beginning-of-defun misbehaviour References: <87ziqeaxdi.fsf@linux-qg7d.fritz.box> <20160622085429.17438.qmail@mail.muc.de> 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.5 (------) X-Debbugs-Envelope-To: 23818 Cc: rolf@pointsman.de, 23818@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: , Reply-To: Eli Zaretskii Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -6.5 (------) > Date: 22 Jun 2016 08:54:29 -0000 > From: Alan Mackenzie > Cc: Rolf Ade > > Thanks for the bug report. I can reproduce it. > > I will work on it in the coming hours and days. I don't understand how can CC Mode reliably distinguish the example in the report from a function that returns a pointer to a function (in which case what the current code does is correct). From debbugs-submit-bounces@debbugs.gnu.org Fri Jun 24 10:43:36 2016 Received: (at 23818) by debbugs.gnu.org; 24 Jun 2016 14:43:36 +0000 Received: from localhost ([127.0.0.1]:54424 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bGSKW-0004po-6z for submit@debbugs.gnu.org; Fri, 24 Jun 2016 10:43:36 -0400 Received: from mail.muc.de ([193.149.48.3]:56173) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bGSKU-0004pg-QM for 23818@debbugs.gnu.org; Fri, 24 Jun 2016 10:43:35 -0400 Received: (qmail 47492 invoked by uid 3782); 24 Jun 2016 14:43:33 -0000 Date: 24 Jun 2016 14:43:33 -0000 Message-ID: <20160624144333.47491.qmail@mail.muc.de> From: Alan Mackenzie To: 23818@debbugs.gnu.org Subject: Re: bug#23818: 25.0.95.3: c-beginning-of-defun misbehaviour 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: 23818 Cc: Eli Zaretskii 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, Eli. In article you wrote: >> Date: 22 Jun 2016 08:54:29 -0000 >> From: Alan Mackenzie >> Cc: Rolf Ade [ .... ] > I don't understand how can CC Mode reliably distinguish the example in > the report from a function that returns a pointer to a function (in > which case what the current code does is correct). The solution to the bug involves, in part, configuring CC Mode so that it knows that "DBG" is a "macro with semicolon". The other part of the solution involves testing for such macros at the pertinent spot in c-beginning-of-decl-1. See my direct reply to the OP (not yet written). -- Alan Mackenzie (Nuremberg, Germany). From debbugs-submit-bounces@debbugs.gnu.org Fri Jun 24 11:02:36 2016 Received: (at 23818) by debbugs.gnu.org; 24 Jun 2016 15:02:36 +0000 Received: from localhost ([127.0.0.1]:54454 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bGScu-0005Kz-D3 for submit@debbugs.gnu.org; Fri, 24 Jun 2016 11:02:36 -0400 Received: from mail.muc.de ([193.149.48.3]:55277) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bGSct-0005Kr-C1 for 23818@debbugs.gnu.org; Fri, 24 Jun 2016 11:02:35 -0400 Received: (qmail 66345 invoked by uid 3782); 24 Jun 2016 15:02:34 -0000 Date: 24 Jun 2016 15:02:34 -0000 Message-ID: <20160624150234.66344.qmail@mail.muc.de> From: Alan Mackenzie To: Rolf Ade Subject: Re: bug#23818: 25.0.95.3: c-beginning-of-defun misbehaviour 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: 23818 Cc: 23818@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.4 (-) Hello, Rolf In article you wrote: > The same in 24.5 and 25.0.95.3: > emacs -Q > Open some random emtpy buffer foo.c, put it in c-mode (M-x c-mode) and > insert the following C code: > #define DBG(x) x > DBG( > static void __dbgAttr () { > /* something */ > } > ) > int main (void) > { > int i; > i++; > i++; > return i; > } > int foo () > { > int i; > i++; > i++; > return 1; > } > Put the point inside function main and C-M-home (or M-x > c-beginning-of-defun). Instead of the beginning of main() the point is > here: > _P_DBG( > ... > Far away from > _P_int main(void) > ... Thank you for the bug report, and thanks even more for making it a nice concise easy to work with example. > This isn't "unbalanced braces in preprocessor statements are > horrendously difficult to parse" as in bug #23775, there are no > unbalanced braces everywhere. It's that some code above the code of a > syntactical correct function disturbs c-beginning-of-defun in finding > the beginning of the function. 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) . That would set up that macro for all your C files. c-mode-common-hook is more precisely described on pages "Configuration Basics" and "CC Hooks" in the CC Mode manual. 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("))) If you want any help with applying the patch, or byte compiling, or setting up a hook, etc., feel free to send me a private email. [ .... ] When you've done all this, could you please confirm that it fixes the problem so I can close the bug, or tell me what's still buggy. Thanks! -- Alan Mackenzie (Nuremberg, Germany). From debbugs-submit-bounces@debbugs.gnu.org Tue Jun 28 20:57:22 2016 Received: (at 23818) by debbugs.gnu.org; 29 Jun 2016 00:57:22 +0000 Received: from localhost ([127.0.0.1]:59498 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bI3of-0007lu-Sb for submit@debbugs.gnu.org; Tue, 28 Jun 2016 20:57:22 -0400 Received: from mxout3.interscholz.de ([85.236.196.238]:35861) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bI3oe-0007lk-He for 23818@debbugs.gnu.org; Tue, 28 Jun 2016 20:57:21 -0400 Received: from localhost (mxout3 [127.0.0.1]) by mxout3.interscholz.de (Postfix) with ESMTP id B5AAC2118E for <23818@debbugs.gnu.org>; Wed, 29 Jun 2016 02:57:16 +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 D43E3207A2 for <23818@debbugs.gnu.org>; Wed, 29 Jun 2016 02:57:15 +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 C43A2340292 for <23818@debbugs.gnu.org>; Wed, 29 Jun 2016 02:57:13 +0200 (CEST) Message-ID: <57731CE8.3030704@pointsman.de> Date: Wed, 29 Jun 2016 02:57:12 +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: 23818@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: 23818 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 Tue Aug 08 17:42:50 2017 Received: (at 23818) by debbugs.gnu.org; 8 Aug 2017 21:42:50 +0000 Received: from localhost ([127.0.0.1]:52314 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dfCH4-0004Fn-1H for submit@debbugs.gnu.org; Tue, 08 Aug 2017 17:42:50 -0400 Received: from mxout3.interscholz.de ([85.236.196.238]:49412) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dfCH2-0004Fb-DM for 23818@debbugs.gnu.org; Tue, 08 Aug 2017 17:42:49 -0400 Received: from localhost (mxout3 [127.0.0.1]) by mxout3.interscholz.de (Postfix) with ESMTP id 84C8921F0D; Tue, 8 Aug 2017 23:42:40 +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 4EF5920D3F; Tue, 8 Aug 2017 23:42:39 +0200 (CEST) Received: from linux-qg7d (p4FFBE1C9.dip0.t-ipconnect.de [79.251.225.201]) by server.web01.interscholz.net (Postfix) with ESMTPSA id ED52E34032F; Tue, 8 Aug 2017 23:42:36 +0200 (CEST) From: Rolf Ade To: 23818@debbugs.gnu.org, Alan Mackenzie Subject: Re: bug#23818: 25.0.95.3: c-beginning-of-defun misbehaviour References: <20160624150234.66344.qmail@mail.muc.de> <57731CE8.3030704@pointsman.de> Date: Tue, 08 Aug 2017 23:42:36 +0200 In-Reply-To: <57731CE8.3030704@pointsman.de> (Rolf Ade's message of "Wed, 29 Jun 2016 02:57:12 +0200") Message-ID: <87d185ag8j.fsf@pointsman.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 23818 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 (/) Hi Alan, while searching for something else I saw it bug is still open. It's fixed and good, but just not closed. (Somehow, the following exchanges about this bug landed in bug#23775.) Clean up and mark as done. rolf Rolf Ade writes: > 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 Sun Aug 13 09:18:37 2017 Received: (at 23818-done) by debbugs.gnu.org; 13 Aug 2017 13:18:37 +0000 Received: from localhost ([127.0.0.1]:59289 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dgsmq-0003OM-TK for submit@debbugs.gnu.org; Sun, 13 Aug 2017 09:18:37 -0400 Received: from ocolin.muc.de ([193.149.48.4]:39610 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1dgsmp-0003OG-9q for 23818-done@debbugs.gnu.org; Sun, 13 Aug 2017 09:18:35 -0400 Received: (qmail 28553 invoked by uid 3782); 13 Aug 2017 13:18:33 -0000 Received: from acm.muc.de (p548C62BA.dip0.t-ipconnect.de [84.140.98.186]) by colin.muc.de (tmda-ofmipd) with ESMTP; Sun, 13 Aug 2017 15:18:32 +0200 Received: (qmail 3983 invoked by uid 1000); 13 Aug 2017 13:17:18 -0000 Date: Sun, 13 Aug 2017 13:17:18 +0000 To: Rolf Ade Subject: Re: bug#23818: 25.0.95.3: c-beginning-of-defun misbehaviour Message-ID: <20170813131718.GA3530@acm> References: <20160624150234.66344.qmail@mail.muc.de> <57731CE8.3030704@pointsman.de> <87d185ag8j.fsf@pointsman.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87d185ag8j.fsf@pointsman.de> 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: 23818-done Cc: 23818-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, Rolf On Tue, Aug 08, 2017 at 23:42:36 +0200, Rolf Ade wrote: > Hi Alan, > while searching for something else I saw it bug is still open. It's > fixed and good, but just not closed. (Somehow, the following exchanges > about this bug landed in bug#23775.) Clean up and mark as done. Yes, there was a bit of confusion back then. Sorry about that. With this Email, I'm closing bug #23818. Thanks for the reminder. > rolf -- Alan Mackenzie (Nuremberg, Germany). From unknown Sun Jun 15 08:47:26 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Mon, 11 Sep 2017 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