Fix Bug#15874
authorDmitry Gutov <dgutov@yandex.ru>
Fri, 6 Dec 2013 04:22:08 +0000 (06:22 +0200)
committerDmitry Gutov <dgutov@yandex.ru>
Fri, 6 Dec 2013 04:22:08 +0000 (06:22 +0200)
* lisp/progmodes/ruby-mode.el (ruby-mode-syntax-table): Don't modify
syntax for `?'.
(ruby-expr-beg): Expect that `!' will have syntax class "symbol"
where appropriate already.
(ruby-syntax-propertize-function): Propertize `?' and `!' at the
end of method names.

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

index 1fd715d..3877d05 100644 (file)
@@ -1,3 +1,12 @@
+2013-12-06  Dmitry Gutov  <dgutov@yandex.ru>
+
+       * progmodes/ruby-mode.el (ruby-mode-syntax-table): Don't modify
+       syntax for `?'.
+       (ruby-expr-beg): Expect that `!' will have syntax class "symbol"
+       where appropriate already.
+       (ruby-syntax-propertize-function): Propertize `?' and `!' at the
+       end of method names (Bug#15874).
+
 2013-12-06  Juri Linkov  <juri@jurta.org>
 
        * isearch.el (isearch--saved-overriding-local-map):
index 4258303..be12b14 100644 (file)
@@ -186,7 +186,6 @@ This should only be called after matching against `ruby-here-doc-beg-re'."
     (modify-syntax-entry ?\n ">" table)
     (modify-syntax-entry ?\\ "\\" table)
     (modify-syntax-entry ?$ "." table)
-    (modify-syntax-entry ?? "_" table)
     (modify-syntax-entry ?_ "_" table)
     (modify-syntax-entry ?: "_" table)
     (modify-syntax-entry ?< "." table)
@@ -783,7 +782,7 @@ Can be one of `heredoc', `modifier', `expr-qstr', `expr-re'."
                                         ruby-block-mid-keywords)
                                 'words))
                    (goto-char (match-end 0))
-                   (not (looking-at "\\s_\\|!")))
+                   (not (looking-at "\\s_")))
                   ((eq option 'expr-qstr)
                    (looking-at "[a-zA-Z][a-zA-z0-9_]* +%[^ \t]"))
                   ((eq option 'expr-re)
@@ -1648,6 +1647,14 @@ It will be properly highlighted even when the call omits parens.")
                     ;; Not within a string.
                     (nth 3 (syntax-ppss (match-beginning 0))))
             (string-to-syntax "\\"))))
+      ;; Part of symbol when at the end of a method name.
+      ("[!?]"
+       (0 (unless (save-excursion
+                    (or (nth 8 (syntax-ppss (match-beginning 0)))
+                        (let (parse-sexp-lookup-properties)
+                          (or (zerop (skip-syntax-backward "w_"))
+                              (memq (preceding-char) '(?@ ?$))))))
+            (string-to-syntax "_"))))
       ;; Regular expressions.  Start with matching unescaped slash.
       ("\\(?:\\=\\|[^\\]\\)\\(?:\\\\\\\\\\)*\\(/\\)"
        (1 (let ((state (save-excursion (syntax-ppss (match-beginning 1)))))
index f59b8db..9c12116 100644 (file)
@@ -91,8 +91,7 @@ VALUES-PLIST is a list with alternating index and value elements."
 (ert-deftest ruby-no-heredoc-inside-quotes ()
   (ruby-assert-state "\"<<\", \"\",\nfoo" 3 nil))
 
-;; Change result if you fix http://debbugs.gnu.org/15874
-(ert-deftest ruby-exit!-font-lock () :expected-result :failed
+(ert-deftest ruby-exit!-font-lock ()
   (ruby-assert-face "exit!" 5 font-lock-builtin-face))
 
 (ert-deftest ruby-deep-indent ()