dot-emacs: Fix the C mode hacking.
[profile] / dot-emacs.el
index 1596f11..0376bad 100644 (file)
@@ -726,6 +726,11 @@ the regular expressions in `mdw-backup-disable-regexps'."
 
 ;; --- Make C indentation nice ---
 
+(eval-after-load "cc-mode"
+  '(progn
+     (define-key c-mode-map "*" nil)
+     (define-key c-mode-map "/" nil)))
+
 (defun mdw-c-style ()
   (c-add-style "[mdw] C and C++ style"
               '((c-basic-offset . 2)
@@ -1586,6 +1591,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 ()