]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/progmodes/ruby-mode.el (ruby-calculate-indent): Consider
authorDmitry Gutov <dgutov@yandex.ru>
Tue, 3 Sep 2013 00:29:10 +0000 (03:29 +0300)
committerDmitry Gutov <dgutov@yandex.ru>
Tue, 3 Sep 2013 00:29:10 +0000 (03:29 +0300)
two-character operators and whether the character preceding them
changes their meaning.

Fixes: debbugs:15208
lisp/ChangeLog
lisp/progmodes/ruby-mode.el
test/indent/ruby.rb

index ad23012e749019cca99e85a419123d7550abafcb..49c6caeceb773901eb7e3b74ac602111707ec0e1 100644 (file)
@@ -1,3 +1,9 @@
+2013-09-03  Dmitry Gutov  <dgutov@yandex.ru>
+
+       * progmodes/ruby-mode.el (ruby-calculate-indent): Consider
+       two-character operators and whether the character preceding them
+       changes their meaning (Bug#15208).
+
 2013-09-02  Fabián Ezequiel Gallina  <fgallina@gnu.org>
 
        Format code sent to Python shell for robustness.
index 7ecd207f4dcefddfd7c56ca3697debcdce59f57d..acc7738ae5c817b7924fab3adca0a8b349bd596f 100644 (file)
@@ -137,6 +137,7 @@ This should only be called after matching against `ruby-here-doc-beg-re'."
 
 (defconst ruby-symbol-chars "a-zA-Z0-9_"
   "List of characters that symbol names may contain.")
+
 (defconst ruby-symbol-re (concat "[" ruby-symbol-chars "]")
   "Regexp to match symbols.")
 
@@ -935,6 +936,10 @@ Can be one of `heredoc', `modifier', `expr-qstr', `expr-re'."
                       (not (looking-at "[a-z_]"))))
                (and (looking-at ruby-operator-re)
                     (not (ruby-special-char-p))
+                    (save-excursion
+                      (forward-char -1)
+                      (or (not (looking-at ruby-operator-re))
+                          (not (eq (char-before) ?:))))
                     ;; Operator at the end of line.
                     (let ((c (char-after (point))))
                       (and
index 853f4dbf992456eb28872670d5b1cfbb0ce60258..af1bbb9d8ab26e4a6a9d8c2cc696eff99b42cab7 100644 (file)
@@ -66,3 +66,8 @@ end
 Given /toto/ do
   print "hello"
 end
+
+# Bug#15208
+if something == :==
+  do_something
+end