;;; obj-mode.el --- Major mode for editing X-Plane scenery files ;; Copyright (C) 2004, 2006, 2008 Jonathan Harris ;; Author: Jonathan Harris ;;; Add following lines (un-commented) to your `.emacs' or ;;; `.xemacs/init.el' file and put obj-mode.el somewhere on your ;;; load-path to take advantage of obj-mode. ;;; (autoload 'obj-mode "obj-mode" ;;; "Major mode for editing X-Plane OBJ files" t) ;;; (setq auto-mode-alist ;;; (append '(("\\.obj\\'" . obj-mode)) ;;; auto-mode-alist)) ;;; You may also want to byte-compile obj-mode.el to improve performance. ;;; Try evaluating the following form: ;;; (byte-compile-file (locate-library "obj-mode.el")) (require 'font-lock) (provide 'obj-mode) (defconst obj-comment-regexp "\\(//\\|^\\s-*#\\).*" "X-Plane OBJ comment REGEXP") (defconst obj-keyword-regexp (concat "^\\(OBJ\\|700\\|800\\|99\\|-?[1-8]\\|\\s-*\\(" (mapconcat 'identity '( "end" "light" "line" "tri" "quad" "quad_hard" "smoke_black" "smoke_white" "quad_movie" "polygon" "quad_strip" "quad_cockpit" "tri_strip" "tri_fan" "ATTR_shade_flat" "ATTR_shade_smooth" "ATTR_ambient_rgb" "ATTR_difuse_rgb" "ATTR_diffuse_rgb" "ATTR_specular_rgb" "ATTR_emission_rgb" "ATTR_shiny_rat" "ATTR_no_depth" "ATTR_depth" "ATTR_LOD" "ATTR_no_cull" "ATTR_cull" "ATTR_poly_os" "ATTR_reset" ; v8 "TEXTURE" "TEXTURE_LIT" "POINT_COUNTS" "slung_load_weight" "VT" "VLINE" "VLIGHT" "IDX" "IDX10" "TRIS" "LINES" "LIGHTS" "ATTR_hard" "ATTR_no_hard" "ATTR_cockpit" "ATTR_no_cockpit" "ATTR_blend" "ATTR_no_blend" "ANIM_begin" "ANIM_end" "ANIM_rotate" "ANIM_trans" ; v8.5 "LIGHT_NAMED" "LIGHT_CUSTOM" "ATTR_layer_group" "ANIM_show" "ANIM_hide" ; v9 "ANIM_trans_begin" "ANIM_trans_key" "ANIM_trans_end" "ANIM_rotate_begin" "ANIM_rotate_key" "ANIM_rotate_end" "ANIM_keyframe_loop" "ATTR_cockpit_region" "ATTR_hard_deck" "COCKPIT_REGION" ) "\\|") "\\)\\)\\( \\|\t\\|$\\)+") "internal use") (defconst obj-font-lock-keywords ;;; (purecopy (list (cons obj-comment-regexp 'font-lock-comment-face) (cons obj-keyword-regexp 'font-lock-keyword-face) ) ;;;) "Major mode for editing X-Plane OBJ files.") ;###autoload ;(defun obj-mode () ; (interactive) ; "Major mode for editing X-Plane OBJ files." ; ) ;;;###autoload (define-derived-mode obj-mode text-mode "obj-mode" "Major mode for editing X-Plane OBJ files.\nDerived from text-mode." (delete ".obj" completion-ignored-extensions) (set (make-local-variable 'comment-start) "\(//|#\) ") (set (make-local-variable 'comment-end) "") (set (make-local-variable 'comment-start-skip) "^\\(\\s-*\\)//\\s-*") (setq font-lock-keywords obj-font-lock-keywords) ;(setq font-lock-keywords-case-fold-search nil) (if (and (boundp 'font-lock-auto-fontify) font-lock-auto-fontify) (font-lock-mode 1)) (run-hooks 'obj-mode-hook) ) ;;; obj-mode.el ends here