]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/progmodes/ruby-mode.el (ruby-syntax-propertize-function): Don't
authorDmitry Gutov <dgutov@yandex.ru>
Sun, 30 Jun 2013 02:23:10 +0000 (06:23 +0400)
committerDmitry Gutov <dgutov@yandex.ru>
Sun, 30 Jun 2013 02:23:10 +0000 (06:23 +0400)
start heredoc inside a string or comment.

lisp/ChangeLog
lisp/progmodes/ruby-mode.el
test/automated/ruby-mode-tests.el

index 0506a68ceaf549a08ff8291490c4d289b328dbe1..aa2b3505411636bb3d5838b7b30b0f8bae0f3091 100644 (file)
@@ -1,3 +1,8 @@
+2013-06-30  Dmitry Gutov  <dgutov@yandex.ru>
+
+       * progmodes/ruby-mode.el (ruby-syntax-propertize-function): Don't
+       start heredoc inside a string or comment.
+
 2013-06-29  Eli Zaretskii  <eliz@gnu.org>
 
        * bindings.el (visual-order-cursor-movement): New defcustom.
index ab5634e52743cfe7bd004cf8ff5bd029b0ed7309..0292e40b986aef0079fdcb1aa8afd7b1ad0cf1e5 100644 (file)
@@ -1422,7 +1422,9 @@ It will be properly highlighted even when the call omits parens.")
             ("^\\(=\\)begin\\_>" (1 "!"))
             ;; Handle here documents.
             ((concat ruby-here-doc-beg-re ".*\\(\n\\)")
-             (7 (unless (ruby-singleton-class-p (match-beginning 0))
+             (7 (unless (or (nth 8 (save-excursion
+                                     (syntax-ppss (match-beginning 0))))
+                            (ruby-singleton-class-p (match-beginning 0)))
                   (put-text-property (match-beginning 7) (match-end 7)
                                      'syntax-table (string-to-syntax "\""))
                   (ruby-syntax-propertize-heredoc end))))
index ad13d01a67448ad112d94f97f04c84305da33704..a18899df02f65eb37667740bfbdf57bd2ca536ae 100644 (file)
@@ -87,6 +87,9 @@ VALUES-PLIST is a list with alternating index and value elements."
 (ert-deftest ruby-heredoc-highlights-interpolations ()
   (ruby-assert-face "s = <<EOS\n  #{foo}\nEOS" 15 font-lock-variable-name-face))
 
+(ert-deftest ruby-no-heredoc-inside-quotes ()
+  (ruby-assert-state "\"<<\", \"\",\nfoo" 3 nil))
+
 (ert-deftest ruby-deep-indent ()
   (let ((ruby-deep-arglist nil)
         (ruby-deep-indent-paren '(?\( ?\{ ?\[ ?\] t)))