Initial Commit
[packages] / xemacs-packages / ess / lisp / ess-font-lock.el
1 ;;; ess-font-lock.el -- font-lock color options
2
3 ;; Copyright (C) 2000--2004 A.J. Rossini, Rich M. Heiberger, Martin
4 ;;      Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen.
5
6 ;; Original Author: Richard M. Heiberger <rmh@temple.edu>
7 ;; Created: 06 Feb 2000
8
9 ;; Keywords: ESS, font-lock
10
11 ;; This file is part of ESS
12
13 ;; This file is free software; you can redistribute it and/or modify
14 ;; it under the terms of the GNU General Public License as published by
15 ;; the Free Software Foundation; either version 2, or (at your option)
16 ;; any later version.
17 ;;
18 ;; This file is distributed in the hope that it will be useful,
19 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21 ;; GNU General Public License for more details.
22 ;;
23 ;; You should have received a copy of the GNU General Public License
24 ;; along with GNU Emacs; see the file COPYING.  If not, write to
25 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
26 ;;
27 ;; In short: you may use this code any way you like, as long as you
28 ;; don't charge money for it, remove this notice, or hold anyone liable
29 ;; for its results.
30
31 ;;; Commentary:
32
33 ;; provides syntax highlighting support.
34
35 ;;; Code:
36
37 ; Requires and autoloads
38
39 (require 'font-lock)
40 (require 'paren)
41 (if (fboundp 'show-paren-mode) (show-paren-mode 1))
42
43 ;;; Emacs 20.x notes:
44
45 ;; font-lock faces are defined in /emacs/emacs-20.5/lisp/font-lock.el
46 ;; The font-lock faces are applied to ESS buffers by
47 ;; ess-mode.el ess-inf.el ess-trns.el ess-cust.el
48 ;; The keywords for faces are defined in the ess[dl]*.el files.
49 ;; All faces can be looked at, under Emacs 20.x, with
50 ;;        [menu-bar] [Edit] [Text Properties] [Display Faces}
51
52 ;;; For XEmacs
53
54 ;; ... (tony needs to write something here).
55
56 (defun ess-font-lock-rmh ()
57   "Set font-lock colors to Richard Heiberger's usual choice."
58   (interactive)
59
60   (set-foreground-color "Black")
61   (set-background-color "lightcyan")
62   (set-face-background 'modeline "lightskyblue")
63   (set-face-foreground 'modeline "midnightblue")
64
65   (set-face-foreground 'font-lock-comment-face "Firebrick")
66   (set-face-foreground 'font-lock-function-name-face "Blue")
67   (set-face-foreground 'font-lock-keyword-face "Purple")
68   (if (eq font-lock-reference-face 'font-lock-constant-face )
69       (set-face-foreground 'font-lock-constant-face  "Brown")
70     (set-face-foreground   'font-lock-reference-face "Brown"))
71   (set-face-foreground 'font-lock-string-face "VioletRed")
72   (set-face-foreground 'font-lock-type-face "Sienna")
73   (set-face-foreground 'font-lock-variable-name-face "Black"))
74
75 (defun ess-font-lock-blue ()
76   "Set font-lock colors to Richard Heiberger's blue color scheme."
77   (interactive)
78
79   (set-foreground-color "Black")
80   (set-background-color "LightBlue")
81   (set-face-foreground 'modeline "LightBlue")
82   (set-face-background 'modeline "DarkSlateBlue")
83
84   (set-face-foreground 'font-lock-comment-face "Firebrick")
85   (set-face-foreground 'font-lock-function-name-face "Blue")
86   (set-face-foreground 'font-lock-keyword-face "Purple")
87   (if (eq font-lock-reference-face 'font-lock-constant-face )
88       (set-face-foreground 'font-lock-constant-face  "Brown")
89     (set-face-foreground   'font-lock-reference-face "Brown"))
90   (set-face-foreground 'font-lock-string-face "VioletRed")
91   (set-face-foreground 'font-lock-type-face "Sienna")
92   (set-face-foreground 'font-lock-variable-name-face "Black"))
93
94 (defun ess-font-lock-wheat ()
95   "Set font-lock colors to Richard Heiberger's wheat color scheme."
96   (interactive)
97
98   (set-foreground-color "Black")
99   (set-background-color "Wheat")
100   (set-face-foreground 'modeline "Wheat")
101   (set-face-background 'modeline "Sienna")
102
103   (set-face-foreground 'font-lock-comment-face "Firebrick")
104   (set-face-foreground 'font-lock-function-name-face "Blue")
105   (set-face-foreground 'font-lock-keyword-face "Purple")
106   (if (eq font-lock-reference-face 'font-lock-constant-face )
107       (set-face-foreground 'font-lock-constant-face "Brown")
108     (set-face-foreground 'font-lock-reference-face "Brown"))
109   (set-face-foreground 'font-lock-string-face "VioletRed")
110   (set-face-foreground 'font-lock-type-face "Sienna")
111   (set-face-foreground 'font-lock-variable-name-face "Black"))
112
113
114 (defun ess-font-lock-bw ()
115   "Set font-lock colors to Richard Heiberger's black and white color scheme."
116   (interactive)
117
118   (set-foreground-color "Black")
119   (set-background-color "white")
120   (set-face-foreground 'modeline "gray10")
121   (set-face-background 'modeline "gray90")
122
123   ;; modify-face is an interactive compiled Lisp function in `faces'.
124   ;; Sample usage:
125
126   ;;(modify-face FACE                        FOREGROUND BACKGROUND STIPPLE BOLD-P ITALIC-P UNDERLINE-P &optional INVERSE-P FRAME)
127
128   (modify-face 'modeline                     "gray10"   "gray90"   nil     nil    t        nil       )
129   (modify-face 'font-lock-comment-face       "black"    "white"    nil     nil    t        nil       )
130   (modify-face 'font-lock-function-name-face "black"    "white"    nil     t      nil      nil       )
131   (modify-face 'font-lock-keyword-face       "black"    "white"    nil     nil    nil      t         )
132   (if (eq font-lock-reference-face 'font-lock-constant-face )
133       (modify-face 'font-lock-constant-face  "black"    "white"    nil     t      nil      nil       )
134     (modify-face 'font-lock-reference-face   "black"    "white"    nil     t      nil      nil       ))
135   (modify-face 'font-lock-string-face        "black"    "white"    nil     nil    t        t         )
136   (modify-face 'font-lock-type-face          "black"    "white"    nil     t      t        nil       )
137   (modify-face 'font-lock-variable-name-face "black"    "white"    nil     nil    nil      nil       )
138   (modify-face 'font-lock-builtin-face       "black"    "white"    nil     t      nil      nil       )
139   (modify-face 'font-lock-warning-face       "black"    "white"    nil     t      nil      nil       )
140   (modify-face 'show-paren-match-face        "gray20"   "gray80"   nil     t      nil      nil       )
141   (modify-face 'show-paren-mismatch-face     "white"    "gray40"   nil     t      t        nil       ))
142
143 (defun ess-font-lock-db ()
144   "Set font-lock colors (leave fore-/back-ground alone) courtesy David Brahm <David.Brahm@fmr.com>" 
145   (interactive)
146   (set-face-foreground 'font-lock-comment-face       "Firebrick")  ; #...    %...
147   (set-face-foreground 'font-lock-string-face        "SeaGreen")   ; "..."   "..."
148   (set-face-foreground 'font-lock-keyword-face       "MediumBlue") ; if      \end
149   (set-face-foreground 'font-lock-function-name-face "VioletRed")  ; talk<-  {center}
150   (set-face-foreground 'font-lock-variable-name-face "Blue")       ; xv
151   (set-face-foreground 'font-lock-type-face          "Goldenrod")  ; T,F       ?
152   (if (eq font-lock-reference-face 'font-lock-constant-face )
153       (set-face-foreground 'font-lock-constant-face "Magenta")     ; <-      {eq1}
154     (set-face-foreground 'font-lock-reference-face "Magenta"))
155 )
156
157 (provide 'ess-font-lock)
158
159 \f ; Local variables section
160
161 ;;; This file is automatically placed in Outline minor mode.
162 ;;; The file is structured as follows:
163 ;;; Chapters:     ^L ;
164 ;;; Sections:    ;;*;;
165 ;;; Subsections: ;;;*;;;
166 ;;; Components:  defuns, defvars, defconsts
167 ;;;              Random code beginning with a ;;;;* comment
168 ;;; Local variables:
169 ;;; mode: emacs-lisp
170 ;;; mode: outline-minor
171 ;;; outline-regexp: "\^L\\|\\`;\\|;;\\*\\|;;;\\*\\|(def[cvu]\\|(setq\\|;;;;\\*"
172 ;;; End:
173
174 ;;; ess-font-lock.el ends here