unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: Leo Liu <sdl.web@gmail.com>
Cc: 12274@debbugs.gnu.org
Subject: bug#12274: 24.2; awk-mode indentation failure
Date: Fri, 25 Jan 2013 08:44:44 +0000	[thread overview]
Message-ID: <20130125084444.GA3505@acm.acm> (raw)
In-Reply-To: <m2obget5ws.fsf@gmail.com>

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).





  parent reply	other threads:[~2013-01-25  8:44 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-24 11:43 bug#13541: 24.2.92; awk-mode: wrong font locking regexp literals Leo Liu
2013-01-24 18:28 ` Glenn Morris
     [not found] ` <b5ehhajuzy.fsf@fencepost.gnu.org>
2013-01-24 22:16   ` Alan Mackenzie
2013-01-25  1:20     ` Leo Liu
2013-01-25  1:33       ` Glenn Morris
2013-01-25  1:44         ` Glenn Morris
2013-01-25 21:32           ` Richard Stallman
2013-01-25  8:44       ` Alan Mackenzie [this message]
2013-01-25 12:58         ` bug#12274: 24.2; awk-mode indentation failure Stefan Monnier
2013-01-25 17:33         ` Glenn Morris
2013-01-25 19:17         ` Alan Mackenzie
2013-01-25 17:50 ` bug#13541: 24.2.92; awk-mode: wrong font locking regexp literals Alan Mackenzie
2013-01-26 11:14   ` Leo Liu
2013-01-27 18:59     ` Alan Mackenzie
     [not found]     ` <20130127185906.GA16161__1271.15463042191$1359313643$gmane$org@acm.acm>
2013-01-28  1:12       ` Leo Liu
2013-01-28 11:14         ` Alan Mackenzie
     [not found]         ` <20130128111417.GA3330@acm.acm>
2013-01-28 12:11           ` Leo Liu
2013-01-29 20:58 ` Alan Mackenzie
  -- strict thread matches above, loose matches on Subject: below --
2012-08-25  5:59 bug#12274: 24.2; awk-mode indentation failure Leo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130125084444.GA3505@acm.acm \
    --to=acm@muc.de \
    --cc=12274@debbugs.gnu.org \
    --cc=sdl.web@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).