Commit ab89e9f9 authored by Dmitry Gutov's avatar Dmitry Gutov

* lisp/progmodes/ruby-mode.el (ruby-syntax-propertize-function): Only

propertize regexp when not inside a string.

Fixes: debbugs:13885
parent a611149e
2013-03-06 Dmitry Gutov <dgutov@yandex.ru>
* progmodes/ruby-mode.el (ruby-syntax-propertize-function): Only
propertize regexp when not inside a string (Bug#13885).
2013-03-06 Alan Mackenzie <acm@muc.de> 2013-03-06 Alan Mackenzie <acm@muc.de>
Correct the position of point in some line-up functions. Correct the position of point in some line-up functions.
......
...@@ -1276,8 +1276,10 @@ It will be properly highlighted even when the call omits parens.")) ...@@ -1276,8 +1276,10 @@ It will be properly highlighted even when the call omits parens."))
"\\)\\s *" "\\)\\s *"
;; The regular expression itself. ;; The regular expression itself.
"\\(/\\)[^/\n\\\\]*\\(?:\\\\.[^/\n\\\\]*\\)*\\(/\\)") "\\(/\\)[^/\n\\\\]*\\(?:\\\\.[^/\n\\\\]*\\)*\\(/\\)")
(2 (string-to-syntax "\"/")) (3 (unless (nth 3 (syntax-ppss (match-beginning 2)))
(3 (string-to-syntax "\"/"))) (put-text-property (match-beginning 2) (match-end 2)
'syntax-table (string-to-syntax "\"/"))
(string-to-syntax "\"/"))))
("^=en\\(d\\)\\_>" (1 "!")) ("^=en\\(d\\)\\_>" (1 "!"))
("^\\(=\\)begin\\_>" (1 "!")) ("^\\(=\\)begin\\_>" (1 "!"))
;; Handle here documents. ;; Handle here documents.
......
...@@ -47,17 +47,16 @@ The whitespace before and including \"|\" on each line is removed." ...@@ -47,17 +47,16 @@ The whitespace before and including \"|\" on each line is removed."
(defun ruby-test-string (s &rest args) (defun ruby-test-string (s &rest args)
(apply 'format (replace-regexp-in-string "^[ \t]*|" "" s) args)) (apply 'format (replace-regexp-in-string "^[ \t]*|" "" s) args))
(defun ruby-assert-state (content &rest values-plist) (defun ruby-assert-state (content index value &optional point)
"Assert syntax state values at the end of CONTENT. "Assert syntax state values at the end of CONTENT.
VALUES-PLIST is a list with alternating index and value elements." VALUES-PLIST is a list with alternating index and value elements."
(ruby-with-temp-buffer content (ruby-with-temp-buffer content
(when point (goto-char point))
(syntax-propertize (point)) (syntax-propertize (point))
(while values-plist (should (eq (nth index
(should (eq (nth (car values-plist) (parse-partial-sexp (point-min) (point)))
(parse-partial-sexp (point-min) (point))) value))))
(cadr values-plist)))
(setq values-plist (cddr values-plist)))))
(defun ruby-assert-face (content pos face) (defun ruby-assert-face (content pos face)
(ruby-with-temp-buffer content (ruby-with-temp-buffer content
...@@ -104,6 +103,12 @@ VALUES-PLIST is a list with alternating index and value elements." ...@@ -104,6 +103,12 @@ VALUES-PLIST is a list with alternating index and value elements."
(ruby-should-indent "a = %w[abc\n def]\n " 0) (ruby-should-indent "a = %w[abc\n def]\n " 0)
(ruby-should-indent "a = \"abc\n def\"\n " 0)) (ruby-should-indent "a = \"abc\n def\"\n " 0))
(ert-deftest ruby-regexp-doest-start-in-string ()
(ruby-assert-state "'(/', /\d+/" 3 nil))
(ert-deftest ruby-regexp-starts-after-string ()
(ruby-assert-state "'(/', /\d+/" 3 ?/ 8))
(ert-deftest ruby-indent-simple () (ert-deftest ruby-indent-simple ()
(ruby-should-indent-buffer (ruby-should-indent-buffer
"if foo "if foo
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment