]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/progmodes/sh-script.el (sh-smie-sh-rules): For { after &&, don't
authorStefan Monnier <monnier@iro.umontreal.ca>
Fri, 20 Jun 2014 14:23:30 +0000 (10:23 -0400)
committerStefan Monnier <monnier@iro.umontreal.ca>
Fri, 20 Jun 2014 14:23:30 +0000 (10:23 -0400)
align with the surrounding parent.

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

index b7cd062d15c350531c52dd18bac996bb36108612..81a8945be11603764c595dd2872fb058951b0c3f 100644 (file)
@@ -1,3 +1,8 @@
+2014-06-20  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * progmodes/sh-script.el (sh-smie-sh-rules): For { after &&, don't
+       align with the surrounding parent (bug#17721).
+
 2014-06-20  Eli Zaretskii  <eliz@gnu.org>
 
        * textmodes/texinfo.el (texinfo-mode): Set skeleton-end-newline
index f248494eed1befac1db2653b7c6f155d339f2481..4db462594dc9d5c5dd924c429baf7c81aca5642f 100644 (file)
@@ -1952,7 +1952,11 @@ May return nil if the line should not be treated as continued."
                   (<= indent initial))
          `(column . ,(+ initial sh-indentation)))))
     (`(:before . ,(or `"(" `"{" `"["))
-     (if (smie-rule-hanging-p) (smie-rule-parent)))
+     (when (smie-rule-hanging-p)
+       (if (not (smie-rule-prev-p "&&" "||" "|"))
+          (smie-rule-parent)
+        (smie-backward-sexp 'halfexp)
+        `(column . ,(smie-indent-virtual)))))
     ;; FIXME: Maybe this handling of ;; should be made into
     ;; a smie-rule-terminator function that takes the substitute ";" as arg.
     (`(:before . ,(or `";;" `";&" `";;&"))
index ed6bcf8da3a1a55daa4d965312023dc452ed455b..8e831bb8f110b9d17704320c0bb7713b5274789b 100755 (executable)
@@ -33,6 +33,14 @@ esac
         bar
 }
 
+for foo in bar; do              #  bug#17721
+    [ -e $foo ] && {
+        echo t
+    } && {
+       echo r
+    }
+done
+
 echo -n $(( 5 << 2 ))
 # This should not be treated as a heredoc (bug#12770).
 2