1 ;;; Emacs major mode for editing SubX files. -*- coding: utf-8; lexical-binding: t; -*-
3 ;; Author: Kartik Agaram (subx.el@akkartik.com)
5 ;; Created: 28 Dec 2019
7 ;; Homepage: https://github.com/akkartik/mu
11 ;; I don't know how to define new faces in an emacs package, so I'm
12 ;; cannibalizing existing faces.
14 ;; I load this file like so in my .emacs:
15 ;; (load "/absolute/path/to/subx.el")
16 ;; (add-to-list 'auto-mode-alist '("\\.subx" . subx-mode))
18 ;; Education on the right way to do this most appreciated.
20 (setq subx-font-lock-keywords
23 ("^test-[^ ]*:" . font-lock-type-face
)
25 ("^[a-z][^ ]*:" . font-lock-function-name-face
)
27 ("^[A-Z][^ ]*:" . font-lock-variable-name-face
)
29 ("^[^a-zA-Z#( ][^ ]*:" . font-lock-doc-face
)
31 ; ("\"[^\"]*\"" . font-lock-constant-face) ; strings colorized already, albeit buggily
32 ; 4 colors for comments; ugly but functional
33 ("# \\. \\. .*" . font-lock-doc-face
)
34 ("# \\. .*" . font-lock-constant-face
)
35 ("# - .*" . font-lock-comment-face
)
36 ("#.*" . font-lock-preprocessor-face
)
39 (define-derived-mode subx-mode fundamental-mode
"subx mode"
40 "Major mode for editing SubX (Mu project)"
41 (setq font-lock-defaults
'((subx-font-lock-keywords)))