From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs Subject: bug#23818: 25.0.95.3: c-beginning-of-defun misbehaviour Date: 22 Jun 2016 08:54:29 -0000 Organization: muc.de e.V. Message-ID: <20160622085429.17438.qmail@mail.muc.de> References: <87ziqeaxdi.fsf@linux-qg7d.fritz.box> NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1466585737 7297 80.91.229.3 (22 Jun 2016 08:55:37 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 22 Jun 2016 08:55:37 +0000 (UTC) Cc: Rolf Ade To: 23818@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Jun 22 10:55:28 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1bFdwV-0003cp-F8 for geb-bug-gnu-emacs@m.gmane.org; Wed, 22 Jun 2016 10:55:27 +0200 Original-Received: from localhost ([::1]:56649 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFdwU-0006c3-3m for geb-bug-gnu-emacs@m.gmane.org; Wed, 22 Jun 2016 04:55:26 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48956) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFdwF-0006V7-Rp for bug-gnu-emacs@gnu.org; Wed, 22 Jun 2016 04:55:16 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bFdwE-0002lv-Pf for bug-gnu-emacs@gnu.org; Wed, 22 Jun 2016 04:55:11 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:37995) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFdw6-0002hk-1G; Wed, 22 Jun 2016 04:55:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bFdw5-0008Bu-Mv; Wed, 22 Jun 2016 04:55:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org, bug-cc-mode@gnu.org Resent-Date: Wed, 22 Jun 2016 08:55:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 23818 X-GNU-PR-Package: emacs,cc-mode X-GNU-PR-Keywords: Original-Received: via spool by 23818-submit@debbugs.gnu.org id=B23818.146658567331448 (code B ref 23818); Wed, 22 Jun 2016 08:55:01 +0000 Original-Received: (at 23818) by debbugs.gnu.org; 22 Jun 2016 08:54:33 +0000 Original-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 Original-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 Original-Received: (qmail 17447 invoked by uid 3782); 22 Jun 2016 08:54:29 -0000 In-Reply-To: X-Newsgroups: gnu.emacs.bug User-Agent: tin/2.3.1-20141224 ("Tallant") (UNIX) (FreeBSD/10.3-RELEASE-p4 (amd64)) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:119922 Archived-At: 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().