]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/progmodes/ruby-mode.el (ruby-font-lock-keywords): Highlight
authorDmitry Gutov <dgutov@yandex.ru>
Thu, 27 Mar 2014 08:21:15 +0000 (10:21 +0200)
committerDmitry Gutov <dgutov@yandex.ru>
Thu, 27 Mar 2014 08:21:15 +0000 (10:21 +0200)
special globals with font-lock-builtin-face.

Fixes: debbugs:17057
lisp/ChangeLog
lisp/progmodes/ruby-mode.el

index ff76cadf9458fa7e028a47f7caf2b2e13c73a69b..970402ef86ed750bd8eb60e2bf763bd3f80abf17 100644 (file)
@@ -1,5 +1,8 @@
 2014-03-27  Dmitry Gutov  <dgutov@yandex.ru>
 
+       * progmodes/ruby-mode.el (ruby-font-lock-keywords): Highlight
+       special globals with font-lock-builtin-face.  (Bug#17057)
+
        * progmodes/ruby-mode.el (ruby-syntax-propertize-function):
        Don't propertize `?' or `!' as symbol constituent when after
        colon.  (Bug#17097)
index 7219221d4e7465b2d2b383a9a5ad782c4670b54e..6c6cdd3427da543cef362b17563384accd3c424a 100644 (file)
@@ -2109,13 +2109,28 @@ See `font-lock-syntax-table'.")
      1 font-lock-variable-name-face)
     ;; Keywords that evaluate to certain values.
     ("\\_<__\\(?:LINE\\|ENCODING\\|FILE\\)__\\_>"
-     (0 font-lock-variable-name-face))
+     (0 font-lock-builtin-face))
     ;; Symbols.
     ("\\(^\\|[^:]\\)\\(:\\([-+~]@?\\|[/%&|^`]\\|\\*\\*?\\|<\\(<\\|=>?\\)?\\|>[>=]?\\|===?\\|=~\\|![~=]?\\|\\[\\]=?\\|@?\\(\\w\\|_\\)+\\([!?=]\\|\\b_*\\)\\|#{[^}\n\\\\]*\\(\\\\.[^}\n\\\\]*\\)*}\\)\\)"
      2 font-lock-constant-face)
-    ;; Variables.
-    ("\\$[^a-zA-Z \n]"
-     0 font-lock-variable-name-face)
+    ;; Special globals.
+    (,(concat "\\$\\(?:[:\"!@;,/\\._><\\$?~=*&`'+0-9]\\|-[0adFiIlpvw]\\|"
+              (regexp-opt '("LOAD_PATH" "LOADED_FEATURES" "PROGRAM_NAME"
+                            "ERROR_INFO" "ERROR_POSITION"
+                            "FS" "FIELD_SEPARATOR"
+                            "OFS" "OUTPUT_FIELD_SEPARATOR"
+                            "RS" "INPUT_RECORD_SEPARATOR"
+                            "ORS" "OUTPUT_RECORD_SEPARATOR"
+                            "NR" "INPUT_LINE_NUMBER"
+                            "LAST_READ_LINE" "DEFAULT_OUTPUT" "DEFAULT_INPUT"
+                            "PID" "PROCESS_ID" "CHILD_STATUS"
+                            "LAST_MATCH_INFO" "IGNORECASE"
+                            "ARGV" "MATCH" "PREMATCH" "POSTMATCH"
+                            "LAST_PAREN_MATCH" "stdin" "stdout" "stderr"
+                            "DEBUG" "FILENAME" "VERBOSE" "SAFE" "CLASSPATH"
+                            "JRUBY_VERSION" "JRUBY_REVISION" "ENV_JAVA"))
+              "\\_>\\)")
+     0 font-lock-builtin-face)
     ("\\(\\$\\|@\\|@@\\)\\(\\w\\|_\\)+"
      0 font-lock-variable-name-face)
     ;; Constants.