diff options
| author | Dmitry Gutov | 2013-10-24 04:47:28 +0400 |
|---|---|---|
| committer | Dmitry Gutov | 2013-10-24 04:47:28 +0400 |
| commit | 369bbf7198fa5dfdac366f9e5f79b84d9c72f3ee (patch) | |
| tree | 221c2c04712e50f4bc7bba5b15798b4864375c03 /lisp/progmodes/ruby-mode.el | |
| parent | 9843415589b51e6360e5428636b0f2fcc88e9c5b (diff) | |
| download | emacs-369bbf7198fa5dfdac366f9e5f79b84d9c72f3ee.tar.gz emacs-369bbf7198fa5dfdac366f9e5f79b84d9c72f3ee.zip | |
* lisp/progmodes/ruby-mode.el (ruby-smie-rules): Fix the "curly block
with parameters" example. Simplify the "is it block or is it
hash" check, but also make it more thorough.
* test/indent/ruby.rb: Fix syntax error in the latest example.
Diffstat (limited to 'lisp/progmodes/ruby-mode.el')
| -rw-r--r-- | lisp/progmodes/ruby-mode.el | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el index 88820a4a942..5f553b94ba7 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,9 +457,7 @@ 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 "(" "{" "[" "," "=>" "=" "return" ";"))) |
| 461 | (or (smie-rule-hanging-p) | ||
| 462 | (smie-rule-next-p "opening-|"))) | ||
| 463 | ;; Curly block opener. | 461 | ;; Curly block opener. |
| 464 | (smie-rule-parent)) | 462 | (smie-rule-parent)) |
| 465 | ((smie-rule-hanging-p) | 463 | ((smie-rule-hanging-p) |