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 11:38:32 +0000 Message-ID: <20100301113832.GA12488@muc.de> References: <87d3zredux.fsf@stupidchicken.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1267444454 25291 80.91.229.12 (1 Mar 2010 11:54:14 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 1 Mar 2010 11:54:14 +0000 (UTC) Cc: 5649@debbugs.gnu.org, Michael Welsh Duggan To: Chong Yidong Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Mar 01 12:54:09 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 1Nm4CK-0008Uq-Hf for geb-bug-gnu-emacs@m.gmane.org; Mon, 01 Mar 2010 12:54:04 +0100 Original-Received: from localhost ([127.0.0.1]:48180 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nm4CJ-0004Qq-OY for geb-bug-gnu-emacs@m.gmane.org; Mon, 01 Mar 2010 06:54:03 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Nm4CE-0004PW-4t for bug-gnu-emacs@gnu.org; Mon, 01 Mar 2010 06:53:58 -0500 Original-Received: from [140.186.70.92] (port=44418 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nm4CC-0004Or-Ve for bug-gnu-emacs@gnu.org; Mon, 01 Mar 2010 06:53:57 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Nm4CB-00069t-Ln for bug-gnu-emacs@gnu.org; Mon, 01 Mar 2010 06:53:56 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:44388) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Nm4CB-00069j-Hv for bug-gnu-emacs@gnu.org; Mon, 01 Mar 2010 06:53:55 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1Nm3qz-0000nl-ML; Mon, 01 Mar 2010 06:32:01 -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 11:32:01 +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.12674430703053 (code B ref 5649); Mon, 01 Mar 2010 11:32:01 +0000 Original-Received: (at 5649) by debbugs.gnu.org; 1 Mar 2010 11:31:10 +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 1Nm3q9-0000nC-VM for submit@debbugs.gnu.org; Mon, 01 Mar 2010 06:31:10 -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 1Nm3q5-0000mf-RI for 5649@debbugs.gnu.org; Mon, 01 Mar 2010 06:31:09 -0500 Original-Received: (qmail 98771 invoked by uid 3782); 1 Mar 2010 11:30:59 -0000 Original-Received: from acm.muc.de (pD9E507B3.dip.t-dialin.net [217.229.7.179]) by colin2.muc.de (tmda-ofmipd) with ESMTP; Mon, 01 Mar 2010 12:30:57 +0100 Original-Received: (qmail 12855 invoked by uid 1000); 1 Mar 2010 11:38:32 -0000 Content-Disposition: inline In-Reply-To: <87d3zredux.fsf@stupidchicken.com> 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 06:32:01 -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:35368 Archived-At: 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: === 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! -- Alan Mackenzie (Nuremberg, Germany).