-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathcatt-mode.el
More file actions
50 lines (42 loc) · 1.52 KB
/
catt-mode.el
File metadata and controls
50 lines (42 loc) · 1.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
;; catt-mode.el -- CATT major emacs mode
(defvar catt-font-lock-keywords
'(
("#.*" . 'font-lock-comment-face)
("\\<\\(let\\|coh\\|cylcoh\\|normalize\\|assert\\)\\>" . font-lock-keyword-face)
("\\<\\(U\\|Cat\\)\\>" . font-lock-builtin-face)
("\\<let[ \t]+\\([^ (=]*\\)" 1 'font-lock-function-name-face)
("\\<coh[ \t]+\\([^ (]*\\)" 1 'font-lock-function-name-face)
("\\<cylcoh[ \t]+\\([^ (]*\\)" 1 'font-lock-function-name-face)
)
)
(defvar catt-mode-syntax-table
(let ((st (make-syntax-table)))
;; Allow some extra characters in words
(modify-syntax-entry ?_ "w" st)
;; Comments
(modify-syntax-entry ?# "<" st)
(modify-syntax-entry ?\n ">" st)
st)
"Syntax table for CATT major mode.")
(defvar catt-tab-width 4)
(defvar catt-mode-hook nil)
(defvar catt-mode-map nil "Keymap for catt-mode")
(progn
(setq catt-mode-map (make-sparse-keymap))
(define-key catt-mode-map (kbd "C-c C-c") `compile)
)
(define-derived-mode catt-mode prog-mode
"Catt" "Major mode for Catt files."
:syntax-table catt-mode-syntax-table
(set (make-local-variable 'comment-start) "#")
(set (make-local-variable 'comment-start-skip) "#+\\s-*")
(set (make-local-variable 'font-lock-defaults) '(catt-font-lock-keywords))
(set (make-local-variable 'compile-command)
(concat "catt " (shell-quote-argument buffer-file-name)))
(use-local-map catt-mode-map)
(setq mode-name "Catt")
(run-hooks 'catt-mode-hook)
)
(provide 'catt-mode)
;;;###autoload
(add-to-list 'auto-mode-alist '("\\.catt\\'" . catt-mode))