* sh-script.el (sh-smie-sh-rules): Improve indentation inside $(...)

* lisp/progmodes/sh-script.el (sh-smie-sh-rules): Improve indentation
within $(...).
* test/indent/shell.sh: Add corresponding test.
This commit is contained in:
Stefan Monnier 2016-01-10 00:31:29 -05:00
parent 09b2b8a5ce
commit bd3f53dd2e
2 changed files with 8 additions and 1 deletions

View file

@ -2115,7 +2115,11 @@ May return nil if the line should not be treated as continued."
;; sh-indent-after-done: aligned completely differently.
(`(:after . "in") (sh-var-value 'sh-indent-for-case-label))
;; sh-indent-for-continuation: Line continuations are handled differently.
(`(:after . ,(or `"(" `"{" `"[")) (sh-var-value 'sh-indent-after-open))
(`(:after . ,(or `"(" `"{" `"["))
(if (not (looking-at ".[ \t]*[^\n \t#]"))
(sh-var-value 'sh-indent-after-open)
(goto-char (1- (match-end 0)))
`(column . ,(current-column))))
;; sh-indent-after-function: we don't handle it differently.
))

View file

@ -3,6 +3,9 @@
setlock -n /tmp/getmail.lock && echo getmail isn\'t running
toto=$(grep hello foo |
wc)
# adsgsdg
if foo; then