;; ;; emacs lisp file for CIF major mode ;; ;; Cobbled together by Martyn Winn, June 1998 ;; Will expand it as I actually use it .... ;; ;; Can be loaded in several ways: ;; 1) M-x load-file RET ~/cif.el ;; 2) Put the line (load "~/cif.el" t) in the .emacs file ;; ;; N.B. you may need following lines in .emacs to get colours: ;; ;; (global-font-lock-mode t) ;turn on Font Lock mode automatically in all modes ;; (setq font-lock-maximum-size nil) ;no buffer too large! ;; ;; Some bits copied from fortran.el, shell.el, etc. (defconst cif-mode-version "version 0.1") ; Activate cif-mode for file endings .cif (setq auto-mode-alist (cons '("\\.cif\\'" . cif-mode) auto-mode-alist)) ; Identify different components of CIF file (defvar cif-comment "#.*" "Regexp to match comment in cif file.") (defvar star-keyword "^[ \t]*data_.*\\|^[ \t]*loop_" "Regexp to match star keyword in cif file.") (defvar cif-item "[ \t\n]_[^ \t\n]*" "Regexp to match item name in cif file.") ; Tie components to particular faces (defvar cif-font-lock-defaults (list (cons cif-comment 'font-lock-comment-face) (cons star-keyword 'font-lock-keyword-face) (cons cif-item 'font-lock-variable-name-face)) "doc") ; Set attributes of faces: doesn't work!!! (defvar cif-font-lock-face-attributes '((font-lock-comment-face "OrangeRed" nil nil nil nil nil) (font-lock-string-face "LightSalmon" nil nil nil nil nil) (font-lock-keyword-face "LightSteelBlue" nil nil nil nil nil) (font-lock-function-name-face "LightSkyBlue" nil nil nil nil nil) (font-lock-variable-name-face "LightGoldenrod" nil nil nil nil nil) (font-lock-type-face "PaleGreen" nil nil nil nil nil) (font-lock-reference-face "Aquamarine" nil nil nil nil nil)) "doc") ; Specify cif-mode itself (defun cif-mode () "Put some documentation here!" (interactive) (kill-all-local-variables) (setq mode-name "CIF") (setq major-mode 'cif-mode) (make-local-variable 'font-lock-defaults) (setq font-lock-defaults '(cif-font-lock-defaults t)) (modify-face font-lock-comment-face "Cyan" nil nil nil nil nil) )