Created
March 9, 2012 21:32
-
-
Save tibbe/2008814 to your computer and use it in GitHub Desktop.
Cmm major mode that doesn't work
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defvar cmm-mode-hook nil) | |
(add-to-list 'auto-mode-alist '("\\.cmm\\'" . cmm-mode)) | |
(defvar cmm-keywords | |
'("aborts" "align" "aligned" "also" "as" "big" "bits" "byteorder" "case" | |
"const," "continuation" "cut" "cuts" "else" "equal" "export" "foreign" | |
"goto" "if" "import" "in," "invariant" "invisible" "jump" "little" "memsize" | |
"pragma" "reads" "register," "return" "returns" "section" "semi" "span" | |
"stackdata" "switch" "target" "targets" "to," "typedef" "unicode" "unwinds" | |
"writes") | |
"Cmm keywords.") | |
(defvar cmm-keywords-regexp (regexp-opt cmm-keywords 'words)) | |
;; (setq cmm-keywords nil) | |
(setq cmm-font-lock-keywords | |
`( | |
(,cmm-keywords-regexp . font-lock-keyword-face) | |
)) | |
(defvar cmm-mode-syntax-table | |
(let ((st (make-syntax-table))) | |
(modify-syntax-entry ?/ ". 124b" st) | |
(modify-syntax-entry ?* ". 23" st) | |
(modify-syntax-entry ?\n "> b" st) | |
st) | |
"Syntax table for cmm-mode") | |
;; define the mode | |
(define-derived-mode cmm-mode fundamental-mode | |
"Cmm" | |
"A major mode for editing Cmm files." | |
;; code for syntax highlighting | |
(setq font-lock-defaults '((cmm-font-lock-keywords))) | |
;; clear memory | |
(setq cmm-keywords-regexp nil)) | |
(provide 'cmm-mode) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment