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#5649: 23.1.92; Indentation problems in C mode Date: Mon, 1 Mar 2010 18:04:01 +0000 Message-ID: <20100301180401.GA2864@muc.de> References: <87d3zredux.fsf@stupidchicken.com> <20100301113832.GA12488@muc.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1267467989 21679 80.91.229.12 (1 Mar 2010 18:26:29 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 1 Mar 2010 18:26:29 +0000 (UTC) Cc: Chong Yidong , "5649@debbugs.gnu.org" <5649@debbugs.gnu.org> To: Michael Welsh Duggan Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Mar 01 19:26:24 2010 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1NmAJ1-0002WN-QD for geb-bug-gnu-emacs@m.gmane.org; Mon, 01 Mar 2010 19:25:24 +0100 Original-Received: from localhost ([127.0.0.1]:52660 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NmAJ0-0001Hs-Je for geb-bug-gnu-emacs@m.gmane.org; Mon, 01 Mar 2010 13:25:22 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NmAHe-0008Dm-MY for bug-gnu-emacs@gnu.org; Mon, 01 Mar 2010 13:23:58 -0500 Original-Received: from [140.186.70.92] (port=41975 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NmAHd-0008CG-MM for bug-gnu-emacs@gnu.org; Mon, 01 Mar 2010 13:23:58 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1NmAHc-0004N5-CK for bug-gnu-emacs@gnu.org; Mon, 01 Mar 2010 13:23:57 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:37909) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NmAHc-0004Mx-9g for bug-gnu-emacs@gnu.org; Mon, 01 Mar 2010 13:23:56 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1Nm9ra-0006HP-Ig; Mon, 01 Mar 2010 12:57:02 -0500 X-Loop: bug-gnu-emacs@gnu.org Resent-From: Alan Mackenzie Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 01 Mar 2010 17:57:02 +0000 Resent-Message-ID: Resent-Sender: bug-gnu-emacs@gnu.org X-Emacs-PR-Message: followup 5649 X-Emacs-PR-Package: emacs,cc-mode X-Emacs-PR-Keywords: Original-Received: via spool by 5649-submit@debbugs.gnu.org id=B5649.126746619724125 (code B ref 5649); Mon, 01 Mar 2010 17:57:02 +0000 Original-Received: (at 5649) by debbugs.gnu.org; 1 Mar 2010 17:56:37 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Nm9rA-0006H4-O3 for submit@debbugs.gnu.org; Mon, 01 Mar 2010 12:56:37 -0500 Original-Received: from colin.muc.de ([193.149.48.1] helo=mail.muc.de) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Nm9r8-0006Gz-51 for 5649@debbugs.gnu.org; Mon, 01 Mar 2010 12:56:35 -0500 Original-Received: (qmail 24027 invoked by uid 3782); 1 Mar 2010 17:56:28 -0000 Original-Received: from acm.muc.de (pD9E5025A.dip.t-dialin.net [217.229.2.90]) by colin2.muc.de (tmda-ofmipd) with ESMTP; Mon, 01 Mar 2010 18:56:26 +0100 Original-Received: (qmail 2974 invoked by uid 1000); 1 Mar 2010 18:04:01 -0000 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.9i X-Delivery-Agent: TMDA/1.1.5 (Fettercairn) X-Primary-Address: acm@muc.de X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Mon, 01 Mar 2010 12:57:02 -0500 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) 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: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:35372 Archived-At: Hello, again, On Mon, Mar 01, 2010 at 10:17:00AM -0500, Michael Welsh Duggan wrote: > Alan Mackenzie writes: > > I've just committed the folowing patch, which should fix the bug: > I'm afraid this causes a much more serious bug. Recipe: > emacs -Q > Open a new C-mode file. Then type the following: > #if FOO > #endif > int bar; Sorry. > For me the following happens: The #endif is not fontified. The "int > bar" is not fontified. The semicolon causes an error. I have verified > that reverting the patch below goes back to the old behavior, so this > patch is what is causing the bug. Yes. > > === modified file 'lisp/progmodes/cc-engine.el' > > --- lisp/progmodes/cc-engine.el 2010-02-25 21:21:25 +0000 > > +++ lisp/progmodes/cc-engine.el 2010-03-01 11:23:59 +0000 > > @@ -2641,7 +2641,8 @@ > > ;; (car c-state-cache). There can be no open parens/braces/brackets > > ;; between `good-pos'/`good-pos-actual-macro-start' and (point-max), > > ;; due to the interface spec to this function. > > - (setq pos (if good-pos-actual-macro-end > > + (setq pos (if (and good-pos-actual-macro-end > > + (> in-macro-start good-pos-actual-macro-start)) > > (1+ good-pos-actual-macro-end) ; get outside the macro as > > ; marked by a `category' text property. > > good-pos)) I was thrown by my own bad commenting. :-( I've committed a correction to this. The relevant diff (wrt the buggy "middle" version) is: === modified file 'lisp/progmodes/cc-engine.el' --- lisp/progmodes/cc-engine.el 2010-03-01 11:31:42 +0000 +++ lisp/progmodes/cc-engine.el 2010-03-01 17:42:35 +0000 @@ -2591,7 +2591,7 @@ (save-restriction (narrow-to-region 1 (point-max)) (save-excursion - (let* ((in-macro-start ; point-max or beginning of macro containing it + (let* ((in-macro-start ; start of macro containing (point-max) or nil. (save-excursion (goto-char (point-max)) (and (c-beginning-of-macro) @@ -2642,7 +2642,8 @@ ;; between `good-pos'/`good-pos-actual-macro-start' and (point-max), ;; due to the interface spec to this function. (setq pos (if (and good-pos-actual-macro-end - (> in-macro-start good-pos-actual-macro-start)) + (not (eq good-pos-actual-macro-start + in-macro-start))) (1+ good-pos-actual-macro-end) ; get outside the macro as ; marked by a `category' text property. good-pos)) > > Thanks for the clean and concise bug report! I hope it's right now. > -- > Michael Welsh Duggan > (mwd@cert.org) -- Alan Mackenzie (Nuremberg, Germany).