Project

General

Profile

Syntax highlighting for emacs » History » Version 1

Christopher Backhouse, 04/28/2011 12:32 PM
First version of syntax

1 1 Christopher Backhouse
h1. Syntax highlighting for emacs
2 1 Christopher Backhouse
3 1 Christopher Backhouse
4 1 Christopher Backhouse
(setq fclKeywords
5 1 Christopher Backhouse
 '(
6 1 Christopher Backhouse
   ;; Unfortunately, the comment syntax takes precedence, so this doesn't work
7 1 Christopher Backhouse
   ("#include" . font-lock-keyword-face)
8 1 Christopher Backhouse
   ("@local" . font-lock-keyword-face)
9 1 Christopher Backhouse
   ;; All these names are magic, I think                                        
10 1 Christopher Backhouse
   ("process_name:\\|services:\\|source:\\|outputs:\\|physics\\|producers:\\|filters:\\|analyzers:" . font-lock-builtin-face)
11 1 Christopher Backhouse
   ("true\\|false" . font-lock-builtin-face)
12 1 Christopher Backhouse
   ;; Variable definitions are followed by colons                               
13 1 Christopher Backhouse
   ("[a-zA-Z0-9_]*:" . font-lock-variable-name-face)
14 1 Christopher Backhouse
  )
15 1 Christopher Backhouse
)
16 1 Christopher Backhouse
17 1 Christopher Backhouse
;; Python mode gets us comment handling and indentation at colons               
18 1 Christopher Backhouse
(define-derived-mode fcl-mode python-mode
19 1 Christopher Backhouse
  (setq mode-name "FHICL")
20 1 Christopher Backhouse
  (setq font-lock-defaults '(fclKeywords))
21 1 Christopher Backhouse
;;  (setq tab-width 2) ;; Doesn't seem to work                                  
22 1 Christopher Backhouse
)
23 1 Christopher Backhouse
24 1 Christopher Backhouse
(add-to-list 'auto-mode-alist '("\\.fcl\\'" . fcl-mode))