*** empty log message ***
[ess.git] / lisp / ess-font-lock.el
blob33849dc0474c16f6630500a08a4ce1e2d755c868
1 ;;; ess-font-lock.el -- font-lock color options
3 ;; Copyright (C) 2000--2004 A.J. Rossini, Rich M. Heiberger, Martin
4 ;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen.
6 ;; Original Author: Richard M. Heiberger <rmh@temple.edu>
7 ;; Created: 06 Feb 2000
9 ;; Keywords: ESS, font-lock
11 ;; This file is part of ESS
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.
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.
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.
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.
31 ;;; Commentary:
33 ;; provides syntax highlighting support.
35 ;;; Code:
37 ; Requires and autoloads
39 (require 'font-lock)
40 (require 'paren)
41 (if (fboundp 'show-paren-mode) (show-paren-mode 1))
43 ;;; Emacs 20.x notes:
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}
52 ;;; For XEmacs
54 ;; ... (tony needs to write something here).
56 (defun ess-font-lock-rmh ()
57 "Set font-lock colors to Richard Heiberger's usual choice."
58 (interactive)
60 (set-foreground-color "Black")
61 (set-background-color "lightcyan")
62 (set-face-background 'modeline "lightskyblue")
63 (set-face-foreground 'modeline "midnightblue")
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"))
75 (defun ess-font-lock-blue ()
76 "Set font-lock colors to Richard Heiberger's blue color scheme."
77 (interactive)
79 (set-foreground-color "Black")
80 (set-background-color "LightBlue")
81 (set-face-foreground 'modeline "LightBlue")
82 (set-face-background 'modeline "DarkSlateBlue")
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"))
94 (defun ess-font-lock-wheat ()
95 "Set font-lock colors to Richard Heiberger's wheat color scheme."
96 (interactive)
98 (set-foreground-color "Black")
99 (set-background-color "Wheat")
100 (set-face-foreground 'modeline "Wheat")
101 (set-face-background 'modeline "Sienna")
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"))
114 (defun ess-font-lock-bw ()
115 "Set font-lock colors to Richard Heiberger's black and white color scheme."
116 (interactive)
118 (set-foreground-color "Black")
119 (set-background-color "white")
120 (set-face-foreground 'modeline "gray10")
121 (set-face-background 'modeline "gray90")
123 ;; modify-face is an interactive compiled Lisp function in `faces'.
124 ;; Sample usage:
126 ;;(modify-face FACE FOREGROUND BACKGROUND STIPPLE BOLD-P ITALIC-P UNDERLINE-P &optional INVERSE-P FRAME)
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 ))
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"))
157 (provide 'ess-font-lock)
159 \f ; Local variables section
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:
174 ;;; ess-font-lock.el ends here