bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#17057: 24.3.50; [ruby-mode] Font-locking of special global variables


From: Bozhidar Batsov
Subject: bug#17057: 24.3.50; [ruby-mode] Font-locking of special global variables like $$ is broken(missing)
Date: Wed, 26 Mar 2014 14:42:51 +0200

I didn’t include them in RuboCop’s code since they actually constitute a different syntactic category according to the parser - a “nth-reference”. I don’t think we should care about this in ruby-mode, though. The patch looks great. Given the fact that Emacs releases are pretty far apart (usually more than 1 year) I think we should include this given that’s if virtually impossible to introduce a regression.

-- 
Cheers,
Bozhidar

On Wednesday, March 26, 2014 at 2:35 PM, Dmitry Gutov wrote:

On 24.03.2014 11:45, Bozhidar Batsov wrote:

Yeah, seems that everything important is listed there. Here’s one a bit
more extensive list, though:


It features the JRuby-specific global vars in addition to the standard
ones.

I see that you don't include the $(digit) globals, which reference the
last regexp-matched groups. The patch below does.

Not sure if it's okay to install in 24.4, though: on the one hand it's
low-risk, on the other hand it's not a bugfix.


=== modified file 'lisp/progmodes/ruby-mode.el'
--- lisp/progmodes/ruby-mode.el 2014-03-24 08:53:56 +0000
+++ lisp/progmodes/ruby-mode.el 2014-03-26 11:33:42 +0000
@@ -2108,13 +2108,28 @@
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 variables.
+ (,(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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]