Subject: bug#58940: closed (Re: bug#58940: [PATCH] feature/tree-sitter: Add more font lock faces)

From: [email-masked] (GNU bug Tracking System)
Date: Thu, 10 Nov 2022 11:07:02 +0000

Your bug report

#58940: [PATCH] feature/tree-sitter: Add more font lock faces

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
58940: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=58940
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#58940: [PATCH] feature/tree-sitter: Add more font lock faces
From: Eli Zaretskii <[email-masked]>
To: Yuan Fu <[email-masked]>
Cc: [email-masked], [email-masked]
Date: Thu, 10 Nov 2022 13:06:01 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

> From: Yuan Fu <[email-masked]>
> Date: Wed, 9 Nov 2022 19:59:30 -0800
> Cc: Eli Zaretskii <[email-masked]>,
>  [email-masked]
> 
> > Yuan, any further comments? If not, would you or someone else be able to push the patch?
> > 
> > Thanks.
> 
> I don’t have much to say, since this is not really about tree-sitter. I’ll wait for other folks to decide & push ;-)

I installed it, thanks.

Subject: [PATCH] feature/tree-sitter: Add more font lock faces
From: Randy Taylor <[email-masked]>
To: "[email-masked]" <[email-masked]>
Date: Tue, 01 Nov 2022 01:21:03 +0000
List-Id: <debbugs-submit.debbugs.gnu.org>

The attached patch adds the following faces:

- font-lock-escape-face
- font-lock-number-face
- font-lock-operator-face
- font-lock-property-face
- font-lock-punctuation-face

font-lock-property-face inherits font-lock-variable-name-face which matches the behaviour of cc-mode and python-mode.

font-lock-escape-face inherits nothing. In python-mode, it inherits font-lock-constant-face, but not in cc-mode. Do we want it to inherit anything?

Hopefully I put everything in the right place.

From 8f05a744744143ce05a0eee0ab8ac9926bc5f3eb Mon Sep 17 00:00:00 2001
From: Randy Taylor <[email-masked]>
Date: Fri, 28 Oct 2022 22:39:50 -0400
Subject: [PATCH] Add more font-lock faces

* lisp/font-lock.el (font-lock-escape-face, font-lock-number-face,
font-lock-operator-face, font-lock-property-face,
font-lock-punctuation-face): Define new faces.
* lisp/cus-theme.el (custom-theme--listed-faces): Add them to the list.
* doc/lispref/modes.texi (Faces for Font Lock): Document them.
* etc/NEWS: Mention them.
---
 doc/lispref/modes.texi | 21 ++++++++++++++++++++
 etc/NEWS               |  5 +++++
 lisp/cus-theme.el      |  7 +++++--
 lisp/font-lock.el      | 45 ++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 76 insertions(+), 2 deletions(-)

diff --git a/doc/lispref/modes.texi b/doc/lispref/modes.texi
index f587252422..0095d62026 100644
--- a/doc/lispref/modes.texi
+++ b/doc/lispref/modes.texi
@@ -3653,6 +3653,27 @@ Faces for Font Lock
 @item font-lock-negation-char-face
 @vindex font-lock-negation-char-face
 for easily-overlooked negation characters.
+
+@item font-lock-escape-face
+@vindex font-lock-escape-face
+for escape sequences in strings.
+
+@item font-lock-number-face
+@vindex font-lock-number-face
+for numbers.
+
+@item font-lock-operator-face
+@vindex font-lock-operator-face
+for operators.
+
+@item font-lock-property-face
+@vindex font-lock-property-face
+for properties, such as fields of a struct or class.
+This face inherits, by default, from @code{font-lock-variable-name-face}.
+
+@item font-lock-punctuation-face
+@vindex font-lock-punctuation-face
+for punctuation.
 @end table
 
 @node Syntactic Font Lock
