GNU bug report logs - #17818
24.3.91; sh-learn-buffer-indent doesn't learn current indent anymore

Previous Next

Package: emacs;

Reported by: Reiner Steib <Reiner.Steib <at> gmx.de>

Date: Fri, 20 Jun 2014 14:57:01 UTC

Severity: important

Found in version 24.3.91

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

Full log


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

From: Reiner Steib <reiner.steib <at> gmx.de>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 17818 <at> debbugs.gnu.org
Subject: Re: bug#17818: 24.3.91; sh-learn-buffer-indent doesn't learn
 current indent anymore
Date: Mon, 23 Jun 2014 18:04:50 +0200
On Fri, 20 Jun 2014, Stefan Monnier <monnier <at> iro.umontreal.ca> wrote:

>> if true; do
>>   echo "My sh-basic-offset offset should be 2."
>> fi
>
> The above "do" should be "then", right?

Sure, sorry. (I corrected it in my test-script, but not in the mail).

> I installed the patch below which fixes some of the problem (the first
> hunk fixes an incorrect guess and the second fixes the code so the guess
> is actually activated).
>
> Please confirm that the result is OK for your use case.

Works much better, thanks.

However, I tested[1] the new code with the following script and found
some incorrect indents (see diff below, hope the whitespace doesn't
get changed).

Bye, Reiner.

[1] M-x sh-learn-buffer-indent RET, M-x mark-whole-buffer RET, M-x
    indent-region RET, M-x diff-buffer-with-file RET

#!/bin/bash

if true; then
  echo "My sh-basic-offset offset should be 2."
fi

for a in 1 2; do
  echo "My sh-basic-offset offset should be 2."
done

filter_1 ()
{
  tr -d '"' |
    awk -F\; '{ if ($7 == 0 || $7 == 1) { print $7 } ; \
      print $5 "," $1 }' |
    grep -v "^,"
}

filter_3 ()
{
  tr -d '"`' | tr '	' ' ' | \
    awk -F\; -f filter.awk | \
    grep -v "^," | sort -t, -k2,2
}

tail -q -n+2 assets-ws.csv | awk -F \; -f merge.awk \
  <( cat file1.csv file2.csv ) - | \
  filter_2 | $conv | \
  sed -f a.sed | sort -t\; -k3,3 -k1,1 > w.csv

# end



--- shell-script-test.sh
+++ #<buffer shell-script-test.sh>
@@ -12,21 +12,21 @@
 filter_1 ()
 {
   tr -d '"' |
-    awk -F\; '{ if ($7 == 0 || $7 == 1) { print $7 } ; \
+awk -F\; '{ if ($7 == 0 || $7 == 1) { print $7 } ; \
       print $5 "," $1 }' |
-    grep -v "^,"
+grep -v "^,"
 }

 filter_3 ()
 {
   tr -d '"`' | tr '	' ' ' | \
-    awk -F\; -f filter.awk | \
-    grep -v "^," | sort -t, -k2,2
+  awk -F\; -f filter.awk | \
+grep -v "^," | sort -t, -k2,2
 }

 tail -q -n+2 assets-ws.csv | awk -F \; -f merge.awk \
-  <( cat file1.csv file2.csv ) - | \
-  filter_2 | $conv | \
-  sed -f a.sed | sort -t\; -k3,3 -k1,1 > w.csv
+					  <( cat file1.csv file2.csv ) - | \
+					  filter_2 | $conv | \
+					  sed -f a.sed | sort -t\; -k3,3 -k1,1 > w.csv

 # end

Diff finished.  Mon Jun 23 17:56:00 2014






This bug report was last modified 10 years and 339 days ago.

Previous Next


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