; ora-mode starts here ; simple font-lock mode for o'reilly text file ; version 0.2 ; ;;; Copyright (C) 2001 Frédéric Laurent ;;; ;;; This program is free software; you can redistribute it and/or ;;; modify it under the terms of the GNU General Public License ;;; as published by the Free Software Foundation; either version 2 ;;; of the License, or (at your option) any later version. ;;; ;;; This program is distributed in the hope that it will be useful, ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;; GNU General Public License for more details. ;;; ;;; You should have received a copy of the GNU General Public License ;;; along with this program; if not, write to the Free Software ;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ;;; ;;; mailto:frederic.laurent@opikanoba.org ; ; To install, put this in your .emacs: ; ;(autoload 'ora-mode "ora-mode") ;(setq auto-mode-alist ; (cons '("\\.ora\\'" . ora-mode) auto-mode-alist)) ; ; 5/12/01 - change colors ; - add [_Number_] statement colorization ; 9/12/01 - add SIDEBAR and TIP support ; ; special thanks to Christophe Delarue, an emacs master ;-) (defvar ora-version "0.10" "The current version number of ora-mode.") (require 'font-lock) (require 'cl) (defface index-face '((((class color) (background dark)) (:foreground "yellow")) (((class color) (background light)) (:foreground "DarkGray" :italic t)) (t (:bold t))) "Font Lock mode face used to index keywords." :group 'font-lock-highlighting-faces) (defface kw-face '((((class color) (background dark)) (:foreground "green")) (((class color) (background light)) (:foreground "#0039A1")) (t (:bold t))) "Font Lock mode face used to highlight special keywords." :group 'font-lock-highlighting-faces) (defface code-face '((((class color) (background dark)) (:foreground "green")) (((class color) (background light)) (:foreground "#D28A00")) (t (:bold t))) "Font Lock mode face used to highlight special keywords." :group 'font-lock-highlighting-faces) (defface title-face '((((class color) (background dark)) (:foreground "green")) (((class color) (background light)) (:foreground "black" :bold t)) (t (:bold t))) "Font Lock mode face used to highlight special keywords." :group 'font-lock-highlighting-faces) (defface paragraph-face '((((class color) (background dark)) (:foreground "green")) (((class color) (background light)) (:foreground "#006D38" :bold t)) (t (:bold t))) "Font Lock mode face used to highlight paragraph keywords." :group 'font-lock-highlighting-faces) (defface note-face '((((class color) (background dark)) (:foreground "green")) (((class color) (background light)) (:foreground "IndianRed4" :italic t)) (t (:bold t))) "Font Lock mode face used to highlight paragraph keywords." :group 'font-lock-highlighting-faces) (defvar index-face 'index-face "Face for index statement.") (defvar kw-face 'kw-face "*Face [] statement.") (defvar code-face 'code-face "*Face for code|cell statement.") (defvar title-face 'title-face "*Face for title A|B|C statement.") (defvar paragraph-face 'paragraph-face "*Face for paragraph statement (Body,Bullet,...).") (defvar note-face 'note-face "*Face for sidebar statement (SIDEBAR).") (defvar ora-font-lock-keywords (list '("\\[_\\(Body\\|Bullet\\|COLHEAD\\|TERM\\|DEFINITION\\|LIST\\|Number\\)+_\\]" 0 paragraph-face t) '("\\[_\\(Code\\|CODE\\|CELL\\|CAPTION\\|COLHEAD\\)+_\\].*$" 0 code-face t) '("\\[_\\(A\\|B\\|C\\)+_\\].*$" 0 title-face t) '("{_Ftn[^}]+_}" 0 font-lock-comment-face t) '("{_XRef[^}]+_}" 0 font-lock-builtin-face t) '("\\[_F\\(i\\|c\\|cb\\|ci\\)?_\\][^\\[]*\\[_F_\\]" 0 kw-face) '("{_Index\\s-+\\({_\\(StartRange\\|EndRange\\)?_}\\)?\\([^_]\\)*_}" 0 index-face t) '("##[^#]+##" 0 font-lock-warning-face t) '("\\[_\\(SIDEBAR\\|TIP\\)+_\\].*$" 0 note-face t) ) "Rules for highlighting ORA style sheets.") (defun ora-mode() "Major mode for editing ORA docs." (interactive) ; Initializing (kill-all-local-variables) ; Setting up font-locking (make-local-variable 'font-lock-defaults) (setq font-lock-defaults '(ora-font-lock-keywords)) ; Final stuff, then we're done (setq mode-name "ORA" major-mode 'ora-mode) (run-hooks 'ora-mode-hook)) (provide 'ora-mode) ;; ora-mode ends here