From: Stefan Monnier Date: Tue, 8 Jul 2014 18:38:07 +0000 (-0400) Subject: * lisp/progmodes/sh-script.el (sh-smie-sh-rules): Don't align with a && in X-Git-Tag: emacs-24.3.93~80 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=d8899d09b992d733dc1cc6ec93b11cb75ce84f5d;p=emacs.git * lisp/progmodes/sh-script.el (sh-smie-sh-rules): Don't align with a && in the middle of a line. Fixes: debbugs:17896 --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 13cb52acc1c..0333e366beb 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2014-07-08 Stefan Monnier + + * 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 * startup.el (command-line): Append displaying the warning about diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el index 1601b6c81ae..724d22ab69b 100644 --- a/lisp/progmodes/sh-script.el +++ b/lisp/progmodes/sh-script.el @@ -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 diff --git a/test/indent/shell.sh b/test/indent/shell.sh index 4a30739e2d9..e3619057d6e 100755 --- a/test/indent/shell.sh +++ b/test/indent/shell.sh @@ -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 ' ' ' ' | \