diff options
| author | Dmitry Gutov | 2013-10-14 04:51:20 +0300 |
|---|---|---|
| committer | Dmitry Gutov | 2013-10-14 04:51:20 +0300 |
| commit | 1eda1d8d34c864df5b89464e51f0cbb8e46c5afd (patch) | |
| tree | e0680733d53ad1d1e5ccbd74e947c660ede5081e | |
| parent | e70181b829d01a7a674c099978688347427a5f33 (diff) | |
| download | emacs-1eda1d8d34c864df5b89464e51f0cbb8e46c5afd.tar.gz emacs-1eda1d8d34c864df5b89464e51f0cbb8e46c5afd.zip | |
* 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.
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/progmodes/ruby-mode.el | 4 | ||||
| -rw-r--r-- | test/ChangeLog | 5 | ||||
| -rw-r--r-- | test/indent/ruby.rb | 27 |
4 files changed, 37 insertions, 4 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 9410366f0c2..120fbb197eb 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2013-10-14 Dmitry Gutov <dgutov@yandex.ru> | ||
| 2 | |||
| 3 | * progmodes/ruby-mode.el (ruby-smie--args-separator-p): Handle | ||
| 4 | methods ending with `?' and `!'. | ||
| 5 | |||
| 1 | 2013-10-14 Akinori MUSHA <knu@iDaemons.org> | 6 | 2013-10-14 Akinori MUSHA <knu@iDaemons.org> |
| 2 | 7 | ||
| 3 | * progmodes/ruby-mode.el (ruby-encoding-map): Add a mapping from | 8 | * 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." | |||
| 327 | 327 | ||
| 328 | (defun ruby-smie--args-separator-p (pos) | 328 | (defun ruby-smie--args-separator-p (pos) |
| 329 | (and | 329 | (and |
| 330 | (eq ?w (char-syntax (char-before))) | 330 | (or (eq (char-syntax (preceding-char)) '?w) |
| 331 | (and (memq (preceding-char) '(?! ??)) | ||
| 332 | (eq (char-syntax (char-before (1- (point)))) '?w))) | ||
| 331 | (< pos (point-max)) | 333 | (< pos (point-max)) |
| 332 | (memq (char-syntax (char-after pos)) '(?w ?\")))) | 334 | (memq (char-syntax (char-after pos)) '(?w ?\")))) |
| 333 | 335 | ||
diff --git a/test/ChangeLog b/test/ChangeLog index 7e8405e3676..2f99c003c59 100644 --- a/test/ChangeLog +++ b/test/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2013-10-14 Dmitry Gutov <dgutov@yandex.ru> | ||
| 2 | |||
| 3 | * indent/ruby.rb: More examples for bug#15594, both failing and | ||
| 4 | now passing. | ||
| 5 | |||
| 1 | 2013-10-11 Dmitry Gutov <dgutov@yandex.ru> | 6 | 2013-10-11 Dmitry Gutov <dgutov@yandex.ru> |
| 2 | 7 | ||
| 3 | * indent/ruby.rb: Add two more cases. | 8 | * 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? | |||
| 155 | bar | 155 | bar |
| 156 | end | 156 | end |
| 157 | 157 | ||
| 158 | method arg1, # bug#15594 | ||
| 159 | method2 arg2, | ||
| 160 | arg3 | ||
| 161 | |||
| 162 | method? arg1, | ||
| 163 | arg2 | ||
| 164 | |||
| 165 | method! arg1, | ||
| 166 | arg2 | ||
| 167 | |||
| 158 | # Examples below still fail with `ruby-use-smie' on: | 168 | # Examples below still fail with `ruby-use-smie' on: |
| 159 | 169 | ||
| 160 | foo + | 170 | foo + |
| @@ -171,6 +181,17 @@ if foo && | |||
| 171 | bar | 181 | bar |
| 172 | end | 182 | end |
| 173 | 183 | ||
| 174 | method1 arg1, # bug#15594 | 184 | method !arg1, |
| 175 | method2 arg2, | 185 | arg2 |
| 176 | arg3 | 186 | |
| 187 | method [], | ||
| 188 | arg2 | ||
| 189 | |||
| 190 | method {:a => 1, :b => 2}, | ||
| 191 | arg2 | ||
| 192 | |||
| 193 | method :foo, | ||
| 194 | :bar | ||
| 195 | |||
| 196 | method (a + b), | ||
| 197 | c | ||