* Which face to use for highlighting interpolation delimiters?
@ 2023-01-06 1:53 Dmitry Gutov
2023-01-06 2:56 ` Randy Taylor
0 siblings, 1 reply; 7+ messages in thread
From: Dmitry Gutov @ 2023-01-06 1:53 UTC (permalink / raw)
To: emacs-devel
E.g. ${ and } in "String literal with #{var} in the middle".
So far it seems that the ts modes haven't managed to agree on one yet.
js-ts-mode uses font-lock-delimiter-face, and
typescript-ts-mode uses font-lock-builtin-face (for template_substitution).
Maybe we need a new one.
While we're at it, maybe a face for regexps literals as well?
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Which face to use for highlighting interpolation delimiters?
2023-01-06 1:53 Which face to use for highlighting interpolation delimiters? Dmitry Gutov
@ 2023-01-06 2:56 ` Randy Taylor
2023-01-06 13:50 ` Dmitry Gutov
0 siblings, 1 reply; 7+ messages in thread
From: Randy Taylor @ 2023-01-06 2:56 UTC (permalink / raw)
To: Dmitry Gutov; +Cc: emacs-devel
On Thursday, January 5th, 2023 at 20:53, Dmitry Gutov <dgutov@yandex.ru> wrote:
>
> E.g. ${ and } in "String literal with #{var} in the middle".
>
> So far it seems that the ts modes haven't managed to agree on one yet.
>
> js-ts-mode uses font-lock-delimiter-face, and
> typescript-ts-mode uses font-lock-builtin-face (for template_substitution).
>
> Maybe we need a new one.
I think font-lock-misc-punctuation-face should be used for those.
>
> While we're at it, maybe a face for regexps literals as well?
Sure.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Which face to use for highlighting interpolation delimiters?
2023-01-06 2:56 ` Randy Taylor
@ 2023-01-06 13:50 ` Dmitry Gutov
2023-01-06 14:30 ` Eli Zaretskii
0 siblings, 1 reply; 7+ messages in thread
From: Dmitry Gutov @ 2023-01-06 13:50 UTC (permalink / raw)
To: Randy Taylor, Eli Zaretskii; +Cc: emacs-devel
On 06/01/2023 04:56, Randy Taylor wrote:
> On Thursday, January 5th, 2023 at 20:53, Dmitry Gutov <dgutov@yandex.ru> wrote:
>>
>> E.g. ${ and } in "String literal with #{var} in the middle".
>>
>> So far it seems that the ts modes haven't managed to agree on one yet.
>>
>> js-ts-mode uses font-lock-delimiter-face, and
>> typescript-ts-mode uses font-lock-builtin-face (for template_substitution).
>>
>> Maybe we need a new one.
>
> I think font-lock-misc-punctuation-face should be used for those.
Okay.
>> While we're at it, maybe a face for regexp literals as well?
>
> Sure.
Eli, could we still add that in emacs-29? We'll make it simply inherit
from string and use in a 2-3 ts modes for languages with regexp
literals. It's a pretty trivial change.
If we defer it until Emacs 30, it will be kinda painful to use in
ELPA-distributed packages (e.g. python and hopefully ruby as well).
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Which face to use for highlighting interpolation delimiters?
2023-01-06 13:50 ` Dmitry Gutov
@ 2023-01-06 14:30 ` Eli Zaretskii
2023-01-06 15:36 ` Dmitry Gutov
0 siblings, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2023-01-06 14:30 UTC (permalink / raw)
To: Dmitry Gutov; +Cc: dev, emacs-devel
> Date: Fri, 6 Jan 2023 15:50:02 +0200
> Cc: emacs-devel <emacs-devel@gnu.org>
> From: Dmitry Gutov <dgutov@yandex.ru>
>
> >> While we're at it, maybe a face for regexp literals as well?
> >
> > Sure.
>
> Eli, could we still add that in emacs-29? We'll make it simply inherit
> from string and use in a 2-3 ts modes for languages with regexp
> literals. It's a pretty trivial change.
>
> If we defer it until Emacs 30, it will be kinda painful to use in
> ELPA-distributed packages (e.g. python and hopefully ruby as well).
In general OK, but please show the patch to add that, so I could know
exactly what is being proposed.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Which face to use for highlighting interpolation delimiters?
2023-01-06 14:30 ` Eli Zaretskii
@ 2023-01-06 15:36 ` Dmitry Gutov
2023-01-06 16:48 ` Eli Zaretskii
0 siblings, 1 reply; 7+ messages in thread
From: Dmitry Gutov @ 2023-01-06 15:36 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: dev, emacs-devel
[-- Attachment #1: Type: text/plain, Size: 758 bytes --]
On 06/01/2023 16:30, Eli Zaretskii wrote:
>> Date: Fri, 6 Jan 2023 15:50:02 +0200
>> Cc: emacs-devel<emacs-devel@gnu.org>
>> From: Dmitry Gutov<dgutov@yandex.ru>
>>
>>>> While we're at it, maybe a face for regexp literals as well?
>>> Sure.
>> Eli, could we still add that in emacs-29? We'll make it simply inherit
>> from string and use in a 2-3 ts modes for languages with regexp
>> literals. It's a pretty trivial change.
>>
>> If we defer it until Emacs 30, it will be kinda painful to use in
>> ELPA-distributed packages (e.g. python and hopefully ruby as well).
> In general OK, but please show the patch to add that, so I could know
> exactly what is being proposed.
Sure.
I think these 3 are the only languages we support that have regexp literals.
[-- Attachment #2: font-lock-regexp-face.diff --]
[-- Type: text/x-patch, Size: 2880 bytes --]
diff --git a/etc/NEWS b/etc/NEWS
index 059278b08a1..5901b2718e9 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -798,6 +798,7 @@ filter/sentinel error has been handled.
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-regexp-face',
'font-lock-misc-punctuation-face', 'font-lock-operator-face',
'font-lock-property-face', and 'font-lock-punctuation-face'.
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 @@ font-lock-preprocessor-face
"Font Lock mode face used to highlight preprocessor directives."
:group 'font-lock-faces)
+(defface font-lock-regexp-face
+ '((t :inherit font-lock-string-face))
+ "Font Lock mode face used to highlight regexp literals."
+ :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."
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 @@ js--treesit-font-lock-settings
:language 'javascript
:feature 'string
- '((regex pattern: (regex_pattern)) @font-lock-string-face
+ '((regex pattern: (regex_pattern)) @font-lock-regexp-face
(string) @font-lock-string-face)
: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 @@ ruby-ts--font-lock-settings
;; Also before 'operator because % and / are operators
:language language
:feature 'regexp
- ;; TODO: We probably need a separate face for regexps everywhere.
- ;; Maybe another one for regexp delimiters as well.
- '((regex "/" @font-lock-string-face)
- (regex _ (string_content) @font-lock-string-face))
+ '((regex "/" @font-lock-regexp-face)
+ (regex _ (string_content) @font-lock-regexp-face))
:language language
: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 @@ typescript-ts-mode--font-lock-settings
:language language
:override t
:feature 'string
- `((regex pattern: (regex_pattern)) @font-lock-string-face
+ `((regex pattern: (regex_pattern)) @font-lock-regexp-face
(string) @font-lock-string-face
(template_string) @js--fontify-template-string
(template_substitution ["${" "}"] @font-lock-misc-punctuation-face))
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: Which face to use for highlighting interpolation delimiters?
2023-01-06 15:36 ` Dmitry Gutov
@ 2023-01-06 16:48 ` Eli Zaretskii
2023-01-06 17:59 ` Dmitry Gutov
0 siblings, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2023-01-06 16:48 UTC (permalink / raw)
To: Dmitry Gutov; +Cc: dev, emacs-devel
> Date: Fri, 6 Jan 2023 17:36:57 +0200
> Cc: dev@rjt.dev, emacs-devel@gnu.org
> From: Dmitry Gutov <dgutov@yandex.ru>
>
> >> If we defer it until Emacs 30, it will be kinda painful to use in
> >> ELPA-distributed packages (e.g. python and hopefully ruby as well).
> > In general OK, but please show the patch to add that, so I could know
> > exactly what is being proposed.
>
> Sure.
>
> I think these 3 are the only languages we support that have regexp literals.
This is okay for the emacs-29 branch. Thanks.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Which face to use for highlighting interpolation delimiters?
2023-01-06 16:48 ` Eli Zaretskii
@ 2023-01-06 17:59 ` Dmitry Gutov
0 siblings, 0 replies; 7+ messages in thread
From: Dmitry Gutov @ 2023-01-06 17:59 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: dev, emacs-devel
On 06/01/2023 18:48, Eli Zaretskii wrote:
>> Date: Fri, 6 Jan 2023 17:36:57 +0200
>> Cc:dev@rjt.dev,emacs-devel@gnu.org
>> From: Dmitry Gutov<dgutov@yandex.ru>
>>
>>>> If we defer it until Emacs 30, it will be kinda painful to use in
>>>> ELPA-distributed packages (e.g. python and hopefully ruby as well).
>>> In general OK, but please show the patch to add that, so I could know
>>> exactly what is being proposed.
>> Sure.
>>
>> I think these 3 are the only languages we support that have regexp literals.
> This is okay for the emacs-29 branch. Thanks.
Installed, thank you.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2023-01-06 17:59 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-06 1:53 Which face to use for highlighting interpolation delimiters? Dmitry Gutov
2023-01-06 2:56 ` Randy Taylor
2023-01-06 13:50 ` Dmitry Gutov
2023-01-06 14:30 ` Eli Zaretskii
2023-01-06 15:36 ` Dmitry Gutov
2023-01-06 16:48 ` Eli Zaretskii
2023-01-06 17:59 ` Dmitry Gutov
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).