[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] externals/caml da654aa 179/197: Emacs: Modernise font face defi
From: |
Stefan Monnier |
Subject: |
[nongnu] externals/caml da654aa 179/197: Emacs: Modernise font face definitions |
Date: |
Sat, 21 Nov 2020 01:20:02 -0500 (EST) |
branch: externals/caml
commit da654aaa2d2fc5c63719b3e439acc21f0f0b13c6
Author: Wilfred Hughes <me@wilfred.me.uk>
Commit: Wilfred Hughes <me@wilfred.me.uk>
Emacs: Modernise font face definitions
make-face is a low-level primitive function that packages should not
be calling. Packages should use defface instead, which has existed
since at least Emacs 21.1 (released 2001).
By using defface, Emacs can find the definition of the face, and it's
easier to define different colours for light and dark themes. Also fix
spelling in docstrings.
Also remove fallback code for font-lock-type-face, as this variable
was created before 2000. Likewise font-lock-preprocessor-face, which
dates from 2003.
---
caml-font-old.el | 27 +--------------------------
caml-font.el | 5 -----
caml-types.el | 40 +++++++++++++++-------------------------
3 files changed, 16 insertions(+), 56 deletions(-)
diff --git a/caml-font-old.el b/caml-font-old.el
index fb39c22..949ca32 100644
--- a/caml-font-old.el
+++ b/caml-font-old.el
@@ -17,32 +17,7 @@
(cond
((x-display-color-p)
(require 'font-lock)
- (cond
- ((not (boundp 'font-lock-type-face))
- ; make the necessary faces
- (make-face 'Firebrick)
- (set-face-foreground 'Firebrick "Firebrick")
- (make-face 'RosyBrown)
- (set-face-foreground 'RosyBrown "RosyBrown")
- (make-face 'Purple)
- (set-face-foreground 'Purple "Purple")
- (make-face 'MidnightBlue)
- (set-face-foreground 'MidnightBlue "MidnightBlue")
- (make-face 'DarkGoldenRod)
- (set-face-foreground 'DarkGoldenRod "DarkGoldenRod")
- (make-face 'DarkOliveGreen)
- (set-face-foreground 'DarkOliveGreen "DarkOliveGreen4")
- (make-face 'CadetBlue)
- (set-face-foreground 'CadetBlue "CadetBlue")
- ; assign them as standard faces
- (setq font-lock-comment-face 'Firebrick)
- (setq font-lock-string-face 'RosyBrown)
- (setq font-lock-keyword-face 'Purple)
- (setq font-lock-function-name-face 'MidnightBlue)
- (setq font-lock-variable-name-face 'DarkGoldenRod)
- (setq font-lock-type-face 'DarkOliveGreen)
- (setq font-lock-reference-face 'CadetBlue)))
- ; extra faces for documentation
+ ;; extra faces for documentation
(make-face 'Stop)
(set-face-foreground 'Stop "White")
(set-face-background 'Stop "Red")
diff --git a/caml-font.el b/caml-font.el
index 91c6fce..a282995 100644
--- a/caml-font.el
+++ b/caml-font.el
@@ -30,11 +30,6 @@
(set-face-foreground 'caml-font-doccomment-face "Red")
'caml-font-doccomment-face))
-(unless (facep 'font-lock-preprocessor-face)
- (defvar font-lock-preprocessor-face
- (copy-face 'font-lock-builtin-face
- 'font-lock-preprocessor-face)))
-
(defconst caml-font-lock-keywords
`(
;modules and constructors
diff --git a/caml-types.el b/caml-types.el
index dc01af6..6d6775a 100644
--- a/caml-types.el
+++ b/caml-types.el
@@ -85,44 +85,34 @@ type call ident")
(setq caml-types-location-re
(concat "^" caml-types-position-re " " caml-types-position-re)))
+(defface caml-types-expr-face '((t :background "#88FF44"))
+ "Face for highlighting expressions and types")
+
(defvar caml-types-expr-ovl (make-overlay 1 1))
-(make-face 'caml-types-expr-face)
-(set-face-doc-string 'caml-types-expr-face
- "face for hilighting expressions and types")
-(if (not (face-differs-from-default-p 'caml-types-expr-face))
- (set-face-background 'caml-types-expr-face "#88FF44"))
(overlay-put caml-types-expr-ovl 'face 'caml-types-expr-face)
+(defface caml-types-typed-face '((t :background "#FF8844"))
+ "Face for highlighting typed expressions.")
+
(defvar caml-types-typed-ovl (make-overlay 1 1))
-(make-face 'caml-types-typed-face)
-(set-face-doc-string 'caml-types-typed-face
- "face for hilighting typed expressions")
-(if (not (face-differs-from-default-p 'caml-types-typed-face))
- (set-face-background 'caml-types-typed-face "#FF8844"))
(overlay-put caml-types-typed-ovl 'face 'caml-types-typed-face)
+(defface caml-types-scope-face '((t :background "#BBFFFF"))
+ "Face for highlighting variable scopes.")
+
(defvar caml-types-scope-ovl (make-overlay 1 1))
-(make-face 'caml-types-scope-face)
-(set-face-doc-string 'caml-types-scope-face
- "face for hilighting variable scopes")
-(if (not (face-differs-from-default-p 'caml-types-scope-face))
- (set-face-background 'caml-types-scope-face "#BBFFFF"))
(overlay-put caml-types-scope-ovl 'face 'caml-types-scope-face)
+(defface caml-types-def-face '((t :background "#FF4444"))
+ "Face for highlighting binding occurrences.")
+
(defvar caml-types-def-ovl (make-overlay 1 1))
-(make-face 'caml-types-def-face)
-(set-face-doc-string 'caml-types-def-face
- "face for hilighting binding occurrences")
-(if (not (face-differs-from-default-p 'caml-types-def-face))
- (set-face-background 'caml-types-def-face "#FF4444"))
(overlay-put caml-types-def-ovl 'face 'caml-types-def-face)
+(defface caml-types-occ-face '((t :background "#44FF44"))
+ "Face for highlighting variable occurrences.")
+
(defvar caml-types-occ-ovl (make-overlay 1 1))
-(make-face 'caml-types-occ-face)
-(set-face-doc-string 'caml-types-occ-face
- "face for hilighting variable occurrences")
-(if (not (face-differs-from-default-p 'caml-types-occ-face))
- (set-face-background 'caml-types-occ-face "#44FF44"))
(overlay-put caml-types-occ-ovl 'face 'caml-types-occ-face)
- [nongnu] externals/caml e32742a 111/197: ajout des annotations pour variables et appels terminaux, (continued)
- [nongnu] externals/caml e32742a 111/197: ajout des annotations pour variables et appels terminaux, Stefan Monnier, 2020/11/21
- [nongnu] externals/caml 5f8dd3f 113/197: PR#4440 added function to skip warnings and jump to error, Stefan Monnier, 2020/11/21
- [nongnu] externals/caml a688081 114/197: PR#4469 enhanced caml-set-compile-command, Stefan Monnier, 2020/11/21
- [nongnu] externals/caml 99e7ea3 119/197: merge changes from 3.10.2merged to 3.11.0, Stefan Monnier, 2020/11/21
- [nongnu] externals/caml 51b6e03 120/197: merge changes from release/3.11.1 to release/3.11.2, Stefan Monnier, 2020/11/21
- [nongnu] externals/caml d1fc793 125/197: Added save-excursion to ocaml-link-activate., Stefan Monnier, 2020/11/21
- [nongnu] externals/caml 97316f7 130/197: renaming of Objective Caml to OCaml and cleanup of copyright headers, Stefan Monnier, 2020/11/21
- [nongnu] externals/caml 42d2eda 126/197: Fixed caml-help (would loose the position of the symbol search for)., Stefan Monnier, 2020/11/21
- [nongnu] externals/caml 49653b2 148/197: remove all $Id keywords, Stefan Monnier, 2020/11/21
- [nongnu] externals/caml 9b0544f 154/197: fix whitespace and over-long lines, Stefan Monnier, 2020/11/21
- [nongnu] externals/caml da654aa 179/197: Emacs: Modernise font face definitions,
Stefan Monnier <=
- [nongnu] externals/caml cd1142f 187/197: Change camlc → ocamlc, Stefan Monnier, 2020/11/21
- [nongnu] externals/caml 3fb0de6 188/197: Add octal character literals, Stefan Monnier, 2020/11/21
- [nongnu] externals/caml 6e0e050 134/197: PR#5455: .emacs instructions, add lines to recognize ocaml scripts, Stefan Monnier, 2020/11/21
- [nongnu] externals/caml 56e93b6 151/197: fix a few problems with whitespace and over-long lines, Stefan Monnier, 2020/11/21
- [nongnu] externals/caml f4c7308 168/197: caml.el: Reduce byte-compilation warnings, Stefan Monnier, 2020/11/21
- [nongnu] externals/caml a0d389f 058/197: skip structs in let module ... in, Stefan Monnier, 2020/11/21
- [nongnu] externals/caml 442bd24 059/197: prepare snapshot, Stefan Monnier, 2020/11/21
- [nongnu] externals/caml ac2a0b2 064/197: ajout option -stypes; depend, Stefan Monnier, 2020/11/21
- [nongnu] externals/caml faa1c81 065/197: ajout choses a faire, Stefan Monnier, 2020/11/21
- [nongnu] externals/caml 76f4e2b 116/197: amelioration des annotations, Stefan Monnier, 2020/11/21