diff options
| author | Stefan Monnier | 2016-01-10 00:31:29 -0500 |
|---|---|---|
| committer | Stefan Monnier | 2016-01-10 00:31:29 -0500 |
| commit | bd3f53dd2e14b886ec46667a10611c549d4f09be (patch) | |
| tree | df93fa378c49732bdb1b9176e675f7ca493aa3a9 | |
| parent | 09b2b8a5ce5b542856f93b645db51eb11cf9855a (diff) | |
| download | emacs-bd3f53dd2e14b886ec46667a10611c549d4f09be.tar.gz emacs-bd3f53dd2e14b886ec46667a10611c549d4f09be.zip | |
* 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.
| -rw-r--r-- | lisp/progmodes/sh-script.el | 6 | ||||
| -rwxr-xr-x | test/indent/shell.sh | 3 |
2 files changed, 8 insertions, 1 deletions
diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el index 02d329d794d..7f89ab2762c 100644 --- a/lisp/progmodes/sh-script.el +++ b/lisp/progmodes/sh-script.el | |||
| @@ -2115,7 +2115,11 @@ May return nil if the line should not be treated as continued." | |||
| 2115 | ;; sh-indent-after-done: aligned completely differently. | 2115 | ;; sh-indent-after-done: aligned completely differently. |
| 2116 | (`(:after . "in") (sh-var-value 'sh-indent-for-case-label)) | 2116 | (`(:after . "in") (sh-var-value 'sh-indent-for-case-label)) |
| 2117 | ;; sh-indent-for-continuation: Line continuations are handled differently. | 2117 | ;; sh-indent-for-continuation: Line continuations are handled differently. |
| 2118 | (`(:after . ,(or `"(" `"{" `"[")) (sh-var-value 'sh-indent-after-open)) | 2118 | (`(:after . ,(or `"(" `"{" `"[")) |
| 2119 | (if (not (looking-at ".[ \t]*[^\n \t#]")) | ||
| 2120 | (sh-var-value 'sh-indent-after-open) | ||
| 2121 | (goto-char (1- (match-end 0))) | ||
| 2122 | `(column . ,(current-column)))) | ||
| 2119 | ;; sh-indent-after-function: we don't handle it differently. | 2123 | ;; sh-indent-after-function: we don't handle it differently. |
| 2120 | )) | 2124 | )) |
| 2121 | 2125 | ||
diff --git a/test/indent/shell.sh b/test/indent/shell.sh index b0f69bd9720..dc184ea0d77 100755 --- a/test/indent/shell.sh +++ b/test/indent/shell.sh | |||
| @@ -3,6 +3,9 @@ | |||
| 3 | 3 | ||
| 4 | setlock -n /tmp/getmail.lock && echo getmail isn\'t running | 4 | setlock -n /tmp/getmail.lock && echo getmail isn\'t running |
| 5 | 5 | ||
| 6 | toto=$(grep hello foo | | ||
| 7 | wc) | ||
| 8 | |||
| 6 | # adsgsdg | 9 | # adsgsdg |
| 7 | 10 | ||
| 8 | if foo; then | 11 | if foo; then |