much love
[mu.git] / editor / subx.el
blob8d92c78e08a6e8505fc205ba76192edab0b7beda
1 ;;; Emacs major mode for editing SubX files. -*- coding: utf-8; lexical-binding: t; -*-
3 ;; Author: Kartik Agaram (subx.el@akkartik.com)
4 ;; Version: 0.0.1
5 ;; Created: 28 Dec 2019
6 ;; Keywords: languages
7 ;; Homepage: https://github.com/akkartik/mu
9 ;;; Commentary:
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
22 ; tests
23 ("^test-[^ ]*:" . font-lock-type-face)
24 ; functions
25 ("^[a-z][^ ]*:" . font-lock-function-name-face)
26 ; globals
27 ("^[A-Z][^ ]*:" . font-lock-variable-name-face)
28 ; minor labels
29 ("^[^a-zA-Z#( ][^ ]*:" . font-lock-doc-face)
30 ; string literals
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)))
44 (provide 'subx-mode)