Created
January 26, 2013 16:13
-
-
Save krisajenkins/4643080 to your computer and use it in GitHub Desktop.
def*-style syntax highlighting for Clojure in Emacs - Annotated
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; Add a function that runs for any Clojure buffer. | |
(add-hook 'clojure-mode-hook | |
; It's an anonymous function and it takes no arguments. | |
'(lambda () | |
; It calls the function that adds syntax-highlighting rules. | |
(font-lock-add-keywords nil | |
; So many escape codes! But behind those we're just saying: | |
; Match the '(' character. | |
; Match and group the string 'defwidget'. | |
; Match some whitespace. \\s-+ | |
; Match and group some word characters. \\w+ | |
'(("(\\(defwidget\\)\\s-+\\(\\w+\\)" | |
(1 font-lock-keyword-face) ; The first regexp group is a keyword. | |
(2 font-lock-function-name-face) ; The second regexp group is a name. | |
))))) ; Close up the patient. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment