emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs-25 bd3f53d 1/2: * sh-script.el (sh-smie-sh-rules): I


From: Stefan Monnier
Subject: [Emacs-diffs] emacs-25 bd3f53d 1/2: * sh-script.el (sh-smie-sh-rules): Improve indentation inside $(...)
Date: Sun, 10 Jan 2016 05:32:18 +0000

branch: emacs-25
commit bd3f53dd2e14b886ec46667a10611c549d4f09be
Author: Stefan Monnier <address@hidden>
Commit: Stefan Monnier <address@hidden>

    * 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.
---
 lisp/progmodes/sh-script.el |    6 +++++-
 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 02d329d..7f89ab2 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."
     ;; 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.
     ))
 
diff --git a/test/indent/shell.sh b/test/indent/shell.sh
index b0f69bd..dc184ea 100755
--- a/test/indent/shell.sh
+++ b/test/indent/shell.sh
@@ -3,6 +3,9 @@
 
 setlock -n /tmp/getmail.lock && echo getmail isn\'t running
 
+toto=$(grep hello foo |
+           wc)
+
 # adsgsdg
 
 if foo; then



reply via email to

[Prev in Thread] Current Thread [Next in Thread]