Subject: bug#12188: 24.1; awk-mode eletric { incorrectly inserts newline

From: Glenn Morris <[email-masked]>
Date: Wed, 15 Aug 2012 13:41:44 -0400

Alan Mackenzie wrote:

> The current assumption is that the "{" starts the action for the pattern
> "NR==3".

I think that's his point (it sure would be helpful to get less terse bug
reports). awk-mode is not consistent with that assumption.

cat foo.awk:

#!/usr/bin/gawk -f

NF == 3 
{
    print "three fields" 
}

chmod 755 foo.awk

echo "1 2" | ./foo.awk
  -> three fields

To work correctly, it needs to be either:

NF == 3 \
{
    print "three fields"
}

or

NF == 3 {
  print "three fields"
}