From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Rolf Ade Newsgroups: gmane.emacs.bugs Subject: bug#23818: 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> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1466554835 20514 80.91.229.3 (22 Jun 2016 00:20:35 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 22 Jun 2016 00:20:35 +0000 (UTC) To: 23818@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Jun 22 02:20:22 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 1bFVtv-0002vx-BP for geb-bug-gnu-emacs@m.gmane.org; Wed, 22 Jun 2016 02:20:15 +0200 Original-Received: from localhost ([::1]:54946 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFVtt-0003eC-V9 for geb-bug-gnu-emacs@m.gmane.org; Tue, 21 Jun 2016 20:20:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:38748) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFVtm-0003cX-83 for bug-gnu-emacs@gnu.org; Tue, 21 Jun 2016 20:20:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bFVti-0006Vl-SF for bug-gnu-emacs@gnu.org; Tue, 21 Jun 2016 20:20:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:37841) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFVti-0006Va-P6 for bug-gnu-emacs@gnu.org; Tue, 21 Jun 2016 20:20:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bFVti-0004Dz-Hg for bug-gnu-emacs@gnu.org; Tue, 21 Jun 2016 20:20:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Rolf Ade Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 22 Jun 2016 00:20:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 23818 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.146655478516209 (code B ref -1); Wed, 22 Jun 2016 00:20:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 22 Jun 2016 00:19:45 +0000 Original-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 Original-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 Original-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 Original-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 Original-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 Original-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 Original-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 Original-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 Original-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) Original-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) 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-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:119909 Archived-At: 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().