From e9638b49e53127fe410fbc3689c1d781c61e09b7 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Thu, 19 Jun 2014 18:52:12 -0400 Subject: [PATCH] * lisp/progmodes/sh-script.el (sh-smie-sh-rules): Use same rule for && as for |. Fixes: debbugs:17621 --- lisp/ChangeLog | 5 +++++ lisp/progmodes/sh-script.el | 2 +- test/indent/shell.sh | 6 ++++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index d7ca5f0dd88..90798ab722e 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2014-06-19 Stefan Monnier + + * progmodes/sh-script.el (sh-smie-sh-rules): Use same rule for && as + for | (bug#17621). + 2014-06-18 Stefan Monnier * xt-mouse.el (xterm-mouse-translate-1): Fix last change (bug#17776). diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el index 03c845851e2..c407ba24e20 100644 --- a/lisp/progmodes/sh-script.el +++ b/lisp/progmodes/sh-script.el @@ -1970,7 +1970,7 @@ May return nil if the line should not be treated as continued." (smie-rule-bolp)))) (current-column) (smie-indent-calculate))))) - (`(:after . "|") (if (smie-rule-parent-p "|") nil 4)) + (`(:after . ,(or `"|" `"&&" `"||")) (if (smie-rule-parent-p token) nil 4)) ;; Attempt at backward compatibility with the old config variables. (`(:before . "fi") (sh-var-value 'sh-indent-for-fi)) (`(:before . "done") (sh-var-value 'sh-indent-for-done)) diff --git a/test/indent/shell.sh b/test/indent/shell.sh index fdf736e06be..74985a401d4 100755 --- a/test/indent/shell.sh +++ b/test/indent/shell.sh @@ -23,6 +23,12 @@ case $X in ;; esac +{ # bug#17621 + foo1 && + foo2 && + bar +} + echo -n $(( 5 << 2 )) # This should not be treated as a heredoc (bug#12770). 2 -- 2.11.4.GIT