From 2ded9493dfd97cf3da9b6fab1b9362cc3fde6e40 Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Wed, 8 Oct 2008 12:55:22 +0100 Subject: [PATCH] emacs: Support for Erlang. Sketchy but at least it's there. Also sneak in a couple of bits of support for C# which somehow slipped through the net before. --- dot-emacs.el | 35 +++++++++++++++++++++++++++++++++++ emacs | 19 +++++++++++-------- 2 files changed, 46 insertions(+), 8 deletions(-) diff --git a/dot-emacs.el b/dot-emacs.el index 1596f11..e837272 100644 --- a/dot-emacs.el +++ b/dot-emacs.el @@ -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 () diff --git a/emacs b/emacs index 49c5649..c5da27b 100644 --- a/emacs +++ b/emacs @@ -425,14 +425,14 @@ (mapcar (lambda (hook) (add-hook hook 'mdw-misc-mode-config)) '(c-mode-hook c++-mode-hook objc-mode-hook java-mode-hook - perl-mode-hook cperl-mode-hook python-mode-hook awk-mode-hook - tcl-mode-hook asm-mode-hook - TeX-mode-hook LaTeX-mode-hook TeXinfo-mode-hook - tex-mode-hook latex-mode-hook texinfo-mode-hook - emacs-lisp-mode-hook scheme-mode-hook - lisp-mode-hook lisp-interaction-mode-hook inferior-lisp-mode-hook - slime-repl-mode-hook - sml-mode-hook haskell-mode-hook + csharp-mode-hook perl-mode-hook cperl-mode-hook + python-mode-hook awk-mode-hook tcl-mode-hook + asm-mode-hook TeX-mode-hook LaTeX-mode-hook + TeXinfo-mode-hook tex-mode-hook latex-mode-hook + texinfo-mode-hook emacs-lisp-mode-hook scheme-mode-hook + lisp-mode-hook lisp-interaction-mode-hook + inferior-lisp-mode-hook slime-repl-mode-hook + sml-mode-hook haskell-mode-hook erlang-mode-hook smalltalk-mode-hook rexx-mode-hook arm-assembler-mode-hook)) @@ -503,6 +503,7 @@ (add-hook 'apcalc-mode-hook 'mdw-fontify-apcalc t) (add-hook 'java-mode-hook 'mdw-fontify-java t) +(add-hook 'csharp-mode-hook 'mdw-fontify-csharp t) (add-hook 'awk-mode-hook 'mdw-fontify-awk t) @@ -529,6 +530,8 @@ (add-hook 'haskell-mode-hook 'mdw-fontify-haskell t) (setq-default haskell-indent-offset 2) +(add-hook 'erlang-mode-hook 'mdw-fontify-erlang t) + (add-hook 'texinfo-mode-hook 'mdw-fontify-texinfo t) (add-hook 'TeXinfo-mode-hook 'mdw-fontify-texinfo t) -- 2.11.0