From: Dmitry Gutov Date: Fri, 6 Dec 2013 04:22:08 +0000 (+0200) Subject: Fix Bug#15874 X-Git-Tag: emacs-24.3.90~173^2^2~42^2~45^2~387^2~543 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=af67e79a52a3db028dc6a066f6e87b87a8190cc9;p=emacs.git Fix Bug#15874 * 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. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 1fd715dda59..3877d053199 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,12 @@ +2013-12-06 Dmitry Gutov + + * 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 * isearch.el (isearch--saved-overriding-local-map): diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el index 4258303cd8c..be12b1474c3 100644 --- a/lisp/progmodes/ruby-mode.el +++ b/lisp/progmodes/ruby-mode.el @@ -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))))) diff --git a/test/automated/ruby-mode-tests.el b/test/automated/ruby-mode-tests.el index f59b8db86e9..9c121169756 100644 --- a/test/automated/ruby-mode-tests.el +++ b/test/automated/ruby-mode-tests.el @@ -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 ()