[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r111958: * lisp/progmodes/ruby-mode.e
From: |
Dmitry Gutov |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r111958: * lisp/progmodes/ruby-mode.el (ruby-syntax-propertize-function): Only |
Date: |
Wed, 06 Mar 2013 22:56:29 +0400 |
User-agent: |
Bazaar (2.5.0) |
------------------------------------------------------------
revno: 111958
fixes bug: http://debbugs.gnu.org/13885
committer: Dmitry Gutov <address@hidden>
branch nick: trunk
timestamp: Wed 2013-03-06 22:56:29 +0400
message:
* lisp/progmodes/ruby-mode.el (ruby-syntax-propertize-function): Only
propertize regexp when not inside a string.
modified:
lisp/ChangeLog
lisp/progmodes/ruby-mode.el
test/automated/ruby-mode-tests.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2013-03-06 14:24:39 +0000
+++ b/lisp/ChangeLog 2013-03-06 18:56:29 +0000
@@ -1,3 +1,8 @@
+2013-03-06 Dmitry Gutov <address@hidden>
+
+ * progmodes/ruby-mode.el (ruby-syntax-propertize-function): Only
+ propertize regexp when not inside a string (Bug#13885).
+
2013-03-06 Alan Mackenzie <address@hidden>
Correct the position of point in some line-up functions.
=== modified file 'lisp/progmodes/ruby-mode.el'
--- a/lisp/progmodes/ruby-mode.el 2013-02-14 05:45:33 +0000
+++ b/lisp/progmodes/ruby-mode.el 2013-03-06 18:56:29 +0000
@@ -1276,8 +1276,10 @@
"\\)\\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.
=== modified file 'test/automated/ruby-mode-tests.el'
--- a/test/automated/ruby-mode-tests.el 2013-02-14 05:45:33 +0000
+++ b/test/automated/ruby-mode-tests.el 2013-03-06 18:56:29 +0000
@@ -47,17 +47,16 @@
(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 @@
(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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r111958: * lisp/progmodes/ruby-mode.el (ruby-syntax-propertize-function): Only,
Dmitry Gutov <=