emacs: Support for Erlang.
[profile] / dot-emacs.el
index 1596f11..e837272 100644 (file)
@@ -1586,6 +1586,41 @@ strip numbers instead."
           (list "\\(\\s.\\|\\s(\\|\\s)\\|\\s\\\\|\\s/\\)"
                 '(0 mdw-punct-face))))))
 
+;;;----- Erlang configuration -----------------------------------------------
+
+(setq erlang-electric-commannds
+      '(erlang-electric-newline erlang-electric-semicolon))
+
+(defun mdw-fontify-erlang ()
+
+  ;; --- Set fill prefix ---
+
+  (mdw-standard-fill-prefix "\\([ \t]*{?%*[ \t]*\\)")
+
+  ;; --- Fiddle with fontification ---
+
+  (make-local-variable 'font-lock-keywords)
+  (let ((erlang-keywords
+        (mdw-regexps "after" "and" "andalso"
+                     "band" "begin" "bnot" "bor" "bsl" "bsr" "bxor"
+                     "case" "catch" "cond"
+                     "div" "end" "fun" "if" "let" "not"
+                     "of" "or" "orelse"
+                     "query" "receive" "rem" "try" "when" "xor")))
+
+    (setq font-lock-keywords
+         (list
+          (list "%.*$"
+                '(0 font-lock-comment-face))
+          (list (concat "\\<\\(" erlang-keywords "\\)\\>")
+                '(0 font-lock-keyword-face))
+          (list (concat "^-\\sw+\\>")
+                '(0 font-lock-keyword-face))
+          (list "\\<[0-9]+\\(\\|#[0-9a-zA-Z]+\\|[eE][+-]?[0-9]+\\)\\>"
+                '(0 mdw-number-face))
+          (list "\\(\\s.\\|\\s(\\|\\s)\\|\\s\\\\|\\s/\\)"
+                '(0 mdw-punct-face))))))
+
 ;;;----- Texinfo configuration ----------------------------------------------
 
 (defun mdw-fontify-texinfo ()