diff --git a/etc/NEWS b/etc/NEWS
index c5a142b500..b1e342eff6 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -732,6 +732,11 @@ If the current buffer is visiting a file that is executable, the
 This determines how long to pause Emacs after a process
 filter/sentinel error has been handled.
 
++++
+** New faces for font-lock.
+'font-lock-escape-face', 'font-lock-number-face', 'font-lock-operator-face',
+'font-lock-property-face', 'font-lock-punctuation-face'.
+
 +++
 ** New face 'variable-pitch-text'.
 This face is like 'variable-pitch' (from which it inherits), but is
diff --git a/lisp/cus-theme.el b/lisp/cus-theme.el
index 90680ff68f..a977d6834c 100644
--- a/lisp/cus-theme.el
+++ b/lisp/cus-theme.el
@@ -68,9 +68,12 @@ custom-theme--listed-faces
   shadow secondary-selection trailing-whitespace
   font-lock-builtin-face font-lock-comment-delimiter-face
   font-lock-comment-face font-lock-constant-face
-  font-lock-doc-face font-lock-doc-markup-face font-lock-function-name-face
+  font-lock-doc-face font-lock-doc-markup-face
+  font-lock-escape-face font-lock-function-name-face
   font-lock-keyword-face font-lock-negation-char-face
-  font-lock-preprocessor-face font-lock-regexp-grouping-backslash
+  font-lock-number-face font-lock-operator-face
+  font-lock-preprocessor-face font-lock-property-face
+  font-lock-punctuation-face font-lock-regexp-grouping-backslash
   font-lock-regexp-grouping-construct font-lock-string-face
   font-lock-type-face font-lock-variable-name-face
   font-lock-warning-face button link link-visited fringe
diff --git a/lisp/font-lock.el b/lisp/font-lock.el
index b6f4150964..51c0b156ee 100644
--- a/lisp/font-lock.el
+++ b/lisp/font-lock.el
@@ -359,6 +359,21 @@ font-lock-negation-char-face
 (defvar font-lock-preprocessor-face	'font-lock-preprocessor-face
   "Face name to use for preprocessor directives.")
 
+(defvar font-lock-escape-face		'font-lock-escape-face
+  "Face name to use for escape sequences in strings.")
+
+(defvar font-lock-number-face		'font-lock-number-face
+  "Face name to use for numbers.")
+
+(defvar font-lock-operator-face	'font-lock-operator-face
+  "Face name to use for operators.")
+
+(defvar font-lock-property-face	'font-lock-property-face
+  "Face name to use for properties.")
+
+(defvar font-lock-punctuation-face	'font-lock-punctuation-face
+  "Face name to use for punctuation.")
+
 ;; Fontification variables:
 
 (defvar font-lock-keywords nil
@@ -2073,6 +2088,36 @@ font-lock-preprocessor-face
   "Font Lock mode face used to highlight preprocessor directives."
   :group 'font-lock-faces)
 
+(defface font-lock-escape-face
+  '((t nil))
+  "Font Lock mode face used to highlight escape sequences in strings."
+  :group 'font-lock-faces
+  :version "29.1")
+
+(defface font-lock-number-face
+  '((t nil))
+  "Font Lock mode face used to highlight numbers."
+  :group 'font-lock-faces
+  :version "29.1")
+
+(defface font-lock-operator-face
+  '((t nil))
+  "Font Lock mode face used to highlight operators."
+  :group 'font-lock-faces
+  :version "29.1")
+
+(defface font-lock-property-face
+  '((t :inherit font-lock-variable-name-face))
+  "Font Lock mode face used to highlight properties."
+  :group 'font-lock-faces
+  :version "29.1")
+
+(defface font-lock-punctuation-face
+  '((t nil))
+  "Font Lock mode face used to highlight punctuation."
+  :group 'font-lock-faces
+  :version "29.1")
+
 (defface font-lock-regexp-grouping-backslash
   '((t :inherit bold))
   "Font Lock mode face for backslashes in Lisp regexp grouping constructs."
-- 
2.38.1