From 8de64bb862ed7221a0c558167f7b6c766603d377 Mon Sep 17 00:00:00 2001 From: Dmitry Gutov Date: Thu, 27 Mar 2014 10:21:15 +0200 Subject: [PATCH] * lisp/progmodes/ruby-mode.el (ruby-font-lock-keywords): Highlight special globals with font-lock-builtin-face. Fixes: debbugs:17057 --- lisp/ChangeLog | 3 +++ lisp/progmodes/ruby-mode.el | 23 +++++++++++++++++++---- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ff76cadf945..970402ef86e 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,8 @@ 2014-03-27 Dmitry Gutov + * 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) diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el index 7219221d4e7..6c6cdd3427d 100644 --- a/lisp/progmodes/ruby-mode.el +++ b/lisp/progmodes/ruby-mode.el @@ -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. -- 2.39.2