summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Gutov <dgutov@yandex.ru>2014-03-27 10:21:15 +0200
committerDmitry Gutov <dgutov@yandex.ru>2014-03-27 10:21:15 +0200
commit8de64bb862ed7221a0c558167f7b6c766603d377 (patch)
tree1c52524722e737bcdda05671b44e1606129ef297
parent42ebc34ea8f93efe5b23c0124691207f32055666 (diff)
downloademacs-8de64bb862ed7221a0c558167f7b6c766603d377.tar.gz
* lisp/progmodes/ruby-mode.el (ruby-font-lock-keywords): Highlight
special globals with font-lock-builtin-face. Fixes: debbugs:17057
-rw-r--r--lisp/ChangeLog3
-rw-r--r--lisp/progmodes/ruby-mode.el23
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 <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)
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.