code_junkie

Fontifying variable references within string literals in Emacs font-lock-mode

Nov 11th, 2011
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. "a #{foo} a"
  2.  
  3. (define-derived-mode temp-mode fundamental-mode "Temp"
  4. "Temporary major mode."
  5. (set (make-local-variable 'font-lock-defaults)
  6. '((temp-mode-font-lock-keywords) nil nil nil nil)))
  7.  
  8. (defconst temp-mode-font-lock-keywords
  9. (list (list "$[A-Za-z0-9]+" 0 font-lock-variable-name-face t)))
  10.  
  11. (setq ruby-font-lock-syntactic-keywords
  12. '(
  13. ;; #{ }, #$hoge, #@foo are not comments
  14. ("\(#\)[{$@]" 1 (1 . nil))
Add Comment
Please, Sign In to add comment