* lisp/progmodes/ruby-mode.el (ruby-syntax-propertize-function): Only
propertize regexp when not inside a string. Fixes: debbugs:13885
This commit is contained in:
parent
a611149e46
commit
ab89e9f9a5
3 changed files with 20 additions and 8 deletions
|
@ -1,3 +1,8 @@
|
|||
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>
|
||||
|
||||
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."))
|
|||
"\\)\\s *"
|
||||
;; The regular expression itself.
|
||||
"\\(/\\)[^/\n\\\\]*\\(?:\\\\.[^/\n\\\\]*\\)*\\(/\\)")
|
||||
(2 (string-to-syntax "\"/"))
|
||||
(3 (string-to-syntax "\"/")))
|
||||
(3 (unless (nth 3 (syntax-ppss (match-beginning 2)))
|
||||
(put-text-property (match-beginning 2) (match-end 2)
|
||||
'syntax-table (string-to-syntax "\"/"))
|
||||
(string-to-syntax "\"/"))))
|
||||
("^=en\\(d\\)\\_>" (1 "!"))
|
||||
("^\\(=\\)begin\\_>" (1 "!"))
|
||||
;; Handle here documents.
|
||||
|
|
|
@ -47,17 +47,16 @@ The whitespace before and including \"|\" on each line is removed."
|
|||
(defun ruby-test-string (s &rest 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.
|
||||
|
||||
VALUES-PLIST is a list with alternating index and value elements."
|
||||
(ruby-with-temp-buffer content
|
||||
(when point (goto-char point))
|
||||
(syntax-propertize (point))
|
||||
(while values-plist
|
||||
(should (eq (nth (car values-plist)
|
||||
(parse-partial-sexp (point-min) (point)))
|
||||
(cadr values-plist)))
|
||||
(setq values-plist (cddr values-plist)))))
|
||||
(should (eq (nth index
|
||||
(parse-partial-sexp (point-min) (point)))
|
||||
value))))
|
||||
|
||||
(defun ruby-assert-face (content pos face)
|
||||
(ruby-with-temp-buffer content
|
||||
|
@ -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 = \"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 ()
|
||||
(ruby-should-indent-buffer
|
||||
"if foo
|
||||
|
|
Loading…
Add table
Reference in a new issue