Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
2701 views
1
;;; ess-font-lock.el --- font-lock color options
2
3
;; Copyright (C) 2000--2006 A.J. Rossini, Richard M. Heiberger, Martin
4
;; Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen.
5
6
;; Author: Richard M. Heiberger <[email protected]>
7
;; Created: 06 Feb 2000
8
9
;; Keywords: languages, faces
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
;; A copy of the GNU General Public License is available at
24
;; http://www.r-project.org/Licenses/
25
26
;;; Commentary:
27
28
;; provides syntax highlighting support.
29
30
;;; Code:
31
32
; Requires and autoloads
33
34
(require 'font-lock)
35
(require 'paren)
36
(if (fboundp 'show-paren-mode) (show-paren-mode 1))
37
38
;;; Emacs 20.x notes:
39
40
;; font-lock faces are defined in /emacs/emacs-20.5/lisp/font-lock.el
41
;; The font-lock faces are applied to ESS buffers by
42
;; ess-mode.el ess-inf.el ess-trns.el ess-custom.el
43
;; The keywords for faces are defined in the ess[dl]*.el files.
44
;; All faces can be looked at, under Emacs 20.x, with
45
;; [menu-bar] [Edit] [Text Properties] [Display Faces}
46
47
;;; For XEmacs
48
49
;; ... (tony needs to write something here).
50
51
(defun ess-font-lock-rmh ()
52
"Set font-lock colors to Richard Heiberger's usual choice."
53
(interactive)
54
55
(if (featurep 'xemacs) nil
56
(set-foreground-color "Black")
57
(set-background-color "lightcyan"))
58
59
(set-face-background 'modeline "lightskyblue")
60
(set-face-foreground 'modeline "midnightblue")
61
62
(set-face-foreground 'font-lock-comment-face "Firebrick")
63
(set-face-foreground 'font-lock-function-name-face "Blue")
64
(set-face-foreground 'font-lock-keyword-face "Purple")
65
(set-face-foreground 'font-lock-constant-face "Brown")
66
(set-face-foreground 'font-lock-string-face "VioletRed")
67
(set-face-foreground 'font-lock-type-face "Sienna")
68
(set-face-foreground 'font-lock-variable-name-face "Black"))
69
70
(defun ess-font-lock-blue ()
71
"Set font-lock colors to Richard Heiberger's blue color scheme."
72
(interactive)
73
74
(if (featurep 'xemacs) nil
75
(set-foreground-color "Black")
76
(set-background-color "LightBlue"))
77
78
(set-face-foreground 'modeline "LightBlue")
79
(set-face-background 'modeline "DarkSlateBlue")
80
81
(set-face-foreground 'font-lock-comment-face "Firebrick")
82
(set-face-foreground 'font-lock-function-name-face "Blue")
83
(set-face-foreground 'font-lock-keyword-face "Purple")
84
(set-face-foreground 'font-lock-constant-face "Brown")
85
(set-face-foreground 'font-lock-string-face "VioletRed")
86
(set-face-foreground 'font-lock-type-face "Sienna")
87
(set-face-foreground 'font-lock-variable-name-face "Black"))
88
89
(defun ess-font-lock-wheat ()
90
"Set font-lock colors to Richard Heiberger's wheat color scheme."
91
(interactive)
92
93
(if (featurep 'xemacs) nil
94
(set-foreground-color "Black")
95
(set-background-color "Wheat"))
96
97
(set-face-foreground 'modeline "Wheat")
98
(set-face-background 'modeline "Sienna")
99
100
(set-face-foreground 'font-lock-comment-face "Firebrick")
101
(set-face-foreground 'font-lock-function-name-face "Blue")
102
(set-face-foreground 'font-lock-keyword-face "Purple")
103
(set-face-foreground 'font-lock-constant-face "Brown")
104
(set-face-foreground 'font-lock-string-face "VioletRed")
105
(set-face-foreground 'font-lock-type-face "Sienna")
106
(set-face-foreground 'font-lock-variable-name-face "Black"))
107
108
109
(defun ess-font-lock-bw ()
110
"Set font-lock colors to Richard Heiberger's black and white color scheme."
111
(interactive)
112
113
(if (featurep 'xemacs) nil
114
(set-foreground-color "Black")
115
(set-background-color "white"))
116
117
(set-face-foreground 'modeline "gray10")
118
(set-face-background 'modeline "gray90")
119
120
;; modify-face is an interactive compiled Lisp function in `faces'.
121
;; Sample usage:
122
123
;;(modify-face FACE FOREGROUND BACKGROUND STIPPLE BOLD-P ITALIC-P UNDERLINE-P &optional INVERSE-P FRAME)
124
125
(modify-face 'modeline "gray10" "gray90" nil nil t nil )
126
(modify-face 'font-lock-comment-face "black" "white" nil nil t nil )
127
(modify-face 'font-lock-function-name-face "black" "white" nil t nil nil )
128
(modify-face 'font-lock-keyword-face "black" "white" nil nil nil t )
129
(modify-face 'font-lock-constant-face "black" "white" nil t nil nil )
130
(modify-face 'font-lock-string-face "black" "white" nil nil t t )
131
(modify-face 'font-lock-type-face "black" "white" nil t t nil )
132
(modify-face 'font-lock-variable-name-face "black" "white" nil nil nil nil )
133
(modify-face 'font-lock-builtin-face "black" "white" nil t nil nil )
134
(modify-face 'font-lock-warning-face "black" "white" nil t nil nil )
135
(modify-face 'show-paren-match-face "gray20" "gray80" nil t nil nil )
136
(modify-face 'show-paren-mismatch-face "white" "gray40" nil t t nil ))
137
138
(defun ess-font-lock-db ()
139
"Set font-lock colors (leave fore-/back-ground alone) courtesy David Brahm <[email protected]>"
140
(interactive)
141
(set-face-foreground 'font-lock-comment-face "Firebrick") ; #... %...
142
(set-face-foreground 'font-lock-string-face "SeaGreen") ; "..." "..."
143
(set-face-foreground 'font-lock-keyword-face "MediumBlue") ; if \end
144
(set-face-foreground 'font-lock-function-name-face "VioletRed") ; talk<- {center}
145
(set-face-foreground 'font-lock-variable-name-face "Blue") ; xv
146
(set-face-foreground 'font-lock-type-face "Goldenrod") ; T,F ?
147
(set-face-foreground 'font-lock-constant-face "Magenta") ; <- {eq1}
148
)
149
150
(provide 'ess-font-lock)
151
152
; Local variables section
153
154
;;; This file is automatically placed in Outline minor mode.
155
;;; The file is structured as follows:
156
;;; Chapters: ^L ;
157
;;; Sections: ;;*;;
158
;;; Subsections: ;;;*;;;
159
;;; Components: defuns, defvars, defconsts
160
;;; Random code beginning with a ;;;;* comment
161
;;; Local variables:
162
;;; mode: emacs-lisp
163
;;; mode: outline-minor
164
;;; outline-regexp: "\^L\\|\\`;\\|;;\\*\\|;;;\\*\\|(def[cvu]\\|(setq\\|;;;;\\*"
165
;;; End:
166
167
;;; ess-font-lock.el ends here
168
169