diff options
| author | Dmitry Gutov | 2023-01-06 19:56:20 +0200 |
|---|---|---|
| committer | Dmitry Gutov | 2023-01-06 19:56:20 +0200 |
| commit | 2ea6ee5cbfac5c5e9a1e27ddda2d88cdedc6a6eb (patch) | |
| tree | 02da04a4b53145d198a71e70887b3f35af4bed2a | |
| parent | 5ab03bcc433acbd0ce7126e40746efe092e0805a (diff) | |
| download | emacs-2ea6ee5cbfac5c5e9a1e27ddda2d88cdedc6a6eb.tar.gz emacs-2ea6ee5cbfac5c5e9a1e27ddda2d88cdedc6a6eb.zip | |
(font-lock-regexp-face): New face
* lisp/font-lock.el (font-lock-regexp-face): New face.
* lisp/progmodes/typescript-ts-mode.el
(typescript-ts-mode--font-lock-settings):
* lisp/progmodes/ruby-ts-mode.el (ruby-ts--font-lock-settings):
* lisp/progmodes/js.el (js--treesit-font-lock-settings):
Use it for regexps.
* etc/NEWS: Mention the addition.
| -rw-r--r-- | etc/NEWS | 1 | ||||
| -rw-r--r-- | lisp/font-lock.el | 6 | ||||
| -rw-r--r-- | lisp/progmodes/js.el | 2 | ||||
| -rw-r--r-- | lisp/progmodes/ruby-ts-mode.el | 6 | ||||
| -rw-r--r-- | lisp/progmodes/typescript-ts-mode.el | 2 |
5 files changed, 11 insertions, 6 deletions
| @@ -798,6 +798,7 @@ filter/sentinel error has been handled. | |||
| 798 | These faces are primarily meant for use with tree-sitter. They are: | 798 | These faces are primarily meant for use with tree-sitter. They are: |
| 799 | 'font-lock-bracket-face', 'font-lock-delimiter-face', | 799 | 'font-lock-bracket-face', 'font-lock-delimiter-face', |
| 800 | 'font-lock-escape-face', 'font-lock-number-face', | 800 | 'font-lock-escape-face', 'font-lock-number-face', |
| 801 | 'font-lock-regexp-face', | ||
| 801 | 'font-lock-misc-punctuation-face', 'font-lock-operator-face', | 802 | 'font-lock-misc-punctuation-face', 'font-lock-operator-face', |
| 802 | 'font-lock-property-face', and 'font-lock-punctuation-face'. | 803 | 'font-lock-property-face', and 'font-lock-punctuation-face'. |
| 803 | 804 | ||
diff --git a/lisp/font-lock.el b/lisp/font-lock.el index 74881a14ccf..99df8fb9e06 100644 --- a/lisp/font-lock.el +++ b/lisp/font-lock.el | |||
| @@ -2073,6 +2073,12 @@ as the constructs of Haddock, Javadoc and similar systems." | |||
| 2073 | "Font Lock mode face used to highlight preprocessor directives." | 2073 | "Font Lock mode face used to highlight preprocessor directives." |
| 2074 | :group 'font-lock-faces) | 2074 | :group 'font-lock-faces) |
| 2075 | 2075 | ||
| 2076 | (defface font-lock-regexp-face | ||
| 2077 | '((t :inherit font-lock-string-face)) | ||
| 2078 | "Font Lock mode face used to highlight regexp literals." | ||
| 2079 | :group 'font-lock-faces | ||
| 2080 | :version "29.1") | ||
| 2081 | |||
| 2076 | (defface font-lock-regexp-grouping-backslash | 2082 | (defface font-lock-regexp-grouping-backslash |
| 2077 | '((t :inherit bold)) | 2083 | '((t :inherit bold)) |
| 2078 | "Font Lock mode face for backslashes in Lisp regexp grouping constructs." | 2084 | "Font Lock mode face for backslashes in Lisp regexp grouping constructs." |
diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el index 90b9068fd5d..fe483f220da 100644 --- a/lisp/progmodes/js.el +++ b/lisp/progmodes/js.el | |||
| @@ -3498,7 +3498,7 @@ This function is intended for use in `after-change-functions'." | |||
| 3498 | 3498 | ||
| 3499 | :language 'javascript | 3499 | :language 'javascript |
| 3500 | :feature 'string | 3500 | :feature 'string |
| 3501 | '((regex pattern: (regex_pattern)) @font-lock-string-face | 3501 | '((regex pattern: (regex_pattern)) @font-lock-regexp-face |
| 3502 | (string) @font-lock-string-face) | 3502 | (string) @font-lock-string-face) |
| 3503 | 3503 | ||
| 3504 | :language 'javascript | 3504 | :language 'javascript |
diff --git a/lisp/progmodes/ruby-ts-mode.el b/lisp/progmodes/ruby-ts-mode.el index bf09726b34f..5f5de500435 100644 --- a/lisp/progmodes/ruby-ts-mode.el +++ b/lisp/progmodes/ruby-ts-mode.el | |||
| @@ -227,10 +227,8 @@ values of OVERRIDE" | |||
| 227 | ;; Also before 'operator because % and / are operators | 227 | ;; Also before 'operator because % and / are operators |
| 228 | :language language | 228 | :language language |
| 229 | :feature 'regexp | 229 | :feature 'regexp |
| 230 | ;; TODO: We probably need a separate face for regexps everywhere. | 230 | '((regex "/" @font-lock-regexp-face) |
| 231 | ;; Maybe another one for regexp delimiters as well. | 231 | (regex _ (string_content) @font-lock-regexp-face)) |
| 232 | '((regex "/" @font-lock-string-face) | ||
| 233 | (regex _ (string_content) @font-lock-string-face)) | ||
| 234 | 232 | ||
| 235 | :language language | 233 | :language language |
| 236 | :feature 'operator | 234 | :feature 'operator |
diff --git a/lisp/progmodes/typescript-ts-mode.el b/lisp/progmodes/typescript-ts-mode.el index 4042e2b1013..5a9a7eea959 100644 --- a/lisp/progmodes/typescript-ts-mode.el +++ b/lisp/progmodes/typescript-ts-mode.el | |||
| @@ -151,7 +151,7 @@ Argument LANGUAGE is either `typescript' or `tsx'." | |||
| 151 | :language language | 151 | :language language |
| 152 | :override t | 152 | :override t |
| 153 | :feature 'string | 153 | :feature 'string |
| 154 | `((regex pattern: (regex_pattern)) @font-lock-string-face | 154 | `((regex pattern: (regex_pattern)) @font-lock-regexp-face |
| 155 | (string) @font-lock-string-face | 155 | (string) @font-lock-string-face |
| 156 | (template_string) @js--fontify-template-string | 156 | (template_string) @js--fontify-template-string |
| 157 | (template_substitution ["${" "}"] @font-lock-misc-punctuation-face)) | 157 | (template_substitution ["${" "}"] @font-lock-misc-punctuation-face)) |