diff options
author | Glenn Morris <rgm@gnu.org> | 2014-06-21 12:45:59 -0700 |
---|---|---|
committer | Glenn Morris <rgm@gnu.org> | 2014-06-21 12:45:59 -0700 |
commit | c400516ab1d827d08225ffb3e1bc1969c73cc45e (patch) | |
tree | b16343b9e11c916c96b12ab56b6024cad91d3aff /lisp/progmodes/sh-script.el | |
parent | 539ad293eb36b4cf458cbdb5a6b37f5cd1bb68a1 (diff) | |
parent | 8047f439ec7d0bbe0085800a13bee8da883ae4dd (diff) | |
download | emacs-c400516ab1d827d08225ffb3e1bc1969c73cc45e.tar.gz |
Merge from emacs-24; up to 2014-06-06T02:22:40Z!monnier@iro.umontreal.ca
Diffstat (limited to 'lisp/progmodes/sh-script.el')
-rw-r--r-- | lisp/progmodes/sh-script.el | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el index b4148ef5621..c3032b4f195 100644 --- a/lisp/progmodes/sh-script.el +++ b/lisp/progmodes/sh-script.el @@ -1975,7 +1975,11 @@ May return nil if the line should not be treated as continued." (<= indent initial)) `(column . ,(+ initial sh-indentation))))) (`(:before . ,(or `"(" `"{" `"[")) - (if (smie-rule-hanging-p) (smie-rule-parent))) + (when (smie-rule-hanging-p) + (if (not (smie-rule-prev-p "&&" "||" "|")) + (smie-rule-parent) + (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. (`(:before . ,(or `";;" `";&" `";;&")) @@ -1993,7 +1997,7 @@ May return nil if the line should not be treated as continued." (smie-rule-bolp)))) (current-column) (smie-indent-calculate))))) - (`(:after . "|") (if (smie-rule-parent-p "|") nil 4)) + (`(:after . ,(or `"|" `"&&" `"||")) (if (smie-rule-parent-p token) nil 4)) ;; Attempt at backward compatibility with the old config variables. (`(:before . "fi") (sh-var-value 'sh-indent-for-fi)) (`(:before . "done") (sh-var-value 'sh-indent-for-done)) @@ -2300,6 +2304,11 @@ Calls the value of `sh-set-shell-hook' if set." (let ((mksym (lambda (name) (intern (format "sh-smie-%s-%s" sh-indent-supported-here name))))) + (add-function :around (local 'smie--hanging-eolp-function) + (lambda (orig) + (if (looking-at "[ \t]*\\\\\n") + (goto-char (match-end 0)) + (funcall orig)))) (smie-setup (symbol-value (funcall mksym "grammar")) (funcall mksym "rules") :forward-token (funcall mksym "forward-token") |