]> git.eshelyaron.com Git - emacs.git/commitdiff
Improve Ruby 1.9-style keyword keys highlighting
authorDmitry Gutov <dgutov@yandex.ru>
Sun, 15 Nov 2015 05:25:19 +0000 (07:25 +0200)
committerDmitry Gutov <dgutov@yandex.ru>
Sun, 15 Nov 2015 05:25:19 +0000 (07:25 +0200)
* lisp/progmodes/ruby-mode.el (ruby-font-lock-keywords):
Handle required keyword arguments (bug#21367).
And highlight the colon together with the name.

lisp/progmodes/ruby-mode.el

index 09338860c7520cb7bfa489e09d1012a1f7ce8296..754785168f2ac58f98c6e356f597db32a61dbf2c 100644 (file)
@@ -2193,8 +2193,9 @@ See `font-lock-syntax-table'.")
     ;; Constants.
     ("\\(?:\\_<\\|::\\)\\([A-Z]+\\(\\w\\|_\\)*\\)"
      1 (unless (eq ?\( (char-after)) font-lock-type-face))
-    ("\\(^\\s *\\|[[{(,]\\s *\\|\\sw\\s +\\)\\(\\(\\sw\\|_\\)+\\):[^:]"
-     (2 font-lock-constant-face))
+    ;; Ruby 1.9-style symbol hash keys.
+    ("\\(?:^\\s *\\|[[{(,]\\s *\\|\\sw\\s +\\)\\(\\(\\sw\\|_\\)+:\\)[^:]"
+     (1 (progn (forward-char -1) font-lock-constant-face)))
     ;; Conversion methods on Kernel.
     (,(concat ruby-font-lock-keyword-beg-re
               (regexp-opt '("Array" "Complex" "Float" "Hash"