File: ess-font-lock.el

package info (click to toggle)
ess 18.10.2-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 6,620 kB
  • sloc: lisp: 30,716; sh: 1,503; makefile: 381; asm: 170
file content (151 lines) | stat: -rw-r--r-- 6,336 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
;;; ess-font-lock.el --- font-lock color options

;; Copyright (C) 2000--2006 A.J. Rossini, Richard M. Heiberger, Martin
;;      Maechler, Kurt Hornik, Rodney Sparapani, and Stephen Eglen.

;; Author: Richard M. Heiberger <rmh@temple.edu>
;; Created: 06 Feb 2000

;; Keywords: languages, faces

;; This file is part of ESS

;; This file 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, or (at your option)
;; any later version.
;;
;; This file 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.
;;
;; A copy of the GNU General Public License is available at
;; https://www.r-project.org/Licenses/

;;; Commentary:

;; provides syntax highlighting support.

;;; Code:

                                        ; Requires and autoloads

(require 'font-lock)
(require 'paren)

;; FIXME: What is this doing here!?
(if (fboundp 'show-paren-mode) (show-paren-mode 1))

;;; Emacs 20.x notes:

;; font-lock faces are defined in /emacs/emacs-20.5/lisp/font-lock.el
;; The font-lock faces are applied to ESS buffers by
;; ess-mode.el ess-inf.el ess-trns.el ess-custom.el
;; The keywords for faces are defined in the ess[dl]*.el files.
;; All faces can be looked at, under Emacs 20.x, with
;;        [menu-bar] [Edit] [Text Properties] [Display Faces}

(defun ess-font-lock-rmh ()
  "Set font-lock colors to Richard Heiberger's usual choice."
  ;; FIXME: Turn it into a Custom theme!
  (interactive)

  (set-foreground-color "Black")
  (set-background-color "lightcyan")

  (set-face-background 'mode-line "lightskyblue")
  (set-face-foreground 'mode-line "midnightblue")

  (set-face-foreground 'font-lock-comment-face "Firebrick")
  (set-face-foreground 'font-lock-function-name-face "Blue")
  (set-face-foreground 'font-lock-keyword-face "Purple")
  (set-face-foreground 'font-lock-constant-face "Brown")
  (set-face-foreground 'font-lock-string-face "VioletRed")
  (set-face-foreground 'font-lock-type-face "Sienna")
  (set-face-foreground 'font-lock-variable-name-face "Black"))

(defun ess-font-lock-blue ()
  "Set font-lock colors to Richard Heiberger's blue color scheme."
  ;; FIXME: Turn it into a Custom theme!
  (interactive)

  (set-foreground-color "Black")
  (set-background-color "LightBlue")

  (set-face-foreground 'mode-line "LightBlue")
  (set-face-background 'mode-line "DarkSlateBlue")

  (set-face-foreground 'font-lock-comment-face "Firebrick")
  (set-face-foreground 'font-lock-function-name-face "Blue")
  (set-face-foreground 'font-lock-keyword-face "Purple")
  (set-face-foreground 'font-lock-constant-face "Brown")
  (set-face-foreground 'font-lock-string-face "VioletRed")
  (set-face-foreground 'font-lock-type-face "Sienna")
  (set-face-foreground 'font-lock-variable-name-face "Black"))

(defun ess-font-lock-wheat ()
  "Set font-lock colors to Richard Heiberger's wheat color scheme."
  ;; FIXME: Turn it into a Custom theme!
  (interactive)

  (set-foreground-color "Black")
  (set-background-color "Wheat")

  (set-face-foreground 'mode-line "Wheat")
  (set-face-background 'mode-line "Sienna")

  (set-face-foreground 'font-lock-comment-face "Firebrick")
  (set-face-foreground 'font-lock-function-name-face "Blue")
  (set-face-foreground 'font-lock-keyword-face "Purple")
  (set-face-foreground 'font-lock-constant-face "Brown")
  (set-face-foreground 'font-lock-string-face "VioletRed")
  (set-face-foreground 'font-lock-type-face "Sienna")
  (set-face-foreground 'font-lock-variable-name-face "Black"))


(defun ess-font-lock-bw ()
  "Set font-lock colors to Richard Heiberger's black and white color scheme."
  ;; FIXME: Turn it into a Custom theme!
  (interactive)

  (set-foreground-color "Black")
  (set-background-color "white")

  (set-face-foreground 'mode-line "gray10")
  (set-face-background 'mode-line "gray90")

  ;; modify-face is an interactive compiled Lisp function in `faces'.
  ;; Sample usage:

  ;;(modify-face FACE                        FOREGROUND BACKGROUND STIPPLE BOLD-P ITALIC-P UNDERLINE-P &optional INVERSE-P FRAME)

  (modify-face 'mode-line                     "gray10"   "gray90"   nil     nil    t        nil       )
  (modify-face 'font-lock-comment-face       "black"    "white"    nil     nil    t        nil       )
  (modify-face 'font-lock-function-name-face "black"    "white"    nil     t      nil      nil       )
  (modify-face 'font-lock-keyword-face       "black"    "white"    nil     nil    nil      t         )
  (modify-face 'font-lock-constant-face      "black"    "white"    nil     t      nil      nil       )
  (modify-face 'font-lock-string-face        "black"    "white"    nil     nil    t        t         )
  (modify-face 'font-lock-type-face          "black"    "white"    nil     t      t        nil       )
  (modify-face 'font-lock-variable-name-face "black"    "white"    nil     nil    nil      nil       )
  (modify-face 'font-lock-builtin-face       "black"    "white"    nil     t      nil      nil       )
  (modify-face 'font-lock-warning-face       "black"    "white"    nil     t      nil      nil       )
  (modify-face 'show-paren-match-face        "gray20"   "gray80"   nil     t      nil      nil       )
  (modify-face 'show-paren-mismatch-face     "white"    "gray40"   nil     t      t        nil       ))

(defun ess-font-lock-db ()
  "Set font-lock colors (leave fore-/back-ground alone) courtesy David Brahm <David.Brahm@fmr.com>"
  ;; FIXME: Turn it into a Custom theme!
  (interactive)
  (set-face-foreground 'font-lock-comment-face       "Firebrick")  ; #...    %...
  (set-face-foreground 'font-lock-string-face        "SeaGreen")   ; "..."   "..."
  (set-face-foreground 'font-lock-keyword-face       "MediumBlue") ; if      \end
  (set-face-foreground 'font-lock-function-name-face "VioletRed")  ; talk<-  {center}
  (set-face-foreground 'font-lock-variable-name-face "Blue")       ; xv
  (set-face-foreground 'font-lock-type-face          "Goldenrod")  ; T,F       ?
  (set-face-foreground 'font-lock-constant-face      "Magenta")    ; <-      {eq1}
  )

(provide 'ess-font-lock)

;;; ess-font-lock.el ends here