]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/progmodes/ruby-mode.el (ruby-font-lock-keywords): Highlight
authorDmitry Gutov <dgutov@yandex.ru>
Fri, 21 Jun 2013 23:07:49 +0000 (03:07 +0400)
committerDmitry Gutov <dgutov@yandex.ru>
Fri, 21 Jun 2013 23:07:49 +0000 (03:07 +0400)
keyword-like methods on Kernel and Module with
font-lock-builtin-face.

lisp/ChangeLog
lisp/progmodes/ruby-mode.el

index 5066f9595a29b4da0631f2fcd3556a3b88f3cb82..64cb8574db36a1457998bc4a9dd413fb707d54fd 100644 (file)
@@ -1,3 +1,9 @@
+2013-06-21  Dmitry Gutov  <dgutov@yandex.ru>
+
+       * progmodes/ruby-mode.el (ruby-font-lock-keywords): Highlight
+       keyword-like methods on Kernel and Module with
+       font-lock-builtin-face.
+
 2013-06-21  Stephen Berman  <stephen.berman@gmx.net>
 
        * obsolete/otodo-mode.el: Move and rename from calendar/todo-mode.el.
index 8a1548bc9407d4a08fe2f9a7b15f1a28eb30dfca..fe44647dcce13932ae9fbd5d2f5763f2b5b393e4 100644 (file)
@@ -1726,12 +1726,11 @@ See `font-lock-syntax-table'.")
    ;; functions
    '("^\\s *def\\s +\\([^( \t\n]+\\)"
      1 font-lock-function-name-face)
-   ;; keywords
-   (cons (concat
-          "\\(^\\|[^.@$]\\|\\.\\.\\)\\_<\\(defined\\?\\|"
+   (list (concat
+          "\\(^\\|[^.@$]\\|\\.\\.\\)\\("
+          ;; keywords
           (regexp-opt
-           '("alias_method"
-             "alias"
+           '("alias"
              "and"
              "begin"
              "break"
@@ -1739,6 +1738,7 @@ See `font-lock-syntax-table'.")
              "catch"
              "class"
              "def"
+             "defined?"
              "do"
              "elsif"
              "else"
@@ -1748,21 +1748,15 @@ See `font-lock-syntax-table'.")
              "end"
              "if"
              "in"
-             "module_function"
              "module"
              "next"
              "not"
              "or"
-             "public"
-             "private"
-             "protected"
-             "raise"
              "redo"
              "rescue"
              "retry"
              "return"
              "then"
-             "throw"
              "super"
              "unless"
              "undef"
@@ -1770,10 +1764,26 @@ See `font-lock-syntax-table'.")
              "when"
              "while"
              "yield")
-           t)
-          "\\)"
-          ruby-keyword-end-re)
-         2)
+           'symbols)
+          "\\|"
+          ;; keyword-like methods on Kernel and Module
+          (regexp-opt
+           '("alias_method"
+             "autoload"
+             "module_function"
+             "private"
+             "protected"
+             "public"
+             "raise"
+             "require"
+             "require_relative"
+             "throw")
+           'symbols)
+          "\\)")
+         2
+         '(if (match-beginning 4)
+              font-lock-builtin-face
+            font-lock-keyword-face))
    ;; here-doc beginnings
    `(,ruby-here-doc-beg-re 0 (unless (ruby-singleton-class-p (match-beginning 0))
                                'font-lock-string-face))