aboutsummaryrefslogtreecommitdiffstats
path: root/lib/tools/emacs/erlang.el
diff options
context:
space:
mode:
authorMagnus Henoch <[email protected]>2010-05-18 23:38:26 +0100
committerMagnus Henoch <[email protected]>2010-05-18 23:38:26 +0100
commit1f32cb47e3d6f8f93228f6d42a91fc483e03b57f (patch)
treeb4f48efd0577dfade345ff09ca640dc8d32dfff3 /lib/tools/emacs/erlang.el
parent5fe8d47a60c89f1235f9fc727e650ada491246a3 (diff)
downloadotp-1f32cb47e3d6f8f93228f6d42a91fc483e03b57f.tar.gz
otp-1f32cb47e3d6f8f93228f6d42a91fc483e03b57f.tar.bz2
otp-1f32cb47e3d6f8f93228f6d42a91fc483e03b57f.zip
Fix indentation of records with line breaks inside lists
Trying to indent this piece of code by hitting TAB on each line: foo() -> [#foo{ foo = foo}]. used to cause an error. Fix by ignoring errors when trying to skip backwards from a record. Also add this test case to test.erl.orig and test.erl.indented.
Diffstat (limited to 'lib/tools/emacs/erlang.el')
-rw-r--r--lib/tools/emacs/erlang.el14
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/tools/emacs/erlang.el b/lib/tools/emacs/erlang.el
index 0132587d28..d14b028ae6 100644
--- a/lib/tools/emacs/erlang.el
+++ b/lib/tools/emacs/erlang.el
@@ -2933,10 +2933,16 @@ This assumes that the preceding expression is either simple
(skip-chars-backward " \t")
;; Needed to match the colon in "'foo':'bar'".
(if (not (memq (preceding-char) '(?# ?:)))
- col
- (backward-char 1)
- (forward-sexp -1)
- (current-column)))))
+ col
+ ;; Special hack to handle: (note line break)
+ ;; [#myrecord{
+ ;; foo = foo}]
+ (or
+ (ignore-errors
+ (backward-char 1)
+ (forward-sexp -1)
+ (current-column))
+ col)))))
(defun erlang-indent-parenthesis (stack-position)
(let ((previous (erlang-indent-find-preceding-expr)))