]> code.delx.au - gnu-emacs/blobdiff - lisp/progmodes/ruby-mode.el
Merge from emacs-24; up to 2014-07-26T12:14:42Z!schwab@linux-m68k.org
[gnu-emacs] / lisp / progmodes / ruby-mode.el
index 7219221d4e7465b2d2b383a9a5ad782c4670b54e..2f23e338f81aa004f98a16651c828605d3a31b5a 100644 (file)
@@ -749,7 +749,6 @@ It is used when `ruby-encoding-magic-comment-style' is set to `custom'."
                   :forward-token  #'ruby-smie--forward-token
                   :backward-token #'ruby-smie--backward-token)
     (setq-local indent-line-function 'ruby-indent-line))
-  (setq-local require-final-newline t)
   (setq-local comment-start "# ")
   (setq-local comment-end "")
   (setq-local comment-column ruby-comment-column)
@@ -1804,9 +1803,10 @@ It will be properly highlighted even when the call omits parens.")
       ;; $' $" $` .... are variables.
       ;; ?' ?" ?` are character literals (one-char strings in 1.9+).
       ("\\([?$]\\)[#\"'`]"
-       (1 (unless (save-excursion
-                    ;; Not within a string.
-                    (nth 3 (syntax-ppss (match-beginning 0))))
+       (1 (if (save-excursion
+                (nth 3 (syntax-ppss (match-beginning 0))))
+              ;; Within a string, skip.
+              (goto-char (match-end 1))
             (string-to-syntax "\\"))))
       ;; Part of symbol when at the end of a method name.
       ("[!?]"
@@ -2065,6 +2065,10 @@ See `font-lock-syntax-table'.")
           "include"
           "module_function"
           "prepend"
+          "private_class_method"
+          "private_constant"
+          "public_class_method"
+          "public_constant"
           "refine"
           "using")
         'symbols))
@@ -2109,13 +2113,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.
@@ -2132,7 +2151,7 @@ See `font-lock-syntax-table'.")
     (ruby-match-expression-expansion
      2 font-lock-variable-name-face t)
     ;; Negation char.
-    ("\\(?:^\\|[^[:alnum:]_]\\)\\(!+\\)[^=]"
+    ("\\(?:^\\|[^[:alnum:]_]\\)\\(!+\\)[^=~]"
      1 font-lock-negation-char-face)
     ;; Character literals.
     ;; FIXME: Support longer escape sequences.