From: Dmitry Gutov Date: Mon, 14 Oct 2013 01:51:20 +0000 (+0300) Subject: * lisp/progmodes/ruby-mode.el (ruby-smie--args-separator-p): Handle X-Git-Tag: emacs-24.3.90~173^2^2~42^2~45^2~387^2~1276 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=1eda1d8d34c864df5b89464e51f0cbb8e46c5afd;p=emacs.git * lisp/progmodes/ruby-mode.el (ruby-smie--args-separator-p): Handle methods ending with `?' and `!'. * test/indent/ruby.rb: More examples for bug#15594, both failing and now passing. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 9410366f0c2..120fbb197eb 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2013-10-14 Dmitry Gutov + + * progmodes/ruby-mode.el (ruby-smie--args-separator-p): Handle + methods ending with `?' and `!'. + 2013-10-14 Akinori MUSHA * progmodes/ruby-mode.el (ruby-encoding-map): Add a mapping from diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el index 3441c35de35..a29540ad3a3 100644 --- a/lisp/progmodes/ruby-mode.el +++ b/lisp/progmodes/ruby-mode.el @@ -327,7 +327,9 @@ explicitly declared in magic comment." (defun ruby-smie--args-separator-p (pos) (and - (eq ?w (char-syntax (char-before))) + (or (eq (char-syntax (preceding-char)) '?w) + (and (memq (preceding-char) '(?! ??)) + (eq (char-syntax (char-before (1- (point)))) '?w))) (< pos (point-max)) (memq (char-syntax (char-after pos)) '(?w ?\")))) diff --git a/test/ChangeLog b/test/ChangeLog index 7e8405e3676..2f99c003c59 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,8 @@ +2013-10-14 Dmitry Gutov + + * indent/ruby.rb: More examples for bug#15594, both failing and + now passing. + 2013-10-11 Dmitry Gutov * indent/ruby.rb: Add two more cases. diff --git a/test/indent/ruby.rb b/test/indent/ruby.rb index 67584c01c7a..912648378c3 100644 --- a/test/indent/ruby.rb +++ b/test/indent/ruby.rb @@ -155,6 +155,16 @@ if foo? bar end +method arg1, # bug#15594 + method2 arg2, + arg3 + +method? arg1, + arg2 + +method! arg1, + arg2 + # Examples below still fail with `ruby-use-smie' on: foo + @@ -171,6 +181,17 @@ if foo && bar end -method1 arg1, # bug#15594 - method2 arg2, - arg3 +method !arg1, + arg2 + +method [], + arg2 + +method {:a => 1, :b => 2}, + arg2 + +method :foo, + :bar + +method (a + b), + c