Skip to content

Instantly share code, notes, and snippets.

@kazeto
Last active November 27, 2016 23:56
Show Gist options
  • Save kazeto/07646f56abf4a954068e66cc717a5f01 to your computer and use it in GitHub Desktop.
Save kazeto/07646f56abf4a954068e66cc717a5f01 to your computer and use it in GitHub Desktop.
A Emacs major mode for Tuffy.
;;; -------- Tuffy mode --------
(define-derived-mode
tuffy-mode text-mode
"Tuffy" "View mode for Tuffy's input file."
(setq tuffy-font-lock-keywords
'(("//.*$" . font-lock-comment-face)
("!" . font-lock-warning-face)
("\\(\"[^\"]*\"\\)\\s-*," 1 font-lock-string-face)
("\\(\"[^\"]*\"\\)\\s-*)" 1 font-lock-string-face)
(" v " . font-lock-constant-face)
(" ^ " . font-lock-constant-face)
(" => " . font-lock-constant-face)
("\\*" . font-lock-constant-face)
(")\\(\\s-*,\\)" 1 font-lock-constant-face)
("^[0-9.]+\\s-" . font-lock-variable-name-face)
("[.]$" . font-lock-variable-name-face)))
(setq font-lock-defaults
'(tuffy-font-lock-keywords t t nil nil))
(add-hook 'tuffy-mode-hook 'turn-on-font-lock))
(add-to-list 'auto-mode-alist '("\\.mln$" . tuffy-mode))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment