Fix bug#16118
* lisp/progmodes/ruby-mode.el (ruby-smie-rules): Return nil before open-paren tokens when preceded by a open-paren, too. (ruby-smie-rules): Handle virtual indentation after open-paren tokens specially. If there is code between it and eol, return the column where is starts. * test/indent/ruby.rb: New examples.
This commit is contained in:
parent
dc7909c40a
commit
276bc3337b
4 changed files with 61 additions and 7 deletions
|
@ -1,3 +1,11 @@
|
|||
2013-12-14 Dmitry Gutov <dgutov@yandex.ru>
|
||||
|
||||
* progmodes/ruby-mode.el (ruby-smie-rules): Return nil before
|
||||
open-paren tokens when preceded by a open-paren, too.
|
||||
(ruby-smie-rules): Handle virtual indentation after open-paren
|
||||
tokens specially. If there is code between it and eol, return the
|
||||
column where is starts (Bug#16118).
|
||||
|
||||
2013-12-13 Teodor Zlatanov <tzz@lifelogs.com>
|
||||
|
||||
* progmodes/cfengine.el: Fix `add-hook' doc.
|
||||
|
|
|
@ -549,10 +549,21 @@ It is used when `ruby-encoding-magic-comment-style' is set to `custom'."
|
|||
(ruby-smie--indent-to-stmt))
|
||||
((smie-rule-hanging-p)
|
||||
;; Treat purely syntactic block-constructs as being part of their parent,
|
||||
;; when the opening statement is hanging.
|
||||
;; when the opening token is hanging and the parent is not an open-paren.
|
||||
(let ((state (smie-backward-sexp 'halfsexp)))
|
||||
(when (eq t (car state)) (goto-char (cadr state))))
|
||||
(cons 'column (smie-indent-virtual)))))
|
||||
(unless (and (eq t (car state))
|
||||
(not (eq (cadr state) (point-min))))
|
||||
(cons 'column (smie-indent-virtual)))))))
|
||||
(`(:after . ,(or `"(" "[" "{"))
|
||||
;; FIXME: Shouldn't this be the default behavior of
|
||||
;; `smie-indent-after-keyword'?
|
||||
(save-excursion
|
||||
(forward-char 1)
|
||||
(skip-chars-forward " \t")
|
||||
;; `smie-rule-hanging-p' is not good enough here,
|
||||
;; because we want to accept hanging tokens at bol, too.
|
||||
(unless (or (eolp) (forward-comment 1))
|
||||
(cons 'column (current-column)))))
|
||||
(`(:after . " @ ") (smie-rule-parent))
|
||||
(`(:before . "do") (ruby-smie--indent-to-stmt))
|
||||
(`(,(or :before :after) . ".")
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
2013-12-14 Dmitry Gutov <dgutov@yandex.ru>
|
||||
|
||||
* indent/ruby.rb: New examples.
|
||||
|
||||
2013-12-12 Fabián Ezequiel Gallina <fgallina@gnu.org>
|
||||
|
||||
* automated/python-tests.el (python-indent-dedenters-2): New test.
|
||||
|
|
|
@ -45,10 +45,41 @@
|
|||
a1: b1
|
||||
}
|
||||
|
||||
foo({
|
||||
a: b,
|
||||
c: d
|
||||
})
|
||||
foo({ # bug#16118
|
||||
a: b,
|
||||
c: d
|
||||
}
|
||||
) # bug#16116
|
||||
|
||||
bar = foo(
|
||||
a, [
|
||||
1,
|
||||
],
|
||||
:qux => [
|
||||
3
|
||||
]
|
||||
)
|
||||
|
||||
foo(
|
||||
[
|
||||
{
|
||||
a: b
|
||||
},
|
||||
],
|
||||
{
|
||||
c: d
|
||||
}
|
||||
)
|
||||
|
||||
foo([{
|
||||
a: 2
|
||||
},
|
||||
{
|
||||
b: 3
|
||||
},
|
||||
4
|
||||
]
|
||||
)
|
||||
|
||||
foo = [ # ruby-deep-indent-disabled
|
||||
1
|
||||
|
|
Loading…
Add table
Reference in a new issue