aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2013-10-23 13:55:53 -0400
committerStefan Monnier2013-10-23 13:55:53 -0400
commit03d44565bbbea492e5280e153150a768ca7f2c45 (patch)
treeeae21c21a24fa288cbc0cfa1c5d3dafb31ca6c3c
parent76f1a3c3143b61dd58c02a3bd2eb533802646679 (diff)
downloademacs-03d44565bbbea492e5280e153150a768ca7f2c45.tar.gz
emacs-03d44565bbbea492e5280e153150a768ca7f2c45.zip
* lisp/progmodes/ruby-mode.el (ruby-smie-rules): Only align with parent of
{ if it is hanging.
-rw-r--r--lisp/ChangeLog3
-rw-r--r--lisp/progmodes/ruby-mode.el6
-rw-r--r--test/indent/ruby.rb4
3 files changed, 11 insertions, 2 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 63156bb18a1..6210bbeabae 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,8 @@
12013-10-23 Stefan Monnier <monnier@iro.umontreal.ca> 12013-10-23 Stefan Monnier <monnier@iro.umontreal.ca>
2 2
3 * progmodes/ruby-mode.el (ruby-smie-rules): Only align with parent of
4 { if it is hanging.
5
3 * progmodes/ruby-mode.el (ruby-smie-rules): Don't return 0 for 6 * progmodes/ruby-mode.el (ruby-smie-rules): Don't return 0 for
4 :before ";". 7 :before ";".
5 8
diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el
index 7b9dcd44b24..88820a4a942 100644
--- a/lisp/progmodes/ruby-mode.el
+++ b/lisp/progmodes/ruby-mode.el
@@ -449,7 +449,7 @@ explicitly declared in magic comment."
449 ((smie-rule-parent-p "def" "begin" "do" "class" "module" "for" 449 ((smie-rule-parent-p "def" "begin" "do" "class" "module" "for"
450 "while" "until" "unless" 450 "while" "until" "unless"
451 "if" "then" "elsif" "else" "when" 451 "if" "then" "elsif" "else" "when"
452 "rescue" "ensure" "{") 452 "rescue" "ensure")
453 (smie-rule-parent ruby-indent-level)) 453 (smie-rule-parent ruby-indent-level))
454 ;; For (invalid) code between switch and case. 454 ;; For (invalid) code between switch and case.
455 ;; (if (smie-parent-p "switch") 4) 455 ;; (if (smie-parent-p "switch") 4)
@@ -457,7 +457,9 @@ explicitly declared in magic comment."
457 (`(:before . ,(or `"(" `"[" `"{")) 457 (`(:before . ,(or `"(" `"[" `"{"))
458 (cond 458 (cond
459 ((and (equal token "{") 459 ((and (equal token "{")
460 (not (smie-rule-prev-p "(" "{" "[" "," "=>"))) 460 (not (smie-rule-prev-p "(" "{" "[" "," "=>"))
461 (or (smie-rule-hanging-p)
462 (smie-rule-next-p "opening-|")))
461 ;; Curly block opener. 463 ;; Curly block opener.
462 (smie-rule-parent)) 464 (smie-rule-parent))
463 ((smie-rule-hanging-p) 465 ((smie-rule-hanging-p)
diff --git a/test/indent/ruby.rb b/test/indent/ruby.rb
index 7ce60f5f58b..7601738dc76 100644
--- a/test/indent/ruby.rb
+++ b/test/indent/ruby.rb
@@ -40,6 +40,10 @@ foo = { # ruby-deep-indent-disabled
40 a: b 40 a: b
41} 41}
42 42
43foo = { a: b
44 a1: b1
45 }
46
43foo({ 47foo({
44 a: b, 48 a: b,
45 c: d 49 c: d