Basic major mode for editing Adnot data files
Getty Ritter
9 years ago
| 1 | ;; adnot-mode.el --- a simple major mode for editing Adnot files. | |
| 2 | ||
| 3 | ;; Version: 20160402.0000 | |
| 4 | ;; Author: Getty Ritter | |
| 5 | ;; Url: http://github.com/aisamanra/adnot-mode | |
| 6 | ||
| 7 | (setq adnot-font-lock | |
| 8 | '(( "\"\\([^\\]\\|\\\\[\\\"]\\)*\"" | |
| 9 | . font-lock-string-face ) | |
| 10 | ( "(\\([ \n\t\r]*[A-Za-z_][A-Za-z0-9_]*\\)" | |
| 11 | 1 font-lock-keyword-face ) | |
| 12 | ( "\\([A-Za-z][A-Za-z0-9_]*\\)" | |
| 13 | . font-lock-variable-name-face ))) | |
| 14 | ||
| 15 | (defvar adnot-syntax-table nil "Syntax table for `adnot-mode'.") | |
| 16 | (setq adnot-syntax-table | |
| 17 | (let ((table (make-syntax-table))) | |
| 18 | (modify-syntax-entry ?# "< b" table) | |
| 19 | (modify-syntax-entry ?\n "> b" table) | |
| 20 | ||
| 21 | table)) | |
| 22 | ||
| 23 | (define-derived-mode adnot-mode prog-mode | |
| 24 | "Adnot mode is a major mode for editing Adnot files" | |
| 25 | :syntax-table adnot-syntax-table | |
| 26 | ||
| 27 | (setq font-lock-defaults '(adnot-font-lock)) | |
| 28 | (setq mode-name "Adnot mode") | |
| 29 | (setq comment-start "#") | |
| 30 | (setq comment-end "")) | |
| 31 | ||
| 32 | ;;;###autoload | |
| 33 | (add-to-list 'auto-mode-alist '("\\.adnot\\'" . adnot-mode)) | |
| 34 | ||
| 35 | (provide 'adnot-mode) | |
| 36 | ||
| 37 | ;;; adnot-mode.el ends here |