GNU bug report logs - #12274
24.2; awk-mode indentation failure

Previous Next

Packages: cc-mode, emacs;

Reported by: Leo <sdl.web <at> gmail.com>

Date: Sat, 25 Aug 2012 06:04:01 UTC

Severity: minor

Found in version 24.2

Done: Alan Mackenzie <acm <at> muc.de>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 12274 in the body.
You can then email your comments to 12274 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#12274; Package emacs. (Sat, 25 Aug 2012 06:04:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Leo <sdl.web <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 25 Aug 2012 06:04:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Leo <sdl.web <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Cc: bug-cc-mode <at> gnu.org
Subject: 24.2; awk-mode indentation failure
Date: Sat, 25 Aug 2012 13:59:56 +0800
1. Emacs -q and change to a new buffer
2. M-x awk-mode
3. Type: NR >= 3
4. Type return and then tab to indent

The newline is indented.

AWK mode fails to recognise NR >= 3 as a pattern-action pair where
action is omitted. Statements in awk need no ; to terminate.

Leo




Information forwarded to bug-gnu-emacs <at> gnu.org, bug-cc-mode <at> gnu.org:
bug#12274; Package emacs,cc-mode. (Fri, 25 Jan 2013 08:52:01 GMT) Full text and rfc822 format available.

Message #8 received at 12274 <at> debbugs.gnu.org (full text, mbox):

From: Alan Mackenzie <acm <at> muc.de>
To: Leo Liu <sdl.web <at> gmail.com>
Cc: Glenn Morris <rgm <at> gnu.org>, 12274 <at> debbugs.gnu.org
Subject: Re: bug#12274: 24.2; awk-mode indentation failure
Date: Fri, 25 Jan 2013 08:44:44 +0000
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).




Information forwarded to bug-gnu-emacs <at> gnu.org, bug-cc-mode <at> gnu.org:
bug#12274; Package emacs,cc-mode. (Fri, 25 Jan 2013 17:34:01 GMT) Full text and rfc822 format available.

Message #11 received at 12274 <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: Alan Mackenzie <acm <at> muc.de>
Cc: Leo Liu <sdl.web <at> gmail.com>, 12274 <at> debbugs.gnu.org
Subject: Re: bug#12274: 24.2; awk-mode indentation failure
Date: Fri, 25 Jan 2013 12:33:16 -0500
Alan Mackenzie wrote:

> Glenn, this is not a regression.  Should I nevertheless commit it to the
> emacs-24 branch?

No, trunk please.




Reply sent to Alan Mackenzie <acm <at> muc.de>:
You have taken responsibility. (Fri, 25 Jan 2013 19:25:02 GMT) Full text and rfc822 format available.

Notification sent to Leo <sdl.web <at> gmail.com>:
bug acknowledged by developer. (Fri, 25 Jan 2013 19:25:03 GMT) Full text and rfc822 format available.

Message #16 received at 12274-done <at> debbugs.gnu.org (full text, mbox):

From: Alan Mackenzie <acm <at> muc.de>
To: 12274-done <at> debbugs.gnu.org
Subject: Re: bug#12274: 24.2; awk-mode indentation failure
Date: Fri, 25 Jan 2013 19:17:41 +0000
Bug fixed.

-- 
Alan Mackenzie (Nuremberg, Germany).




Information forwarded to bug-gnu-emacs <at> gnu.org, bug-cc-mode <at> gnu.org:
bug#12274; Package emacs,cc-mode. (Sat, 26 Jan 2013 11:12:02 GMT) Full text and rfc822 format available.

Message #19 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Alan Mackenzie <acm <at> muc.de>
Cc: Leo Liu <sdl.web <at> gmail.com>, 12274 <at> debbugs.gnu.org
Subject: Re: bug#12274: 24.2; awk-mode indentation failure
Date: Fri, 25 Jan 2013 07:58:48 -0500
> Glenn, this is not a regression.  Should I nevertheless commit it to the
> emacs-24 branch?

No, this should go to trunk,


        Stefan





bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 23 Feb 2013 12:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 11 years and 64 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.