]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/progmodes/sh-script.el (sh-smie-sh-rules): Don't align with a && in
authorStefan Monnier <monnier@iro.umontreal.ca>
Tue, 8 Jul 2014 18:38:07 +0000 (14:38 -0400)
committerStefan Monnier <monnier@iro.umontreal.ca>
Tue, 8 Jul 2014 18:38:07 +0000 (14:38 -0400)
the middle of a line.

Fixes: debbugs:17896
lisp/ChangeLog
lisp/progmodes/sh-script.el
test/indent/shell.sh

index 13cb52acc1c43aef29eaafa7002a4952dc14eb5e..0333e366bebfe276c43ede1a1f5dacee6d0c6c2b 100644 (file)
@@ -1,3 +1,8 @@
+2014-07-08  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * progmodes/sh-script.el (sh-smie-sh-rules): Don't align with a && in
+       the middle of a line (bug#17896).
+
 2014-07-08  Juri Linkov  <juri@jurta.org>
 
        * startup.el (command-line): Append displaying the warning about
index 1601b6c81aeb22b17033dcc1aace30891ef93211..724d22ab69b633201d44b22d25587a28ed38c98e 100644 (file)
@@ -1989,9 +1989,10 @@ May return nil if the line should not be treated as continued."
                         (<= indent initial)))))
      `(column . ,(+ initial sh-indentation)))
     (`(:before . ,(or `"(" `"{" `"["))
-     (when (smie-rule-hanging-p)
-       (if (not (smie-rule-prev-p "&&" "||" "|"))
-          (smie-rule-parent)
+     (if (not (smie-rule-prev-p "&&" "||" "|"))
+         (when (smie-rule-hanging-p)
+           (smie-rule-parent))
+       (unless (smie-rule-bolp)
         (smie-backward-sexp 'halfexp)
         `(column . ,(smie-indent-virtual)))))
     ;; FIXME: Maybe this handling of ;; should be made into
index 4a30739e2d90248462343b83bf2baa26e773088a..e3619057d6ef09143eb46582541695bc24b58984 100755 (executable)
@@ -41,6 +41,12 @@ for foo in bar; do              #  bug#17721
     }
 done
 
+for foo in bar; do              # bug#17896
+    [ -e $foo ] && [ -e $bar ] && {
+        echo just fine thanks
+    }
+done
+
 filter_3 ()                     # bug#17842
 {
     tr -d '"`' | tr '  ' ' ' | \