diff options
| author | Dmitry Gutov | 2013-03-06 22:56:29 +0400 |
|---|---|---|
| committer | Dmitry Gutov | 2013-03-06 22:56:29 +0400 |
| commit | ab89e9f9a594c30ce4c04e6d502bee3beaefe908 (patch) | |
| tree | 1f41ac1aab95f08ab04f3ffb6210b5156d461e6b | |
| parent | a611149e46d0a6927e9c276d4cf2089b7cfb7e05 (diff) | |
| download | emacs-ab89e9f9a594c30ce4c04e6d502bee3beaefe908.tar.gz emacs-ab89e9f9a594c30ce4c04e6d502bee3beaefe908.zip | |
* lisp/progmodes/ruby-mode.el (ruby-syntax-propertize-function): Only
propertize regexp when not inside a string.
Fixes: debbugs:13885
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/progmodes/ruby-mode.el | 6 | ||||
| -rw-r--r-- | test/automated/ruby-mode-tests.el | 17 |
3 files changed, 20 insertions, 8 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 18242539cca..cef47715dc0 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2013-03-06 Dmitry Gutov <dgutov@yandex.ru> | ||
| 2 | |||
| 3 | * progmodes/ruby-mode.el (ruby-syntax-propertize-function): Only | ||
| 4 | propertize regexp when not inside a string (Bug#13885). | ||
| 5 | |||
| 1 | 2013-03-06 Alan Mackenzie <acm@muc.de> | 6 | 2013-03-06 Alan Mackenzie <acm@muc.de> |
| 2 | 7 | ||
| 3 | Correct the position of point in some line-up functions. | 8 | Correct the position of point in some line-up functions. |
diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el index 9b007c0063a..6e471d1aa2a 100644 --- a/lisp/progmodes/ruby-mode.el +++ b/lisp/progmodes/ruby-mode.el | |||
| @@ -1276,8 +1276,10 @@ It will be properly highlighted even when the call omits parens.")) | |||
| 1276 | "\\)\\s *" | 1276 | "\\)\\s *" |
| 1277 | ;; The regular expression itself. | 1277 | ;; The regular expression itself. |
| 1278 | "\\(/\\)[^/\n\\\\]*\\(?:\\\\.[^/\n\\\\]*\\)*\\(/\\)") | 1278 | "\\(/\\)[^/\n\\\\]*\\(?:\\\\.[^/\n\\\\]*\\)*\\(/\\)") |
| 1279 | (2 (string-to-syntax "\"/")) | 1279 | (3 (unless (nth 3 (syntax-ppss (match-beginning 2))) |
| 1280 | (3 (string-to-syntax "\"/"))) | 1280 | (put-text-property (match-beginning 2) (match-end 2) |
| 1281 | 'syntax-table (string-to-syntax "\"/")) | ||
| 1282 | (string-to-syntax "\"/")))) | ||
| 1281 | ("^=en\\(d\\)\\_>" (1 "!")) | 1283 | ("^=en\\(d\\)\\_>" (1 "!")) |
| 1282 | ("^\\(=\\)begin\\_>" (1 "!")) | 1284 | ("^\\(=\\)begin\\_>" (1 "!")) |
| 1283 | ;; Handle here documents. | 1285 | ;; Handle here documents. |
diff --git a/test/automated/ruby-mode-tests.el b/test/automated/ruby-mode-tests.el index c67f92e6ed9..81bae187218 100644 --- a/test/automated/ruby-mode-tests.el +++ b/test/automated/ruby-mode-tests.el | |||
| @@ -47,17 +47,16 @@ The whitespace before and including \"|\" on each line is removed." | |||
| 47 | (defun ruby-test-string (s &rest args) | 47 | (defun ruby-test-string (s &rest args) |
| 48 | (apply 'format (replace-regexp-in-string "^[ \t]*|" "" s) args)) | 48 | (apply 'format (replace-regexp-in-string "^[ \t]*|" "" s) args)) |
| 49 | 49 | ||
| 50 | (defun ruby-assert-state (content &rest values-plist) | 50 | (defun ruby-assert-state (content index value &optional point) |
| 51 | "Assert syntax state values at the end of CONTENT. | 51 | "Assert syntax state values at the end of CONTENT. |
| 52 | 52 | ||
| 53 | VALUES-PLIST is a list with alternating index and value elements." | 53 | VALUES-PLIST is a list with alternating index and value elements." |
| 54 | (ruby-with-temp-buffer content | 54 | (ruby-with-temp-buffer content |
| 55 | (when point (goto-char point)) | ||
| 55 | (syntax-propertize (point)) | 56 | (syntax-propertize (point)) |
| 56 | (while values-plist | 57 | (should (eq (nth index |
| 57 | (should (eq (nth (car values-plist) | 58 | (parse-partial-sexp (point-min) (point))) |
| 58 | (parse-partial-sexp (point-min) (point))) | 59 | value)))) |
| 59 | (cadr values-plist))) | ||
| 60 | (setq values-plist (cddr values-plist))))) | ||
| 61 | 60 | ||
| 62 | (defun ruby-assert-face (content pos face) | 61 | (defun ruby-assert-face (content pos face) |
| 63 | (ruby-with-temp-buffer content | 62 | (ruby-with-temp-buffer content |
| @@ -104,6 +103,12 @@ VALUES-PLIST is a list with alternating index and value elements." | |||
| 104 | (ruby-should-indent "a = %w[abc\n def]\n " 0) | 103 | (ruby-should-indent "a = %w[abc\n def]\n " 0) |
| 105 | (ruby-should-indent "a = \"abc\n def\"\n " 0)) | 104 | (ruby-should-indent "a = \"abc\n def\"\n " 0)) |
| 106 | 105 | ||
| 106 | (ert-deftest ruby-regexp-doest-start-in-string () | ||
| 107 | (ruby-assert-state "'(/', /\d+/" 3 nil)) | ||
| 108 | |||
| 109 | (ert-deftest ruby-regexp-starts-after-string () | ||
| 110 | (ruby-assert-state "'(/', /\d+/" 3 ?/ 8)) | ||
| 111 | |||
| 107 | (ert-deftest ruby-indent-simple () | 112 | (ert-deftest ruby-indent-simple () |
| 108 | (ruby-should-indent-buffer | 113 | (ruby-should-indent-buffer |
| 109 | "if foo | 114 | "if foo |