unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Reiner Steib <reiner.steib@gmx.de>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 17818@debbugs.gnu.org
Subject: bug#17818: 24.3.91; sh-learn-buffer-indent doesn't learn current indent anymore
Date: Mon, 23 Jun 2014 18:04:50 +0200	[thread overview]
Message-ID: <20140623180450.pgyd1ksywokgcs8s@imap.uni-ulm.de> (raw)
In-Reply-To: <jwvegyjmgqe.fsf-monnier+emacsbugs@gnu.org>

On Fri, 20 Jun 2014, Stefan Monnier <monnier@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







  reply	other threads:[~2014-06-23 16:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-20 14:54 bug#17818: 24.3.91; sh-learn-buffer-indent doesn't learn current indent anymore Reiner Steib
2014-06-20 15:48 ` Stefan Monnier
2014-06-20 21:10 ` Stefan Monnier
2014-06-23 16:04   ` Reiner Steib [this message]
2014-06-24 13:49     ` Stefan Monnier

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=20140623180450.pgyd1ksywokgcs8s@imap.uni-ulm.de \
    --to=reiner.steib@gmx.de \
    --cc=17818@debbugs.gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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).