From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Michael Welsh Duggan Newsgroups: gmane.emacs.bugs Subject: bug#5649: 23.1.92; Indentation problems in C mode Date: Mon, 01 Mar 2010 10:17:00 -0500 Message-ID: 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 1267457049 8395 80.91.229.12 (1 Mar 2010 15:24:09 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 1 Mar 2010 15:24:09 +0000 (UTC) Cc: Chong Yidong , "5649@debbugs.gnu.org" <5649@debbugs.gnu.org> To: Alan Mackenzie Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Mar 01 16:24:04 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 1Nm7TX-0006p3-61 for geb-bug-gnu-emacs@m.gmane.org; Mon, 01 Mar 2010 16:24:03 +0100 Original-Received: from localhost ([127.0.0.1]:46174 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nm7TW-0003Iv-KV for geb-bug-gnu-emacs@m.gmane.org; Mon, 01 Mar 2010 10:24:02 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Nm7TR-0003IV-UL for bug-gnu-emacs@gnu.org; Mon, 01 Mar 2010 10:23:57 -0500 Original-Received: from [140.186.70.92] (port=44640 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nm7TQ-0003IN-W3 for bug-gnu-emacs@gnu.org; Mon, 01 Mar 2010 10:23:57 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Nm7TP-0002xY-SQ for bug-gnu-emacs@gnu.org; Mon, 01 Mar 2010 10:23:57 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:43028) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Nm7TP-0002xU-PF for bug-gnu-emacs@gnu.org; Mon, 01 Mar 2010 10:23:55 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1Nm7Pe-0003rG-SO; Mon, 01 Mar 2010 10:20:02 -0500 X-Loop: bug-gnu-emacs@gnu.org Resent-From: Michael Welsh Duggan 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 15:20: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.126745678514813 (code B ref 5649); Mon, 01 Mar 2010 15:20:02 +0000 Original-Received: (at 5649) by debbugs.gnu.org; 1 Mar 2010 15:19:45 +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 1Nm7PM-0003qs-I8 for submit@debbugs.gnu.org; Mon, 01 Mar 2010 10:19:44 -0500 Original-Received: from euclid.red.cert.org ([192.88.209.48]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Nm7Mo-0003p0-NM for 5649@debbugs.gnu.org; Mon, 01 Mar 2010 10:17:07 -0500 Original-Received: from bucknell.indigo.cert.org (bucknell.indigo.cert.org [10.60.10.121]) by euclid.red.cert.org (8.13.8/8.13.8) with ESMTP id o21FGc56029427; Mon, 1 Mar 2010 10:16:38 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cert.org; s=jthatj15xw2j; t=1267456598; bh=dodK9UOODNJyxDFCjF61jpN6vgx+Apq+ykMfUzY5IUs=; h=From:To:Cc:Subject:References:Date:In-Reply-To:Message-ID: MIME-Version:Content-Type:Sender:Reply-To; b=EeSoqmwSQgvipPGSgIyRGEBjEJm8s4WK7bw2j8EU+k6JwReJV3Pid8w2xs/KPXmFg MtfoIy3axnoucW7bC+IWLVeq9gIFoFxiaLmX7f+6oR210dqph6zDlgduN880GqdDIQ epHKSQdymfmh81CWiFHgonBIk/RlKmycsv0vhUbU= Original-Received: from maru.green.cert.org (maru.green.cert.org [10.21.10.16]) by bucknell.indigo.cert.org (8.13.8/8.13.8/2.77) with ESMTP id o21FH0nL015673; Mon, 1 Mar 2010 10:17:00 -0500 Original-Received: (from mwd@localhost) by maru.green.cert.org (8.13.8/8.13.8/Submit/1.6) id o21FH0tg026073; Mon, 1 Mar 2010 10:17:00 -0500 X-Authentication-Warning: maru.green.cert.org: mwd set sender to mwd@cert.org using -f In-Reply-To: <20100301113832.GA12488@muc.de> (Alan Mackenzie's message of "Mon, 1 Mar 2010 06:38:32 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.93 (gnu/linux) X-Mailman-Approved-At: Mon, 01 Mar 2010 10:19:43 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Mon, 01 Mar 2010 10:20: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:35370 Archived-At: Alan Mackenzie writes: > Hi, Michael and Yidong > > On Fri, Feb 26, 2010 at 07:12:06PM -0500, Chong Yidong wrote: >> Michael Welsh Duggan writes: > >> > I'm getting some screwy indentation behavior from C mode. From a >> > current bzr checkout/install of emacs, try the following recipe: > >> > emacs -Q foo.c | starts emacs on foo.c (included below) >> > C-u 7 C-n | move down 7 lines >> > TAB | indent, nothing changes (good) >> > C-p C-p | move up 2 lines >> > TAB C-n TAB C-n | indent 2 lines, nothing changes (good) >> > TAB | line unindents by 2 (bad) >> > TAB | line re-indents (good, but strange) >> > TAB | no change this time > >> Thanks. This is a regression vs Emacs 23.1, so we should definitely fix >> it before releasing Emacs 23.2. > >> I can reproduce the bug with the Emacs 23.0.90, so it's be around since >> at lease 12-09 last year. However, I haven't yet had the time to do a >> proper bisect. > > 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; 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. > === 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)) > > > Thanks for the clean and concise bug report! -- Michael Welsh Duggan (mwd@cert.org)