[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] trunk r115514: Fix bug#16118
From: |
Dmitry Gutov |
Subject: |
[Emacs-diffs] trunk r115514: Fix bug#16118 |
Date: |
Sat, 14 Dec 2013 06:46:26 +0000 |
User-agent: |
Bazaar (2.6b2) |
------------------------------------------------------------
revno: 115514
revision-id: address@hidden
parent: address@hidden
fixes bug: http://debbugs.gnu.org/16118
committer: Dmitry Gutov <address@hidden>
branch nick: trunk
timestamp: Sat 2013-12-14 08:46:13 +0200
message:
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.
modified:
lisp/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-1432
lisp/progmodes/ruby-mode.el
rubymode.el-20091113204419-o5vbwnq5f7feedwu-8804
test/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-8588
test/indent/ruby.rb ruby.rb-20120424165921-h044139hbrd7snvw-1
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2013-12-13 19:49:56 +0000
+++ b/lisp/ChangeLog 2013-12-14 06:46:13 +0000
@@ -1,3 +1,11 @@
+2013-12-14 Dmitry Gutov <address@hidden>
+
+ * 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 <address@hidden>
* progmodes/cfengine.el: Fix `add-hook' doc.
=== modified file 'lisp/progmodes/ruby-mode.el'
--- a/lisp/progmodes/ruby-mode.el 2013-12-09 04:19:16 +0000
+++ b/lisp/progmodes/ruby-mode.el 2013-12-14 06:46:13 +0000
@@ -549,10 +549,21 @@
(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) . ".")
=== modified file 'test/ChangeLog'
--- a/test/ChangeLog 2013-12-12 23:32:05 +0000
+++ b/test/ChangeLog 2013-12-14 06:46:13 +0000
@@ -1,3 +1,7 @@
+2013-12-14 Dmitry Gutov <address@hidden>
+
+ * indent/ruby.rb: New examples.
+
2013-12-12 Fabián Ezequiel Gallina <address@hidden>
* automated/python-tests.el (python-indent-dedenters-2): New test.
=== modified file 'test/indent/ruby.rb'
--- a/test/indent/ruby.rb 2013-12-09 04:19:16 +0000
+++ b/test/indent/ruby.rb 2013-12-14 06:46:13 +0000
@@ -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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] trunk r115514: Fix bug#16118,
Dmitry Gutov <=