diff options
| author | Stefan Monnier | 2014-06-20 10:23:30 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2014-06-20 10:23:30 -0400 |
| commit | 9e248ebdc71b051911ba1a68187d300bfff39fb3 (patch) | |
| tree | 32356e67fc5269dfce022f36db137f353611b819 | |
| parent | 58b9840b352eeb11ee1d09f0f3224c4b9ce22fad (diff) | |
| download | emacs-9e248ebdc71b051911ba1a68187d300bfff39fb3.tar.gz emacs-9e248ebdc71b051911ba1a68187d300bfff39fb3.zip | |
* lisp/progmodes/sh-script.el (sh-smie-sh-rules): For { after &&, don't
align with the surrounding parent.
Fixes: debbugs:17721
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/progmodes/sh-script.el | 6 | ||||
| -rwxr-xr-x | test/indent/shell.sh | 8 |
3 files changed, 18 insertions, 1 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index b7cd062d15c..81a8945be11 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2014-06-20 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * progmodes/sh-script.el (sh-smie-sh-rules): For { after &&, don't | ||
| 4 | align with the surrounding parent (bug#17721). | ||
| 5 | |||
| 1 | 2014-06-20 Eli Zaretskii <eliz@gnu.org> | 6 | 2014-06-20 Eli Zaretskii <eliz@gnu.org> |
| 2 | 7 | ||
| 3 | * textmodes/texinfo.el (texinfo-mode): Set skeleton-end-newline | 8 | * textmodes/texinfo.el (texinfo-mode): Set skeleton-end-newline |
diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el index f248494eed1..4db462594dc 100644 --- a/lisp/progmodes/sh-script.el +++ b/lisp/progmodes/sh-script.el | |||
| @@ -1952,7 +1952,11 @@ May return nil if the line should not be treated as continued." | |||
| 1952 | (<= indent initial)) | 1952 | (<= indent initial)) |
| 1953 | `(column . ,(+ initial sh-indentation))))) | 1953 | `(column . ,(+ initial sh-indentation))))) |
| 1954 | (`(:before . ,(or `"(" `"{" `"[")) | 1954 | (`(:before . ,(or `"(" `"{" `"[")) |
| 1955 | (if (smie-rule-hanging-p) (smie-rule-parent))) | 1955 | (when (smie-rule-hanging-p) |
| 1956 | (if (not (smie-rule-prev-p "&&" "||" "|")) | ||
| 1957 | (smie-rule-parent) | ||
| 1958 | (smie-backward-sexp 'halfexp) | ||
| 1959 | `(column . ,(smie-indent-virtual))))) | ||
| 1956 | ;; FIXME: Maybe this handling of ;; should be made into | 1960 | ;; FIXME: Maybe this handling of ;; should be made into |
| 1957 | ;; a smie-rule-terminator function that takes the substitute ";" as arg. | 1961 | ;; a smie-rule-terminator function that takes the substitute ";" as arg. |
| 1958 | (`(:before . ,(or `";;" `";&" `";;&")) | 1962 | (`(:before . ,(or `";;" `";&" `";;&")) |
diff --git a/test/indent/shell.sh b/test/indent/shell.sh index ed6bcf8da3a..8e831bb8f11 100755 --- a/test/indent/shell.sh +++ b/test/indent/shell.sh | |||
| @@ -33,6 +33,14 @@ esac | |||
| 33 | bar | 33 | bar |
| 34 | } | 34 | } |
| 35 | 35 | ||
| 36 | for foo in bar; do # bug#17721 | ||
| 37 | [ -e $foo ] && { | ||
| 38 | echo t | ||
| 39 | } && { | ||
| 40 | echo r | ||
| 41 | } | ||
| 42 | done | ||
| 43 | |||
| 36 | echo -n $(( 5 << 2 )) | 44 | echo -n $(( 5 << 2 )) |
| 37 | # This should not be treated as a heredoc (bug#12770). | 45 | # This should not be treated as a heredoc (bug#12770). |
| 38 | 2 | 46 | 2 |