summaryrefslogtreecommitdiff
path: root/lisp/progmodes
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2014-12-04 10:09:08 -0500
committerStefan Monnier <monnier@iro.umontreal.ca>2014-12-04 10:09:08 -0500
commite3c24b171bfff16fb808cb02d3fc5eaff017c1bc (patch)
tree36899d349d406a88d8f3d53a999dbe93ed1891c2 /lisp/progmodes
parentd9d383147219f8e6a90d4c177e1b454e19acfac9 (diff)
downloademacs-e3c24b171bfff16fb808cb02d3fc5eaff017c1bc.tar.gz
* lisp/progmodes/sh-script.el: Fix indentation rule of "| while".
Fixes: debbugs:18031 * lisp/progmodes/sh-script.el (sh-smie-sh-rules): Go back to the beginning of the whole pipe when indenting an opening keyword after a |. Generalize this treatment to opening keywords like "while".
Diffstat (limited to 'lisp/progmodes')
-rw-r--r--lisp/progmodes/sh-script.el4
1 files changed, 2 insertions, 2 deletions
diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el
index 724d22ab69b..1165144d05c 100644
--- a/lisp/progmodes/sh-script.el
+++ b/lisp/progmodes/sh-script.el
@@ -1988,12 +1988,12 @@ May return nil if the line should not be treated as continued."
(and (numberp indent) (numberp initial)
(<= indent initial)))))
`(column . ,(+ initial sh-indentation)))
- (`(:before . ,(or `"(" `"{" `"["))
+ (`(:before . ,(or `"(" `"{" `"[" "while" "if" "for" "case"))
(if (not (smie-rule-prev-p "&&" "||" "|"))
(when (smie-rule-hanging-p)
(smie-rule-parent))
(unless (smie-rule-bolp)
- (smie-backward-sexp 'halfexp)
+ (while (equal "|" (nth 2 (smie-backward-sexp 'halfexp))))
`(column . ,(smie-indent-virtual)))))
;; FIXME: Maybe this handling of ;; should be made into
;; a smie-rule-terminator function that takes the substitute ";" as arg.