GNU bug report logs -
#64275
30.0.50; [PATCH] Improve sigil font-lock match for elixir-ts-mode
Previous Next
Reported by: Wilhelm Kirschbaum <wkirschbaum <at> gmail.com>
Date: Sat, 24 Jun 2023 20:18:02 UTC
Severity: normal
Tags: patch
Found in version 30.0.50
Done: Dmitry Gutov <dmitry <at> gutov.dev>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 64275 in the body.
You can then email your comments to 64275 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#64275
; Package
emacs
.
(Sat, 24 Jun 2023 20:18:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Wilhelm Kirschbaum <wkirschbaum <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Sat, 24 Jun 2023 20:18:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
This patch updates the sigil matching for Elixir. We don't need
to know
what the sigil is to be able to set the font. The one exception
is
regex via a sigil.
[0001-Fix-eglot-imenu-when-the-server-does-not-support-it.patch (text/x-patch, attachment)]
[Message part 3 (text/plain, inline)]
Wilhelm
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#64275
; Package
emacs
.
(Sun, 25 Jun 2023 08:55:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 64275 <at> debbugs.gnu.org (full text, mbox):
Wilhelm Kirschbaum [2023-06-24 22:14 +0200] wrote:
> This patch updates the sigil matching for Elixir. We don't need to know
> what the sigil is to be able to set the font. The one exception is
> regex via a sigil.
>
> From 9a1389305d92f0e08d39d2ff5540cb494c012f12 Mon Sep 17 00:00:00 2001
> From: Wilhelm H Kirschbaum <wkirschbaum <at> gmail.com>
> Date: Sat, 24 Jun 2023 21:54:30 +0200
> Subject: [PATCH 1/1] Fix eglot-imenu when the server does not support it
Looks like the patch from bug#64274 was attached instead.
--
Basil
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#64275
; Package
emacs
.
(Sun, 25 Jun 2023 09:03:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 64275 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
> Looks like the patch from bug#64274 was attached instead.
Ah, sorry. Here is the correct patch.
Wilhelm
[0001-Update-sigil-font-lock-match-for-elixir-ts-mode.patch (text/x-patch, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#64275
; Package
emacs
.
(Sat, 29 Jul 2023 18:37:02 GMT)
Full text and
rfc822 format available.
Message #14 received at 64275 <at> debbugs.gnu.org (full text, mbox):
Wilhelm Kirschbaum <wkirschbaum <at> gmail.com> writes:
>> Looks like the patch from bug#64274 was attached instead.
>
> Ah, sorry. Here is the correct patch.
>
> Wilhelm
>
> [2. text/x-patch;
> 0001-Update-sigil-font-lock-match-for-elixir-ts-mode.patch]...
Can this patch still be installed please?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#64275
; Package
emacs
.
(Sun, 30 Jul 2023 02:07:01 GMT)
Full text and
rfc822 format available.
Message #17 received at 64275 <at> debbugs.gnu.org (full text, mbox):
On 25/06/2023 12:00, Wilhelm Kirschbaum wrote:
> "~" @font-lock-string-face
> (sigil_name) @elixir-ts-font-sigil-name-face
> (:match "^[rR]$" @elixir-ts-font-sigil-name-face))
> @font-lock-regexp-face
> - (sigil
> - "~" @font-lock-string-face
> - (sigil_name) @elixir-ts-font-sigil-name-face
> - quoted_start: _ @font-lock-string-face
> - quoted_end: _ @font-lock-string-face
> - (:match "^[HF]$" @elixir-ts-font-sigil-name-face)))
> -
> + (sigil) @font-lock-string-face)
Hi Wilhelm!
Should we continue to use elixir-ts-font-sigil-name-face, though?
With the new patch, it will continue highlight the sigil name ("r") in
regexps, but no in other sigil types (s/c/w).
What's your opinion on that?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#64275
; Package
emacs
.
(Sun, 30 Jul 2023 08:21:02 GMT)
Full text and
rfc822 format available.
Message #20 received at 64275 <at> debbugs.gnu.org (full text, mbox):
Dmitry Gutov <dmitry <at> gutov.dev> writes:
> On 25/06/2023 12:00, Wilhelm Kirschbaum wrote:
>> "~" @font-lock-string-face
>> (sigil_name) @elixir-ts-font-sigil-name-face
>> (:match "^[rR]$" @elixir-ts-font-sigil-name-face))
>> @font-lock-regexp-face
>> - (sigil
>> - "~" @font-lock-string-face
>> - (sigil_name) @elixir-ts-font-sigil-name-face
>> - quoted_start: _ @font-lock-string-face
>> - quoted_end: _ @font-lock-string-face
>> - (:match "^[HF]$" @elixir-ts-font-sigil-name-face)))
>> -
>> + (sigil) @font-lock-string-face)
>
> Hi Wilhelm!
>
> Should we continue to use elixir-ts-font-sigil-name-face,
> though?
>
Hi :)
We still need to match only the sigil_name part, so can't use the
@font-lock-string-face as it will exclude the '~', therefore we
need a
custom font for the match. This is only true for ~r/regex content
here/ and
~R/regex content here/, or variance ~r(regex content here)
etc. where
the font for the regex part is different than the font for the
sigil
prefix.
Perhaps there is another way to both apply a font with
@font-lock-string-face and exclude it from the :match, but last
time I
checked this was not possible.
> With the new patch, it will continue highlight the sigil name
> ("r") in
> regexps, but no in other sigil types (s/c/w).
>
Incorrect, just below there is a:
(sigil) @font-lock-string-face)
without a match, so they will be highlighted, but just more
generically
as we don't know which sigils the user might have assigned.
> What's your opinion on that?
As a baseline it makes sense to me to apply font-lock-string-face
to all
sigils, as they can be user defined. Some are language core
sigils,
like the ~r and ~R sigils and then there are common library
accepted
sigils like ~H and ~F which can effectively be seen as part of the
language, these can be added over time as we improve this mode.
The
initial ideas was to try and match a complete list, but won't
work.
Users can also define sigils in their projects, so its better to
rely on
the grammar to tell us its a sigil.
I ran the current patch for over a month and feels correct.
Wilhelm
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#64275
; Package
emacs
.
(Sun, 30 Jul 2023 12:11:01 GMT)
Full text and
rfc822 format available.
Message #23 received at 64275 <at> debbugs.gnu.org (full text, mbox):
On 30/07/2023 10:53, Wilhelm Kirschbaum wrote:
>> With the new patch, it will continue highlight the sigil name ("r") in
>> regexps, but no in other sigil types (s/c/w).
>>
>
> Incorrect, just below there is a:
>
> (sigil) @font-lock-string-face)
>
> without a match, so they will be highlighted, but just more generically
> as we don't know which sigils the user might have assigned.
Why not add elixir-ts-font-sigil-name-face in that matcher as well?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#64275
; Package
emacs
.
(Mon, 31 Jul 2023 07:28:01 GMT)
Full text and
rfc822 format available.
Message #26 received at 64275 <at> debbugs.gnu.org (full text, mbox):
Dmitry Gutov <dmitry <at> gutov.dev> writes:
> On 30/07/2023 10:53, Wilhelm Kirschbaum wrote:
>>> With the new patch, it will continue highlight the sigil name
>>> ("r") in
>>> regexps, but no in other sigil types (s/c/w).
>>>
>> Incorrect, just below there is a:
>> (sigil) @font-lock-string-face)
>> without a match, so they will be highlighted, but just more
>> generically
>> as we don't know which sigils the user might have assigned.
>
> Why not add elixir-ts-font-sigil-name-face in that matcher as
> well?
I think it is worth keeping the default/fallback case as simple as
possible and if there is a need to add special font to more
specific
cases. In this case it would have no impact if the font is not
customized. Is there a reason you believe it would be better?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#64275
; Package
emacs
.
(Tue, 01 Aug 2023 12:00:02 GMT)
Full text and
rfc822 format available.
Message #29 received at 64275 <at> debbugs.gnu.org (full text, mbox):
On 31/07/2023 10:22, Wilhelm Kirschbaum wrote:
> I think it is worth keeping the default/fallback case as simple as
> possible and if there is a need to add special font to more specific
> cases.
But the font is called elixir-ts-font-sigil-name-face. It should apply
to all sigils, shouldn't it?
At least if we just go by the name.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#64275
; Package
emacs
.
(Wed, 02 Aug 2023 06:41:01 GMT)
Full text and
rfc822 format available.
Message #32 received at 64275 <at> debbugs.gnu.org (full text, mbox):
Dmitry Gutov <dmitry <at> gutov.dev> writes:
> On 31/07/2023 10:22, Wilhelm Kirschbaum wrote:
>> I think it is worth keeping the default/fallback case as simple
>> as
>> possible and if there is a need to add special font to more
>> specific
>> cases.
>
> But the font is called elixir-ts-font-sigil-name-face. It should
> apply
> to all sigils, shouldn't it?
>
> At least if we just go by the name.
Sure, but need to tweak it a bit when I have time. Maybe there is
a way
to match in the query without applying a font, then it will look a
bit
more sensible.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#64275
; Package
emacs
.
(Wed, 16 Aug 2023 02:12:01 GMT)
Full text and
rfc822 format available.
Message #35 received at 64275 <at> debbugs.gnu.org (full text, mbox):
On 02/08/2023 09:38, Wilhelm Kirschbaum wrote:
>
> Dmitry Gutov <dmitry <at> gutov.dev> writes:
>
>> On 31/07/2023 10:22, Wilhelm Kirschbaum wrote:
>>> I think it is worth keeping the default/fallback case as simple as
>>> possible and if there is a need to add special font to more specific
>>> cases.
>>
>> But the font is called elixir-ts-font-sigil-name-face. It should apply
>> to all sigils, shouldn't it?
>>
>> At least if we just go by the name.
>
> Sure, but need to tweak it a bit when I have time. Maybe there is a way
> to match in the query without applying a font, then it will look a bit
> more sensible.
I'm not sure what you meant by the last sentence, sorry. What do you
think about the below?
(sigil (sigil_name) @elixir-ts-font-sigil-name-face)
@font-lock-string-face)
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#64275
; Package
emacs
.
(Sat, 07 Oct 2023 08:54:01 GMT)
Full text and
rfc822 format available.
Message #38 received at 64275 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Dmitry Gutov <dmitry <at> gutov.dev> writes:
> On 02/08/2023 09:38, Wilhelm Kirschbaum wrote:
>> Dmitry Gutov <dmitry <at> gutov.dev> writes:
>>
>>> On 31/07/2023 10:22, Wilhelm Kirschbaum wrote:
>>>> I think it is worth keeping the default/fallback case as
>>>> simple as
>>>> possible and if there is a need to add special font to more
>>>> specific
>>>> cases.
>>>
>>> But the font is called elixir-ts-font-sigil-name-face. It
>>> should apply
>>> to all sigils, shouldn't it?
>>>
>>> At least if we just go by the name.
>> Sure, but need to tweak it a bit when I have time. Maybe there
>> is a
>> way
>> to match in the query without applying a font, then it will
>> look a bit
>> more sensible.
>
> I'm not sure what you meant by the last sentence, sorry. What do
> you
> think about the below?
>
> (sigil (sigil_name) @elixir-ts-font-sigil-name-face)
> @font-lock-string-face)
Sorry for the late reply. I believe the following patch is more
appropriate as it will apply the sigil font to the entire sigil,
but
also respect the regex face. We can add string specific matches
later,
but happy just to simplify what we have and fix apply appropriate
font
to previously unmatched sigils.
[0001-Simplify-sigil-font-lock-match-for-elixir-ts-mode.patch (text/x-patch, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#64275
; Package
emacs
.
(Sat, 07 Oct 2023 10:04:02 GMT)
Full text and
rfc822 format available.
Message #41 received at 64275 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
>>
>> I'm not sure what you meant by the last sentence, sorry. What
>> do you
>> think about the below?
>>
>> (sigil (sigil_name) @elixir-ts-font-sigil-name-face)
>> @font-lock-string-face)
>
> Sorry for the late reply. I believe the following patch is more
> appropriate as it will apply the sigil font to the entire sigil,
> but
> also respect the regex face. We can add string specific matches
> later,
> but happy just to simplify what we have and fix apply
> appropriate font
> to previously unmatched sigils.
>
> [2. text/x-patch;
> 0001-Simplify-sigil-font-lock-match-for-elixir-ts-mode.patch]...
Actually, the above patch breaks the embedded HEEx sigils' font.
We
have to exclude it when doing a general match. Attached works
with ~H
sigils as well. Please ignore the previous patch and install this
one.
[0001-Simplify-sigil-font-lock-match-for-elixir-ts-mode(1).patch (text/x-patch, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#64275
; Package
emacs
.
(Sat, 07 Oct 2023 10:13:01 GMT)
Full text and
rfc822 format available.
Message #44 received at 64275 <at> debbugs.gnu.org (full text, mbox):
Wilhelm Kirschbaum <wkirschbaum <at> gmail.com> writes:
>>>
>>> I'm not sure what you meant by the last sentence, sorry. What
>>> do
>>> you
>>> think about the below?
>>>
>>> (sigil (sigil_name) @elixir-ts-font-sigil-name-face)
>>> @font-lock-string-face)
>>
>> Sorry for the late reply. I believe the following patch is
>> more
>> appropriate as it will apply the sigil font to the entire
>> sigil, but
>> also respect the regex face. We can add string specific
>> matches
>> later,
>> but happy just to simplify what we have and fix apply
>> appropriate
>> font
>> to previously unmatched sigils.
>>
>> [2. text/x-patch;
>> 0001-Simplify-sigil-font-lock-match-for-elixir-ts-mode.patch]...
>
> Actually, the above patch breaks the embedded HEEx sigils'
> font. We
> have to exclude it when doing a general match. Attached works
> with ~H
> sigils as well. Please ignore the previous patch and install
> this
> one.
>
> [2. text/x-patch;
> 0001-Simplify-sigil-font-lock-match-for-elixir-ts-mode(1).patch]...
Sorry :(. I am finding more edge cases. Maybe let me test it this
properly this week before we make any changes.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#64275
; Package
emacs
.
(Sat, 21 Oct 2023 07:41:02 GMT)
Full text and
rfc822 format available.
Message #47 received at 64275 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
> >>>
> >>> I'm not sure what you meant by the last sentence, sorry. What
> >>> do
> >>> you
> >>> think about the below?
> >>>
> >>> (sigil (sigil_name) @elixir-ts-font-sigil-name-face)
> >>> @font-lock-string-face)
> >>
> >> Sorry for the late reply. I believe the following patch is
> >> more
> >> appropriate as it will apply the sigil font to the entire
> >> sigil, but
> >> also respect the regex face. We can add string specific
> >> matches
> >> later,
> >> but happy just to simplify what we have and fix apply
> >> appropriate
> >> font
> >> to previously unmatched sigils.
> >>
> >> [2. text/x-patch;
> >> 0001-Simplify-sigil-font-lock-match-for-elixir-ts-mode.patch]...
> >
> > Actually, the above patch breaks the embedded HEEx sigils'
> > font. We
> > have to exclude it when doing a general match. Attached works
> > with ~H
> > sigils as well. Please ignore the previous patch and install
> > this
> > one.
> >
> > [2. text/x-patch;
> > 0001-Simplify-sigil-font-lock-match-for-elixir-ts-mode(1).patch]...
>
>
> Sorry :(. I am finding more edge cases. Maybe let me test it this
> properly this week before we make any changes.
>
I tested this patch for a while now and it looks like the best approach
for handling regex sigils, but with an appropriate fallback.
If this can be installed, it will be appreciated.
[Message part 2 (text/html, inline)]
[0001-Simplify-sigil-font-lock-match-for-elixir-ts-mode.patch (text/x-patch, attachment)]
Reply sent
to
Dmitry Gutov <dmitry <at> gutov.dev>
:
You have taken responsibility.
(Thu, 26 Oct 2023 00:28:01 GMT)
Full text and
rfc822 format available.
Notification sent
to
Wilhelm Kirschbaum <wkirschbaum <at> gmail.com>
:
bug acknowledged by developer.
(Thu, 26 Oct 2023 00:28:02 GMT)
Full text and
rfc822 format available.
Message #52 received at 64275-done <at> debbugs.gnu.org (full text, mbox):
On 21/10/2023 10:39, Wilhelm Kirschbaum wrote:
>
> >>>
> >>> I'm not sure what you meant by the last sentence, sorry. What
> >>> do
> >>> you
> >>> think about the below?
> >>>
> >>> (sigil (sigil_name) @elixir-ts-font-sigil-name-face)
> >>> @font-lock-string-face)
> >>
> >> Sorry for the late reply. I believe the following patch is
> >> more
> >> appropriate as it will apply the sigil font to the entire
> >> sigil, but
> >> also respect the regex face. We can add string specific
> >> matches
> >> later,
> >> but happy just to simplify what we have and fix apply
> >> appropriate
> >> font
> >> to previously unmatched sigils.
> >>
> >> [2. text/x-patch;
> >> 0001-Simplify-sigil-font-lock-match-for-elixir-ts-mode.patch]...
> >
> > Actually, the above patch breaks the embedded HEEx sigils'
> > font. We
> > have to exclude it when doing a general match. Attached works
> > with ~H
> > sigils as well. Please ignore the previous patch and install
> > this
> > one.
> >
> > [2. text/x-patch;
> > 0001-Simplify-sigil-font-lock-match-for-elixir-ts-mode(1).patch]...
>
>
> Sorry :(. I am finding more edge cases. Maybe let me test it this
> properly this week before we make any changes.
>
>
> I tested this patch for a while now and it looks like the best approach
> for handling regex sigils, but with an appropriate fallback.
>
> If this can be installed, it will be appreciated.
Thanks! Installed, and closing.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Thu, 23 Nov 2023 12:24:09 GMT)
Full text and
rfc822 format available.
This bug report was last modified 1 year and 167 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.