diff options
| author | Dmitry Gutov | 2013-11-09 01:59:56 +0200 |
|---|---|---|
| committer | Dmitry Gutov | 2013-11-09 01:59:56 +0200 |
| commit | 1629a329975b1c1e49249dd1462ce56a8840b0be (patch) | |
| tree | 6d1270eafa675267348ab78a652ca5f70f518311 | |
| parent | ad16897ceb05aefe3e6d63a6c9c5366ad0d75961 (diff) | |
| download | emacs-1629a329975b1c1e49249dd1462ce56a8840b0be.tar.gz emacs-1629a329975b1c1e49249dd1462ce56a8840b0be.zip | |
* lisp/progmodes/ruby-mode.el (ruby-smie--implicit-semi-p):
Not after "||".
(ruby-smie-rules): Indent non-hanging "begin" blocks as part of
their parent.
| -rw-r--r-- | lisp/ChangeLog | 7 | ||||
| -rw-r--r-- | lisp/progmodes/ruby-mode.el | 5 | ||||
| -rw-r--r-- | test/indent/ruby.rb | 9 |
3 files changed, 19 insertions, 2 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 3b30e4c7f44..794b13d752b 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,10 @@ | |||
| 1 | 2013-11-08 Dmitry Gutov <dgutov@yandex.ru> | ||
| 2 | |||
| 3 | * progmodes/ruby-mode.el (ruby-smie--implicit-semi-p): | ||
| 4 | Not after "||". | ||
| 5 | (ruby-smie-rules): Indent non-hanging "begin" blocks as part of | ||
| 6 | their parent. | ||
| 7 | |||
| 1 | 2013-11-08 Stefan Monnier <monnier@iro.umontreal.ca> | 8 | 2013-11-08 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 9 | ||
| 3 | * progmodes/ruby-mode.el: Don't require cl any more. Use pcase instead. | 10 | * progmodes/ruby-mode.el: Don't require cl any more. Use pcase instead. |
diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el index 69c850255d0..cb5fe11ada6 100644 --- a/lisp/progmodes/ruby-mode.el +++ b/lisp/progmodes/ruby-mode.el | |||
| @@ -364,6 +364,8 @@ explicitly declared in magic comment." | |||
| 364 | (and (eq (char-before) ?=) | 364 | (and (eq (char-before) ?=) |
| 365 | (string-match "\\`\\s." (save-excursion | 365 | (string-match "\\`\\s." (save-excursion |
| 366 | (ruby-smie--backward-token)))) | 366 | (ruby-smie--backward-token)))) |
| 367 | (and (eq (char-before) ?|) | ||
| 368 | (eq (char-before (1- (point))) ?|)) | ||
| 367 | (and (eq (car (syntax-after (1- (point)))) 2) | 369 | (and (eq (car (syntax-after (1- (point)))) 2) |
| 368 | (member (save-excursion (ruby-smie--backward-token)) | 370 | (member (save-excursion (ruby-smie--backward-token)) |
| 369 | '("iuwu-mod" "and" "or"))) | 371 | '("iuwu-mod" "and" "or"))) |
| @@ -546,6 +548,9 @@ explicitly declared in magic comment." | |||
| 546 | "+=" "-=" "*=" "/=" "%=" "**=" "&=" "|=" "^=" | 548 | "+=" "-=" "*=" "/=" "%=" "**=" "&=" "|=" "^=" |
| 547 | "<<=" ">>=" "&&=" "||=" "and" "or")) | 549 | "<<=" ">>=" "&&=" "||=" "and" "or")) |
| 548 | (if (smie-rule-parent-p ";" nil) ruby-indent-level)) | 550 | (if (smie-rule-parent-p ";" nil) ruby-indent-level)) |
| 551 | (`(:before . "begin") | ||
| 552 | (unless (save-excursion (skip-chars-backward " \t") (bolp)) | ||
| 553 | (smie-rule-parent))) | ||
| 549 | )) | 554 | )) |
| 550 | 555 | ||
| 551 | (defun ruby-imenu-create-index-in-block (prefix beg end) | 556 | (defun ruby-imenu-create-index-in-block (prefix beg end) |
diff --git a/test/indent/ruby.rb b/test/indent/ruby.rb index 0c432b7ca20..1d2eb08db94 100644 --- a/test/indent/ruby.rb +++ b/test/indent/ruby.rb | |||
| @@ -285,9 +285,14 @@ bar 1 do | |||
| 285 | end | 285 | end |
| 286 | end | 286 | end |
| 287 | 287 | ||
| 288 | # Failing with SMIE: | ||
| 289 | |||
| 290 | foo || | 288 | foo || |
| 291 | begin | 289 | begin |
| 292 | bar | 290 | bar |
| 293 | end | 291 | end |
| 292 | |||
| 293 | def qux | ||
| 294 | foo ||= begin | ||
| 295 | bar | ||
| 296 | tee | ||
| 297 | end | ||
| 298 | end | ||