From 56cd894e90949294d9578fd9fa45a179389f3306 Mon Sep 17 00:00:00 2001 From: Adam Sokolnicki Date: Sun, 17 Nov 2013 23:39:13 +0200 Subject: [PATCH] * lisp/progmodes/ruby-mode.el (ruby-toggle-block): Don't stop at interpolation curlies. Fixes: debbugs:15914 --- lisp/ChangeLog | 5 +++++ lisp/progmodes/ruby-mode.el | 3 ++- test/automated/ruby-mode-tests.el | 6 ++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index faa2243ca3..7017e3ffb4 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2013-11-17 Adam Sokolnicki (tiny change) + + * progmodes/ruby-mode.el (ruby-toggle-block): Don't stop at + interpolation curlies (Bug#15914). + 2013-11-17 Jay Belanger * calc/calc.el (calc-context-sensitive-enter): New variable. diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el index ab9fdce6af..28c44307ff 100644 --- a/lisp/progmodes/ruby-mode.el +++ b/lisp/progmodes/ruby-mode.el @@ -1590,8 +1590,9 @@ If the result is do-end block, it will always be multiline." (let ((start (point)) beg end) (end-of-line) (unless - (if (and (re-search-backward "\\({\\)\\|\\_\\)") (progn + (goto-char (or (match-beginning 1) (match-beginning 2))) (setq beg (point)) (save-match-data (ruby-forward-sexp)) (setq end (point)) diff --git a/test/automated/ruby-mode-tests.el b/test/automated/ruby-mode-tests.el index d5d262590b..e84f55be93 100644 --- a/test/automated/ruby-mode-tests.el +++ b/test/automated/ruby-mode-tests.el @@ -309,6 +309,12 @@ VALUES-PLIST is a list with alternating index and value elements." (ruby-toggle-block) (should (string= "foo do |b|\n b + 1\nend" (buffer-string))))) +(ert-deftest ruby-toggle-block-with-interpolation () + (ruby-with-temp-buffer "foo do\n \"#{bar}\"\nend" + (beginning-of-line) + (ruby-toggle-block) + (should (string= "foo { \"#{bar}\" }" (buffer-string))))) + (ert-deftest ruby-recognize-symbols-starting-with-at-character () (ruby-assert-face ":@abc" 3 font-lock-constant-face)) -- 2.20.1