1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-06 06:20:55 -08:00

Add more font-lock faces (Bug#58940)

* lisp/font-lock.el (font-lock-bracket-face, font-lock-delimiter-face,
font-lock-escape-face, font-lock-number-face,
font-lock-misc-punctuation-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.
This commit is contained in:
Randy Taylor 2022-10-28 22:39:50 -04:00 committed by Eli Zaretskii
parent 77cb95c851
commit e06953b02a
4 changed files with 132 additions and 6 deletions

View file

@ -3653,6 +3653,71 @@ This face inherits, by default, from @code{font-lock-constant-face}.
@item font-lock-negation-char-face @item font-lock-negation-char-face
@vindex font-lock-negation-char-face @vindex font-lock-negation-char-face
for easily-overlooked negation characters. for easily-overlooked negation characters.
@item font-lock-escape-face
@vindex font-lock-escape-face
for escape sequences in strings.
This face inherits, by default, from @code{font-lock-regexp-grouping-backslash}.
Here is an example in Python, where the escape sequence @code{\n} is used:
@smallexample
@group
print('Hello world!\n')
@end group
@end smallexample
@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 of an object, such as the declaration and use of fields
in a struct.
This face inherits, by default, from @code{font-lock-variable-name-face}.
For example,
@smallexample
@group
typedef struct
@{
int prop;
// ^ property
@} obj;
int main()
@{
obj o;
o.prop = 3;
// ^ property
@}
@end group
@end smallexample
@item font-lock-punctuation-face
@vindex font-lock-punctuation-face
for punctuation such as brackets and delimiters.
@item font-lock-bracket-face
@vindex font-lock-bracket-face
for brackets (e.g., @code{()}, @code{[]}, @code{@{@}}).
This face inherits, by default, from @code{font-lock-punctuation-face}.
@item font-lock-delimiter-face
@vindex font-lock-delimiter-face
for delimiters (e.g., @code{;}, @code{:}, @code{,}).
This face inherits, by default, from @code{font-lock-punctuation-face}.
@item font-lock-misc-punctuation-face
@vindex font-lock-misc-punctuation-face
for punctuation that is not a bracket or delimiter.
This face inherits, by default, from @code{font-lock-punctuation-face}.
@end table @end table
@node Syntactic Font Lock @node Syntactic Font Lock

View file

@ -732,6 +732,14 @@ If the current buffer is visiting a file that is executable, the
This determines how long to pause Emacs after a process This determines how long to pause Emacs after a process
filter/sentinel error has been handled. filter/sentinel error has been handled.
+++
** New faces for font-lock.
These faces are primarily meant for use with tree-sitter. They are:
'font-lock-bracket-face', 'font-lock-delimiter-face',
'font-lock-escape-face', 'font-lock-number-face',
'font-lock-misc-punctuation-face', 'font-lock-operator-face',
'font-lock-property-face', 'font-lock-punctuation-face'.
+++ +++
** New face 'variable-pitch-text'. ** New face 'variable-pitch-text'.
This face is like 'variable-pitch' (from which it inherits), but is This face is like 'variable-pitch' (from which it inherits), but is

View file

@ -66,13 +66,17 @@ Do not call this mode function yourself. It is meant for internal use."
variable-pitch escape-glyph homoglyph variable-pitch escape-glyph homoglyph
minibuffer-prompt highlight region minibuffer-prompt highlight region
shadow secondary-selection trailing-whitespace shadow secondary-selection trailing-whitespace
font-lock-builtin-face font-lock-comment-delimiter-face font-lock-bracket-face font-lock-builtin-face
font-lock-comment-face font-lock-constant-face font-lock-comment-delimiter-face font-lock-comment-face
font-lock-doc-face font-lock-doc-markup-face font-lock-function-name-face font-lock-constant-face font-lock-delimiter-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-keyword-face font-lock-negation-char-face
font-lock-preprocessor-face font-lock-regexp-grouping-backslash font-lock-number-face font-lock-misc-punctuation-face
font-lock-regexp-grouping-construct font-lock-string-face font-lock-operator-face font-lock-preprocessor-face
font-lock-type-face font-lock-variable-name-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 font-lock-warning-face button link link-visited fringe
header-line tooltip mode-line mode-line-buffer-id header-line tooltip mode-line mode-line-buffer-id
mode-line-emphasis mode-line-highlight mode-line-inactive mode-line-emphasis mode-line-highlight mode-line-inactive

View file

@ -2095,6 +2095,55 @@ as the constructs of Haddock, Javadoc and similar systems."
"Font Lock mode face used to highlight grouping constructs in Lisp regexps." "Font Lock mode face used to highlight grouping constructs in Lisp regexps."
:group 'font-lock-faces) :group 'font-lock-faces)
(defface font-lock-escape-face
'((t :inherit font-lock-regexp-grouping-backslash))
"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 of an object.
For example, the declaration and use of fields in a struct."
: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-bracket-face
'((t :inherit font-lock-punctuation-face))
"Font Lock mode face used to highlight brackets."
:group 'font-lock-faces
:version "29.1")
(defface font-lock-delimiter-face
'((t :inherit font-lock-punctuation-face))
"Font Lock mode face used to highlight delimiters."
:group 'font-lock-faces
:version "29.1")
(defface font-lock-misc-punctuation-face
'((t :inherit font-lock-punctuation-face))
"Font Lock mode face used to highlight miscellaneous punctuation."
:group 'font-lock-faces
:version "29.1")
;; End of Color etc. support. ;; End of Color etc. support.
;;; Menu support. ;;; Menu support.