]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/progmodes/ruby-mode.el (ruby-toggle-block): Don't stop at
authorAdam Sokolnicki <adam.sokolnicki@gmail.com>
Sun, 17 Nov 2013 21:39:13 +0000 (23:39 +0200)
committerDmitry Gutov <dgutov@yandex.ru>
Sun, 17 Nov 2013 21:39:13 +0000 (23:39 +0200)
interpolation curlies.

Fixes: debbugs:15914
lisp/ChangeLog
lisp/progmodes/ruby-mode.el
test/automated/ruby-mode-tests.el

index faa2243ca3b5c1364ce2d34cf509b629ced63066..7017e3ffb49d7403e322595b22579cf44fe54eae 100644 (file)
@@ -1,3 +1,8 @@
+2013-11-17  Adam Sokolnicki  <adam.sokolnicki@gmail.com>  (tiny change)
+
+       * progmodes/ruby-mode.el (ruby-toggle-block): Don't stop at
+       interpolation curlies (Bug#15914).
+
 2013-11-17  Jay Belanger  <jay.p.belanger@gmail.com>
 
        * calc/calc.el (calc-context-sensitive-enter): New variable.
index ab9fdce6af824f81306291687fa51cf9313b943e..28c44307ff2c97e63e2212fd30cb7065c6898162 100644 (file)
@@ -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 "\\({\\)\\|\\_<do\\(\\s \\|$\\||\\)")
+        (if (and (re-search-backward "\\(?:[^#]\\)\\({\\)\\|\\(\\_<do\\_>\\)")
                  (progn
+                   (goto-char (or (match-beginning 1) (match-beginning 2)))
                    (setq beg (point))
                    (save-match-data (ruby-forward-sexp))
                    (setq end (point))
index d5d262590b6dcee7d9e522e7dbfb9ae2096b8a7a..e84f55be93df9c383729bfab4045d04374f772c1 100644 (file)
@@ -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))