From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel Subject: Re: CC Mode 5.31.4 (C/l); c-end-of-defun broken Date: 18 Apr 2007 21:15:47 +0200 Message-ID: <20070418203555.GB2100@muc.de> References: <87zm55sgea.fsf@stupidchicken.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1176923764 1473 80.91.229.12 (18 Apr 2007 19:16:04 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 18 Apr 2007 19:16:04 +0000 (UTC) Cc: Andreas Schwab , emacs-devel@gnu.org, A Soare To: Chong Yidong Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Apr 18 21:15:57 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1HeFdC-0005Zm-Fp for ged-emacs-devel@m.gmane.org; Wed, 18 Apr 2007 21:15:54 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HeFi3-00031j-Mm for ged-emacs-devel@m.gmane.org; Wed, 18 Apr 2007 15:20:55 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HeFi0-00031Y-SO for emacs-devel@gnu.org; Wed, 18 Apr 2007 15:20:52 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HeFhz-000315-TC for emacs-devel@gnu.org; Wed, 18 Apr 2007 15:20:52 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HeFhz-00030y-Os for emacs-devel@gnu.org; Wed, 18 Apr 2007 15:20:51 -0400 Original-Received: from colin.muc.de ([193.149.48.1] helo=mail.muc.de) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1HeFd7-00054W-Ep for emacs-devel@gnu.org; Wed, 18 Apr 2007 15:15:49 -0400 Original-Received: (qmail 1816 invoked by uid 3782); 18 Apr 2007 19:15:47 -0000 Original-Received: from acm.muc.de (p54a3f879.dip.t-dialin.net [84.163.248.121]) by colin2.muc.de (tmda-ofmipd) with ESMTP; Wed, 18 Apr 2007 21:15:44 +0200 Original-Received: (qmail 3071 invoked by uid 1000); 18 Apr 2007 20:35:55 -0000 Original-Date: Wed, 18 Apr 2007 21:35:55 +0100 Content-Disposition: inline In-Reply-To: <87zm55sgea.fsf@stupidchicken.com> User-Agent: Mutt/1.5.9i X-Delivery-Agent: TMDA/1.1.5 (Fettercairn) X-Primary-Address: acm@muc.de X-detected-kernel: FreeBSD 4.6-4.9 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:69575 Archived-At: 'Evening, Chong! On Wed, Apr 18, 2007 at 02:10:05PM -0400, Chong Yidong wrote: > Andreas Schwab writes: > > c-end-of-defun no longer always goes to the end of the function. This > > breaks add-log-current-defun, for example. It doesn't always happen, but > > you can reproduce it with > > . > > Just load the file and type M-C-e. You end up in the middle of > > lookup_partial_symtab instead of at the end of lookup_symtab. > The trouble is the following code in c-end-of-defun (cc-cmds.el:1645): > > ;; Move forward to the } of a function > (if (> arg 0) > (setq arg (c-forward-to-nth-EOF-} arg where)))) > > ;; Do we need to move forward from the brace to the semicolon? > (when (eq arg 0) > (if (c-in-function-trailer-p) ; after "}" of struct/enum, etc. > (c-syntactic-re-search-forward ";")) > The function c-in-function-trailer-p thinks we are between the closing > brace and the semicolon of struct construct, because this function > returns a struct *: > struct symtab * > lookup_symtab (const char *name) > { > Alan, can you come up with a quick fix? Yes. There is code which analyses `struct' headers properly in the function `c-end-of-decl-1' in cc-engine.el. I can copy this into `c-in-function-trailer-p'. I might be able to post a patch tonight. If not, tomorrow. -- Alan.