summaryrefslogtreecommitdiff
path: root/lisp/progmodes/ruby-mode.el
diff options
context:
space:
mode:
authorDmitry Gutov <dgutov@yandex.ru>2014-02-01 16:54:58 +0200
committerDmitry Gutov <dgutov@yandex.ru>2014-02-01 16:54:58 +0200
commita09beb3df21677b0797e27cb75bd5c66226f6bc9 (patch)
tree305bfdfe3f0ff259d3215d1f3e40db20f6919a08 /lisp/progmodes/ruby-mode.el
parent9ef58a52ac97a160e2818e69e7cd146e52fbdacf (diff)
downloademacs-a09beb3df21677b0797e27cb75bd5c66226f6bc9.tar.gz
Fix bug#16609
* lisp/progmodes/ruby-mode.el (ruby-smie--implicit-semi-p): Check for `:' before binary operators. Don't check for `:' before `[' and `(', or their syntax status. A percent literal can't end with either.
Diffstat (limited to 'lisp/progmodes/ruby-mode.el')
-rw-r--r--lisp/progmodes/ruby-mode.el7
1 files changed, 5 insertions, 2 deletions
diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el
index 1bce911cf0e..5cee77b29a5 100644
--- a/lisp/progmodes/ruby-mode.el
+++ b/lisp/progmodes/ruby-mode.el
@@ -422,14 +422,17 @@ It is used when `ruby-encoding-magic-comment-style' is set to `custom'."
(save-excursion
(skip-chars-backward " \t")
(not (or (bolp)
+ (memq (char-before) '(?\[ ?\())
(and (memq (char-before)
- '(?\; ?- ?+ ?* ?/ ?: ?. ?, ?\[ ?\( ?\\ ?& ?> ?< ?%
- ?~ ?^))
+ '(?\; ?- ?+ ?* ?/ ?: ?. ?, ?\\ ?& ?> ?< ?% ?~ ?^))
+ ;; Not a binary operator symbol.
+ (not (eq (char-before (1- (point))) ?:))
;; Not the end of a regexp or a percent literal.
(not (memq (car (syntax-after (1- (point)))) '(7 15))))
(and (eq (char-before) ?\?)
(equal (save-excursion (ruby-smie--backward-token)) "?"))
(and (eq (char-before) ?=)
+ ;; Not a symbol :==, :!=, or a foo= method.
(string-match "\\`\\s." (save-excursion
(ruby-smie--backward-token))))
(and (eq (char-before) ?|)