From cc1980e1db0ae091fe1a80797a7cfe63ed884bf9 Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Tue, 14 Jul 2009 14:16:42 +0100 Subject: [PATCH] emacs, dot-emacs: Icon fontification support. Icon is a cool language. It seems a shame not to support it. --- dot-emacs.el | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ emacs | 4 +++- 2 files changed, 64 insertions(+), 1 deletion(-) diff --git a/dot-emacs.el b/dot-emacs.el index 0d27f52..f687acb 100644 --- a/dot-emacs.el +++ b/dot-emacs.el @@ -1414,6 +1414,67 @@ strip numbers instead." (list "\\(\\s.\\|\\s(\\|\\s)\\|\\s\\\\|\\s/\\)" '(0 mdw-punct-face)))))) +;;;----- Icon programming style --------------------------------------------- + +;; --- Icon indentation style --- + +(setq icon-brace-offset 0 + icon-continued-brace-offset 0 + icon-continued-statement-offset 2 + icon-indent-level 2) + +;; --- Define Icon fontification style --- + +(defun mdw-fontify-icon () + + ;; --- Miscellaneous fiddling --- + + (mdw-standard-fill-prefix "\\([ \t]*#+[ \t]*\\)") + + ;; --- Now define fontification things --- + + (make-local-variable 'font-lock-keywords) + (let ((icon-keywords + (mdw-regexps "break" "by" "case" "create" "default" "do" "else" + "end" "every" "fail" "global" "if" "initial" + "invocable" "link" "local" "next" "not" "of" + "procedure" "record" "repeat" "return" "static" + "suspend" "then" "to" "until" "while")) + (preprocessor-keywords + (mdw-regexps "define" "else" "endif" "error" "ifdef" "ifndef" + "include" "line" "undef"))) + (setq font-lock-keywords + (list + + ;; --- Set up the keywords defined above --- + + (list (concat "\\<\\(" icon-keywords "\\)\\>") + '(0 font-lock-keyword-face)) + + ;; --- The things that Icon calls keywords --- + + (list "&\\sw+\\>" '(0 font-lock-variable-name-face)) + + ;; --- At least numbers are simpler than C --- + + (list (concat "\\<[0-9]+" + "\\([rR][0-9a-zA-Z]+\\|" + "\\.[0-9]+\\([eE][+-]?[0-9]+\\)?\\)\\>\\|" + "\\.[0-9]+\\([eE][+-]?[0-9]+\\)?\\>") + '(0 mdw-number-face)) + + ;; --- Preprocessor --- + + (list (concat "^[ \t]*$[ \t]*\\<\\(" + preprocessor-keywords + "\\)\\>") + '(0 font-lock-keyword-face)) + + ;; --- And anything else is punctuation --- + + (list "\\(\\s.\\|\\s(\\|\\s)\\|\\s\\\\|\\s/\\)" + '(0 mdw-punct-face)))))) + ;;;----- ARM assembler programming configuration ---------------------------- ;; --- There doesn't appear to be an Emacs mode for this yet --- diff --git a/emacs b/emacs index 14d9b1e..07adea8 100644 --- a/emacs +++ b/emacs @@ -478,7 +478,7 @@ (mapcar (lambda (hook) (add-hook hook 'mdw-misc-mode-config)) '(c-mode-hook c++-mode-hook objc-mode-hook java-mode-hook csharp-mode-hook perl-mode-hook cperl-mode-hook - python-mode-hook awk-mode-hook tcl-mode-hook + python-mode-hook icon-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 @@ -551,6 +551,8 @@ (add-hook 'linux-c-mode-hook #'(lambda () (setq c-basic-offset 8))) (add-hook 'asm-mode-hook 'mdw-fontify-asm t) +(add-hook 'icon-mode-hook 'mdw-fontify-icon t) + (add-hook 'apcalc-mode-hook 'mdw-misc-mode-config t) (add-hook 'apcalc-mode-hook 'mdw-fontify-apcalc t) -- 2.11.0