* lisp/progmodes/ruby-mode.el (ruby-smie-rules): Handle the
authorDmitry Gutov <dgutov@yandex.ru>
Sun, 23 Feb 2014 08:26:40 +0000 (10:26 +0200)
committerDmitry Gutov <dgutov@yandex.ru>
Sun, 23 Feb 2014 08:26:40 +0000 (10:26 +0200)
inconsistent second element of the list returned by
`smie-indent--parent'.
(ruby-font-lock-keywords): Disqualify any identifier before `=' as
method call.

lisp/ChangeLog
lisp/progmodes/ruby-mode.el
test/indent/ruby.rb

index bcb09e1..40f5d7d 100644 (file)
@@ -2,6 +2,10 @@
 
        * progmodes/ruby-mode.el (ruby-smie-rules): Don't indent specially
        after `=>' (bug#16811).
+       (ruby-smie-rules): Handle the inconsistent second element of the
+       list returned by `smie-indent--parent'.
+       (ruby-font-lock-keywords): Disqualify any identifier before `=' as
+       method call.
 
 2014-02-23  Juanma Barranquero  <lekktu@gmail.com>
 
index 709bc67..5cd054a 100644 (file)
@@ -630,9 +630,11 @@ It is used when `ruby-encoding-magic-comment-style' is set to `custom'."
            (save-excursion
              ;; Traverse up the parents until the parent is "." at
              ;; indentation, or any other token.
-             (while (and (progn
-                           (goto-char (1- (cadr (smie-indent--parent))))
-                           (not (ruby-smie--bosp)))
+             (while (and (let ((parent (smie-indent--parent)))
+                           (goto-char (cadr parent))
+                           (save-excursion
+                             (unless (integerp (car parent)) (forward-char -1))
+                             (not (ruby-smie--bosp))))
                          (progn
                            (setq smie--parent nil)
                            (smie-rule-parent-p "."))))
@@ -2061,7 +2063,7 @@ See `font-lock-syntax-table'.")
           "refine"
           "using")
         'symbols))
-     (1 (unless (looking-at " *\\(?:[]|,.)}]\\|$\\)")
+     (1 (unless (looking-at " *\\(?:[]|,.)}=]\\|$\\)")
           font-lock-builtin-face)))
     ;; Kernel methods that have no required arguments.
     (,(concat
index 5fd59bf..344f16b 100644 (file)
@@ -357,6 +357,13 @@ zoo
   .lose(
     q, p)
 
+a.records().map(&:b).zip(
+  foo)
+
+# FIXME: This is not consistent with the example below it, but this
+# ofset only happens if the colon is at eol, which wouldn't be often.
+# Tokenizing `bar:' as `:bar =>' would be better, but it's hard to
+# distinguish from a variable reference inside a ternary operator.
 foo(bar:
       tee)