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 22:11:38 +0200 Message-ID: <20070418213146.GC2100@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 1176927117 21725 80.91.229.12 (18 Apr 2007 20:11:57 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 18 Apr 2007 20:11:57 +0000 (UTC) Cc: bug-cc-mode@gnu.org, emacs-devel@gnu.org To: Chong Yidong , A Soare , Andreas Schwab Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Apr 18 22:11:50 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 1HeGVJ-0006bM-Sv for ged-emacs-devel@m.gmane.org; Wed, 18 Apr 2007 22:11:50 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HeGaB-00074h-Ir for ged-emacs-devel@m.gmane.org; Wed, 18 Apr 2007 16:16:51 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1HeGa7-00072Q-9w for emacs-devel@gnu.org; Wed, 18 Apr 2007 16:16:47 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1HeGa5-00070y-P1 for emacs-devel@gnu.org; Wed, 18 Apr 2007 16:16:46 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1HeGa5-00070q-Hp for emacs-devel@gnu.org; Wed, 18 Apr 2007 16:16:45 -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 1HeGVC-0004rd-Sl for emacs-devel@gnu.org; Wed, 18 Apr 2007 16:11:43 -0400 Original-Received: (qmail 9536 invoked by uid 3782); 18 Apr 2007 20:11:38 -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 22:11:34 +0200 Original-Received: (qmail 3837 invoked by uid 1000); 18 Apr 2007 21:31:46 -0000 Original-Date: Wed, 18 Apr 2007 22:31:46 +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:69579 Archived-At: Hi, everybody! 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. > Alan, can you come up with a quick fix? Could people please test this fix (which I haven't yet committed): 2007-04-18 acm * progmodes/cc-cmds.el (c-in-function-trailer-p): Fix this: when a function type contains "struct", "union", etc. c-end-of-defun goes too far forward. Index: cc-cmds.el =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/progmodes/cc-cmds.el,v retrieving revision 1.59 diff -c -r1.59 cc-cmds.el *** cc-cmds.el 17 Apr 2007 20:48:43 -0000 1.59 --- cc-cmds.el 18 Apr 2007 20:02:47 -0000 *************** *** 1358,1369 **** ;; ;; This function might do hidden buffer changes. (and c-opt-block-decls-with-vars-key ! (save-excursion ! (c-syntactic-skip-backward "^;}" lim) ! (and (eq (char-before) ?\}) ! (eq (car (c-beginning-of-decl-1 lim)) 'previous) ! (looking-at c-opt-block-decls-with-vars-key) ! (point))))) (defun c-where-wrt-brace-construct () ;; Determine where we are with respect to functions (or other brace --- 1358,1382 ---- ;; ;; This function might do hidden buffer changes. (and c-opt-block-decls-with-vars-key ! (let (bod) ! (save-excursion ! (c-syntactic-skip-backward "^;}" lim) ! (and (eq (char-before) ?\}) ! (eq (car (c-beginning-of-decl-1 lim)) 'previous) ! (setq bod (point)) ! ;; Look for struct or union or ... If we find one, it might ! ;; be the return type of a function, or the like. Exclude ! ;; this case. ! (c-syntactic-re-search-forward ! (concat "[;=\(\[{]\\|\\(" ! c-opt-block-decls-with-vars-key ! "\\)") ! lim t t t) ! (match-beginning 1) ; Is there a "struct" etc., somewhere? ! (not (eq (char-before) ?_)) ! (c-syntactic-re-search-forward "[;=\(\[{]" lim t t t) ! (eq (char-before) ?\{) ! bod))))) (defun c-where-wrt-brace-construct () ;; Determine where we are with respect to functions (or other brace -- Alan.