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#12274: 24.2; awk-mode indentation failure Date: Fri, 25 Jan 2013 08:44:44 +0000 Message-ID: <20130125084444.GA3505@acm.acm> References: <20130124221603.GB20483@acm.acm> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1359103934 17390 80.91.229.3 (25 Jan 2013 08:52:14 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 25 Jan 2013 08:52:14 +0000 (UTC) Cc: 12274@debbugs.gnu.org To: Leo Liu Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Jan 25 09:52:31 2013 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Tyf1O-0003em-Vb for geb-bug-gnu-emacs@m.gmane.org; Fri, 25 Jan 2013 09:52:27 +0100 Original-Received: from localhost ([::1]:47772 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tyf17-00053l-LH for geb-bug-gnu-emacs@m.gmane.org; Fri, 25 Jan 2013 03:52:09 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:50873) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tyf12-00052c-7s for bug-gnu-emacs@gnu.org; Fri, 25 Jan 2013 03:52:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Tyf10-0000or-3e for bug-gnu-emacs@gnu.org; Fri, 25 Jan 2013 03:52:04 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:43143) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tyf0t-0000nq-6d; Fri, 25 Jan 2013 03:51:55 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1Tyf0z-0000et-Jc; Fri, 25 Jan 2013 03:52:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org, bug-cc-mode@gnu.org Resent-Date: Fri, 25 Jan 2013 08:52:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 12274 X-GNU-PR-Package: emacs,cc-mode X-GNU-PR-Keywords: Original-Received: via spool by 12274-submit@debbugs.gnu.org id=B12274.13591038992503 (code B ref 12274); Fri, 25 Jan 2013 08:52:01 +0000 Original-Received: (at 12274) by debbugs.gnu.org; 25 Jan 2013 08:51:39 +0000 Original-Received: from localhost ([127.0.0.1]:48607 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Tyf0c-0000eJ-79 for submit@debbugs.gnu.org; Fri, 25 Jan 2013 03:51:38 -0500 Original-Received: from colin.muc.de ([193.149.48.1]:25021 helo=mail.muc.de) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Tyf0Z-0000eA-L0 for 12274@debbugs.gnu.org; Fri, 25 Jan 2013 03:51:37 -0500 Original-Received: (qmail 96329 invoked by uid 3782); 25 Jan 2013 08:51:26 -0000 Original-Received: from acm.muc.de (pD95570C2.dip.t-dialin.net [217.85.112.194]) by colin.muc.de (tmda-ofmipd) with ESMTP; Fri, 25 Jan 2013 09:51:25 +0100 Original-Received: (qmail 3573 invoked by uid 1000); 25 Jan 2013 08:44:44 -0000 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 140.186.70.43 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: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:70280 Archived-At: Hello, Leo. On Fri, Jan 25, 2013 at 09:20:19AM +0800, Leo Liu wrote: [ .... ] > Alan, I also have another seemingly buglet about indentation. As Glenn remarked, this is bug #12274. > Every line after a pattern-action pair like the following one (where > action is omitted) is indented to column 4, i.e. it doesn't recognise a > newline terminates a pattern. > $0 == "Emacs" > | > all following lines indented here > (this might be regression, I seem to recall reporting something along > these lines some while ago.) No, not a regression, rather a bug which has been there since 4004 BC. It's actually the "=" sign which triggers it, confusing the parsing algortihm into thinking it's a C initialisation statement. The solution is to move the pertinent AWK parsing clause earlier on in the enclosing cond form. Glenn, this is not a regression. Should I nevertheless commit it to the emacs-24 branch? Here's the patch: diff -r 0d641a4d3e7c cc-engine.el --- a/cc-engine.el Wed Jan 23 18:17:40 2013 +0000 +++ b/cc-engine.el Fri Jan 25 08:27:12 2013 +0000 @@ -9880,6 +9880,18 @@ ;; contains any class offset ))) + ;; CASE 5P: AWK pattern or function or continuation + ;; thereof. + ((c-major-mode-is 'awk-mode) + (setq placeholder (point)) + (c-add-stmt-syntax + (if (and (eq (c-beginning-of-statement-1) 'same) + (/= (point) placeholder)) + 'topmost-intro-cont + 'topmost-intro) + nil nil + containing-sexp paren-state)) + ;; CASE 5D: this could be a top-level initialization, a ;; member init list continuation, or a template argument ;; list continuation. @@ -10039,18 +10051,6 @@ (goto-char (point-min))) (c-add-syntax 'objc-method-intro (c-point 'boi))) - ;; CASE 5P: AWK pattern or function or continuation - ;; thereof. - ((c-major-mode-is 'awk-mode) - (setq placeholder (point)) - (c-add-stmt-syntax - (if (and (eq (c-beginning-of-statement-1) 'same) - (/= (point) placeholder)) - 'topmost-intro-cont - 'topmost-intro) - nil nil - containing-sexp paren-state)) - ;; CASE 5N: At a variable declaration that follows a class ;; definition or some other block declaration that doesn't ;; end at the closing '}'. C.f. case 5D.5. > Leo -- Alan Mackenzie (Nuremberg, Germany).