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.
This commit is contained in:
parent
9ef58a52ac
commit
a09beb3df2
3 changed files with 19 additions and 2 deletions
|
@ -1,3 +1,10 @@
|
|||
2014-02-01 Dmitry Gutov <dgutov@yandex.ru>
|
||||
|
||||
* progmodes/ruby-mode.el (ruby-smie--implicit-semi-p): Check for
|
||||
`:' before binary operators (bug#16609). Don't check for `:'
|
||||
before `[' and `(', or their syntax status. A percent literal
|
||||
can't end with either.
|
||||
|
||||
2014-02-01 Lars Ingebrigtsen <larsi@gnus.org>
|
||||
|
||||
* subr.el (butlast): Document what an omitted N means (bug#13437).
|
||||
|
|
|
@ -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) ?|)
|
||||
|
|
|
@ -135,6 +135,13 @@ def test2 (arg)
|
|||
# Bug#15208
|
||||
if something == :==
|
||||
do_something
|
||||
|
||||
return false unless method == :+
|
||||
x = y + z # Bug#16609
|
||||
|
||||
a = 1 ? 2 :(
|
||||
2 + 3
|
||||
)
|
||||
end
|
||||
|
||||
# Example from http://www.ruby-doc.org/docs/ProgrammingRuby/html/language.html
|
||||
|
|
Loading…
Add table
Reference in a new issue