From 616c6c36aa2571f9f9951401909ba9e748eea578 Mon Sep 17 00:00:00 2001 From: Dmitry Gutov Date: Sat, 8 Sep 2012 19:13:14 +0400 Subject: [PATCH] * lisp/progmodes/ruby-mode.el (ruby-match-expression-expansion): Only fail when reached LIMIT. --- lisp/ChangeLog | 5 +++++ lisp/progmodes/ruby-mode.el | 4 +++- test/automated/ruby-mode-tests.el | 8 +++++--- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index f9a0d457003..10458236c30 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2012-09-08 Dmitry Gutov + + * progmodes/ruby-mode.el (ruby-match-expression-expansion): Only + fail when reached LIMIT. + 2012-09-08 Chong Yidong * dired.el (dired-mode-map): Don't bind M-=. diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el index ef1daa5e936..0636212a23f 100644 --- a/lisp/progmodes/ruby-mode.el +++ b/lisp/progmodes/ruby-mode.el @@ -1549,7 +1549,9 @@ See `font-lock-syntax-table'.") (defun ruby-match-expression-expansion (limit) (when (re-search-forward "[^\\]\\(\\\\\\\\\\)*\\(#\\({[^}\n\\\\]*\\(\\\\.[^}\n\\\\]*\\)*}\\|\\(\\$\\|@\\|@@\\)\\(\\w\\|_\\)+\\)\\)" limit 'move) - (ruby-in-ppss-context-p 'string))) + (or (ruby-in-ppss-context-p 'string) + (and (< (point) limit) + (ruby-match-expression-expansion limit))))) ;;;###autoload (define-derived-mode ruby-mode prog-mode "Ruby" diff --git a/test/automated/ruby-mode-tests.el b/test/automated/ruby-mode-tests.el index 1adc4acdfa0..515353bc2d0 100644 --- a/test/automated/ruby-mode-tests.el +++ b/test/automated/ruby-mode-tests.el @@ -237,10 +237,12 @@ VALUES-PLIST is a list with alternating index and value elements." 'font-lock-variable-name-face) (ruby-assert-face "\"This is \\#{no interpolation} despite the #\"" 15 'font-lock-string-face) - (ruby-assert-face "#@comment, not ruby code" 3 'font-lock-comment-face) - (ruby-assert-state "#@comment, not ruby code" 4 t) + (ruby-assert-face "\n#@comment, not ruby code" 5 'font-lock-comment-face) + (ruby-assert-state "\n#@comment, not ruby code" 4 t) (ruby-assert-face "# A comment cannot have #{an interpolation} in it" - 30 'font-lock-comment-face)) + 30 'font-lock-comment-face) + (ruby-assert-face "# #{comment}\n \"#{interpolation}\"" 16 + 'font-lock-variable-name-face)) (provide 'ruby-mode-tests) -- 2.39.2