diff options
| author | Dmitry Gutov | 2016-03-14 00:34:01 +0200 |
|---|---|---|
| committer | Dmitry Gutov | 2016-03-14 01:45:01 +0200 |
| commit | 9d463aec8b3d848556bbe320c0cf8bd310528168 (patch) | |
| tree | a18418ddf6d45fdf2bab2c15b68610407577b04a | |
| parent | 5b705bc97d3928e6550d271c415c54e00e020011 (diff) | |
| download | emacs-9d463aec8b3d848556bbe320c0cf8bd310528168.tar.gz emacs-9d463aec8b3d848556bbe320c0cf8bd310528168.zip | |
Tweak the left precedence of '=>'
* lisp/progmodes/ruby-mode.el (ruby-smie-grammar): Tweak the left
precedence of '=>', to improve indentation and sexp navigation.
| -rw-r--r-- | lisp/progmodes/ruby-mode.el | 2 | ||||
| -rw-r--r-- | test/indent/ruby.rb | 6 |
2 files changed, 7 insertions, 1 deletions
diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el index 9884b7e1ac1..1c9f0f43086 100644 --- a/lisp/progmodes/ruby-mode.el +++ b/lisp/progmodes/ruby-mode.el | |||
| @@ -388,7 +388,7 @@ It is used when `ruby-encoding-magic-comment-style' is set to `custom'." | |||
| 388 | (cases (exp "then" insts) | 388 | (cases (exp "then" insts) |
| 389 | (cases "when" cases) (insts "else" insts)) | 389 | (cases "when" cases) (insts "else" insts)) |
| 390 | (expseq (exp) );;(expseq "," expseq) | 390 | (expseq (exp) );;(expseq "," expseq) |
| 391 | (hashvals (id "=>" exp1) (hashvals "," hashvals)) | 391 | (hashvals (exp1 "=>" exp1) (hashvals "," hashvals)) |
| 392 | (insts-rescue-insts (insts) | 392 | (insts-rescue-insts (insts) |
| 393 | (insts-rescue-insts "rescue" insts-rescue-insts) | 393 | (insts-rescue-insts "rescue" insts-rescue-insts) |
| 394 | (insts-rescue-insts "ensure" insts-rescue-insts)) | 394 | (insts-rescue-insts "ensure" insts-rescue-insts)) |
diff --git a/test/indent/ruby.rb b/test/indent/ruby.rb index 941fffb2209..6ab814a4214 100644 --- a/test/indent/ruby.rb +++ b/test/indent/ruby.rb | |||
| @@ -415,6 +415,12 @@ foo(bar: | |||
| 415 | foo(:bar => | 415 | foo(:bar => |
| 416 | tee) | 416 | tee) |
| 417 | 417 | ||
| 418 | regions = foo( | ||
| 419 | OpenStruct.new(id: 0, name: "foo") => [ | ||
| 420 | 10 | ||
| 421 | ] | ||
| 422 | ) | ||
| 423 | |||
| 418 | {'a' => { | 424 | {'a' => { |
| 419 | 'b' => 'c', | 425 | 'b' => 'c', |
| 420 | 'd' => %w(e f) | 426 | 'd' => %w(e f) |