all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#64275: 30.0.50; [PATCH] Improve sigil font-lock match for elixir-ts-mode
@ 2023-06-24 20:14 Wilhelm Kirschbaum
  2023-06-25  8:53 ` Basil Contovounesios via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 16+ messages in thread
From: Wilhelm Kirschbaum @ 2023-06-24 20:14 UTC (permalink / raw)
  To: 64275

[-- Attachment #1: Type: text/plain, Size: 164 bytes --]


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.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-eglot-imenu-when-the-server-does-not-support-it.patch --]
[-- Type: text/x-patch, Size: 2202 bytes --]

From 9a1389305d92f0e08d39d2ff5540cb494c012f12 Mon Sep 17 00:00:00 2001
From: Wilhelm H Kirschbaum <wkirschbaum@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

A language server might not support textDocument/documentSymbol, so we
need to check first.

* lisp/progmodes/eglot.el (eglot-imenu): Check for the
textDocument/documentSymbol capability before requesting.
---
 lisp/progmodes/eglot.el | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
index e2478f2dde3..265cfc88579 100644
--- a/lisp/progmodes/eglot.el
+++ b/lisp/progmodes/eglot.el
@@ -3351,16 +3351,17 @@ eglot--imenu-DocumentSymbol
 (defun eglot-imenu ()
   "Eglot's `imenu-create-index-function'.
 Returns a list as described in docstring of `imenu--index-alist'."
-  (let* ((res (eglot--request (eglot--current-server-or-lose)
-                              :textDocument/documentSymbol
-                              `(:textDocument
-                                ,(eglot--TextDocumentIdentifier))
-                              :cancel-on-input non-essential))
-         (head (and (cl-plusp (length res)) (elt res 0))))
-    (when head
-      (eglot--dcase head
-        (((SymbolInformation)) (eglot--imenu-SymbolInformation res))
-        (((DocumentSymbol)) (eglot--imenu-DocumentSymbol res))))))
+  (when (eglot--server-capable :textDocument/documentSymbol)
+    (let* ((res (eglot--request (eglot--current-server-or-lose)
+                                :textDocument/documentSymbol
+                                `(:textDocument
+                                  ,(eglot--TextDocumentIdentifier))
+                                :cancel-on-input non-essential))
+           (head (and (cl-plusp (length res)) (elt res 0))))
+      (when head
+        (eglot--dcase head
+          (((SymbolInformation)) (eglot--imenu-SymbolInformation res))
+          (((DocumentSymbol)) (eglot--imenu-DocumentSymbol res)))))))
 
 (cl-defun eglot--apply-text-edits (edits &optional version)
   "Apply EDITS for current buffer if at VERSION, or if it's nil."
-- 
2.41.0


[-- Attachment #3: Type: text/plain, Size: 9 bytes --]


Wilhelm

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* bug#64275: 30.0.50; [PATCH] Improve sigil font-lock match for elixir-ts-mode
  2023-06-24 20:14 bug#64275: 30.0.50; [PATCH] Improve sigil font-lock match for elixir-ts-mode Wilhelm Kirschbaum
@ 2023-06-25  8:53 ` Basil Contovounesios via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2023-06-25  9:00   ` Wilhelm Kirschbaum
  0 siblings, 1 reply; 16+ messages in thread
From: Basil Contovounesios via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-06-25  8:53 UTC (permalink / raw)
  To: Wilhelm Kirschbaum; +Cc: 64275

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@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





^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#64275: 30.0.50; [PATCH] Improve sigil font-lock match for elixir-ts-mode
  2023-06-25  8:53 ` Basil Contovounesios via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2023-06-25  9:00   ` Wilhelm Kirschbaum
  2023-07-29 18:31     ` Wilhelm Kirschbaum
  2023-07-30  2:06     ` Dmitry Gutov
  0 siblings, 2 replies; 16+ messages in thread
From: Wilhelm Kirschbaum @ 2023-06-25  9:00 UTC (permalink / raw)
  To: Basil Contovounesios; +Cc: 64275

[-- Attachment #1: Type: text/plain, Size: 111 bytes --]



> Looks like the patch from bug#64274 was attached instead.

Ah, sorry. Here is the correct patch.

Wilhelm


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Update-sigil-font-lock-match-for-elixir-ts-mode.patch --]
[-- Type: text/x-patch, Size: 1498 bytes --]

From 20dd06d1cac05e775ce9f143550483cd2ad1a9ee Mon Sep 17 00:00:00 2001
From: Wilhelm H Kirschbaum <wkirschbaum@gmail.com>
Date: Mon, 22 May 2023 08:53:24 +0200
Subject: [PATCH 1/3] Update sigil font-lock match for elixir-ts-mode

There is no need to match on specific sigils, except for regex.

* lisp/progmodes/elixir-ts-mode.el
(elixir-ts--font-lock-settings): Update sigil match.
---
 lisp/progmodes/elixir-ts-mode.el | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/lisp/progmodes/elixir-ts-mode.el b/lisp/progmodes/elixir-ts-mode.el
index 7175fe4bff8..54b9740858f 100644
--- a/lisp/progmodes/elixir-ts-mode.el
+++ b/lisp/progmodes/elixir-ts-mode.el
@@ -458,21 +458,11 @@ elixir-ts--font-lock-settings
    :feature 'elixir-sigil
    :override t
    `((sigil
-      (sigil_name) @elixir-ts-font-sigil-name-face
-      (:match "^[sSwWpPUD]$" @elixir-ts-font-sigil-name-face))
-     @font-lock-string-face
-     (sigil
       "~" @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)
    :language 'elixir
    :feature 'elixir-string-escape
    :override t
-- 
2.41.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* bug#64275: 30.0.50; [PATCH] Improve sigil font-lock match for elixir-ts-mode
  2023-06-25  9:00   ` Wilhelm Kirschbaum
@ 2023-07-29 18:31     ` Wilhelm Kirschbaum
  2023-07-30  2:06     ` Dmitry Gutov
  1 sibling, 0 replies; 16+ messages in thread
From: Wilhelm Kirschbaum @ 2023-07-29 18:31 UTC (permalink / raw)
  To: Basil Contovounesios; +Cc: 64275


Wilhelm Kirschbaum <wkirschbaum@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?





^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#64275: 30.0.50; [PATCH] Improve sigil font-lock match for elixir-ts-mode
  2023-06-25  9:00   ` Wilhelm Kirschbaum
  2023-07-29 18:31     ` Wilhelm Kirschbaum
@ 2023-07-30  2:06     ` Dmitry Gutov
  2023-07-30  7:53       ` Wilhelm Kirschbaum
  1 sibling, 1 reply; 16+ messages in thread
From: Dmitry Gutov @ 2023-07-30  2:06 UTC (permalink / raw)
  To: Wilhelm Kirschbaum, Basil Contovounesios; +Cc: 64275

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?





^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#64275: 30.0.50; [PATCH] Improve sigil font-lock match for elixir-ts-mode
  2023-07-30  2:06     ` Dmitry Gutov
@ 2023-07-30  7:53       ` Wilhelm Kirschbaum
  2023-07-30 12:09         ` Dmitry Gutov
  0 siblings, 1 reply; 16+ messages in thread
From: Wilhelm Kirschbaum @ 2023-07-30  7:53 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: Basil Contovounesios, 64275


Dmitry Gutov <dmitry@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






^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#64275: 30.0.50; [PATCH] Improve sigil font-lock match for elixir-ts-mode
  2023-07-30  7:53       ` Wilhelm Kirschbaum
@ 2023-07-30 12:09         ` Dmitry Gutov
  2023-07-31  7:22           ` Wilhelm Kirschbaum
  0 siblings, 1 reply; 16+ messages in thread
From: Dmitry Gutov @ 2023-07-30 12:09 UTC (permalink / raw)
  To: Wilhelm Kirschbaum; +Cc: Basil Contovounesios, 64275

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?





^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#64275: 30.0.50; [PATCH] Improve sigil font-lock match for elixir-ts-mode
  2023-07-30 12:09         ` Dmitry Gutov
@ 2023-07-31  7:22           ` Wilhelm Kirschbaum
  2023-08-01 11:59             ` Dmitry Gutov
  0 siblings, 1 reply; 16+ messages in thread
From: Wilhelm Kirschbaum @ 2023-07-31  7:22 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: Basil Contovounesios, 64275


Dmitry Gutov <dmitry@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?





^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#64275: 30.0.50; [PATCH] Improve sigil font-lock match for elixir-ts-mode
  2023-07-31  7:22           ` Wilhelm Kirschbaum
@ 2023-08-01 11:59             ` Dmitry Gutov
  2023-08-02  6:38               ` Wilhelm Kirschbaum
  0 siblings, 1 reply; 16+ messages in thread
From: Dmitry Gutov @ 2023-08-01 11:59 UTC (permalink / raw)
  To: Wilhelm Kirschbaum; +Cc: Basil Contovounesios, 64275

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.





^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#64275: 30.0.50; [PATCH] Improve sigil font-lock match for elixir-ts-mode
  2023-08-01 11:59             ` Dmitry Gutov
@ 2023-08-02  6:38               ` Wilhelm Kirschbaum
  2023-08-16  2:11                 ` Dmitry Gutov
  0 siblings, 1 reply; 16+ messages in thread
From: Wilhelm Kirschbaum @ 2023-08-02  6:38 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: Basil Contovounesios, 64275


Dmitry Gutov <dmitry@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.





^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#64275: 30.0.50; [PATCH] Improve sigil font-lock match for elixir-ts-mode
  2023-08-02  6:38               ` Wilhelm Kirschbaum
@ 2023-08-16  2:11                 ` Dmitry Gutov
  2023-10-07  8:46                   ` Wilhelm Kirschbaum
  0 siblings, 1 reply; 16+ messages in thread
From: Dmitry Gutov @ 2023-08-16  2:11 UTC (permalink / raw)
  To: Wilhelm Kirschbaum; +Cc: Basil Contovounesios, 64275

On 02/08/2023 09:38, Wilhelm Kirschbaum wrote:
> 
> Dmitry Gutov <dmitry@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)





^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#64275: 30.0.50; [PATCH] Improve sigil font-lock match for elixir-ts-mode
  2023-08-16  2:11                 ` Dmitry Gutov
@ 2023-10-07  8:46                   ` Wilhelm Kirschbaum
  2023-10-07  9:59                     ` Wilhelm Kirschbaum
  0 siblings, 1 reply; 16+ messages in thread
From: Wilhelm Kirschbaum @ 2023-10-07  8:46 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: Basil Contovounesios, 64275

[-- Attachment #1: Type: text/plain, Size: 1243 bytes --]


Dmitry Gutov <dmitry@gutov.dev> writes:

> On 02/08/2023 09:38, Wilhelm Kirschbaum wrote:
>> Dmitry Gutov <dmitry@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.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Simplify-sigil-font-lock-match-for-elixir-ts-mode.patch --]
[-- Type: text/x-patch, Size: 1602 bytes --]

From 9f6e5f143c2d247541172851ac9f09dcc6add010 Mon Sep 17 00:00:00 2001
From: Wilhelm H Kirschbaum <wkirschbaum@gmail.com>
Date: Sat, 7 Oct 2023 10:37:49 +0200
Subject: [PATCH] Simplify sigil font-lock match for elixir-ts-mode

There is no need to match on specific sigils, except for regex.

* lisp/progmodes/elixir-ts-mode.el
(elixir-ts--font-lock-settings): Update sigil match.
---
 lisp/progmodes/elixir-ts-mode.el | 17 +++--------------
 1 file changed, 3 insertions(+), 14 deletions(-)

diff --git a/lisp/progmodes/elixir-ts-mode.el b/lisp/progmodes/elixir-ts-mode.el
index 2ddce3de105..8a678b110e2 100644
--- a/lisp/progmodes/elixir-ts-mode.el
+++ b/lisp/progmodes/elixir-ts-mode.el
@@ -468,21 +468,10 @@ elixir-ts--font-lock-settings
    :feature 'elixir-sigil
    :override t
    `((sigil
-      (sigil_name) @elixir-ts-font-sigil-name-face
-      (:match "^[sSwWpPUD]$" @elixir-ts-font-sigil-name-face))
-     @font-lock-string-face
-     (sigil
-      "~" @font-lock-string-face
-      (sigil_name) @elixir-ts-font-sigil-name-face
-      (:match "^[rR]$" @elixir-ts-font-sigil-name-face))
+      (sigil_name) @font-lock-regexp-face
+      (:match "^[rR]$" @font-lock-regexp-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) @elixir-ts-font-sigil-name-face)
    :language 'elixir
    :feature 'elixir-string-escape
    :override t
-- 
2.42.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* bug#64275: 30.0.50; [PATCH] Improve sigil font-lock match for elixir-ts-mode
  2023-10-07  8:46                   ` Wilhelm Kirschbaum
@ 2023-10-07  9:59                     ` Wilhelm Kirschbaum
  2023-10-07 10:10                       ` Wilhelm Kirschbaum
  0 siblings, 1 reply; 16+ messages in thread
From: Wilhelm Kirschbaum @ 2023-10-07  9:59 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: Basil Contovounesios, 64275

[-- Attachment #1: Type: text/plain, Size: 831 bytes --]


>>
>> 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.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Simplify-sigil-font-lock-match-for-elixir-ts-mode(1).patch --]
[-- Type: text/x-patch, Size: 1750 bytes --]

From 12b7227185e22923d1e67e3f5a47af97879e2ad2 Mon Sep 17 00:00:00 2001
From: Wilhelm H Kirschbaum <wkirschbaum@gmail.com>
Date: Sat, 7 Oct 2023 10:37:49 +0200
Subject: [PATCH] Simplify sigil font-lock match for elixir-ts-mode

There is no need to match on specific sigils, except for regex.

* lisp/progmodes/elixir-ts-mode.el
(elixir-ts--font-lock-settings): Update sigil match.
---
 lisp/progmodes/elixir-ts-mode.el | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/lisp/progmodes/elixir-ts-mode.el b/lisp/progmodes/elixir-ts-mode.el
index 2ddce3de105..de078454463 100644
--- a/lisp/progmodes/elixir-ts-mode.el
+++ b/lisp/progmodes/elixir-ts-mode.el
@@ -466,23 +466,19 @@ elixir-ts--font-lock-settings
 
    :language 'elixir
    :feature 'elixir-sigil
-   :override t
    `((sigil
-      (sigil_name) @elixir-ts-font-sigil-name-face
-      (:match "^[sSwWpPUD]$" @elixir-ts-font-sigil-name-face))
-     @font-lock-string-face
+      (sigil_name) @font-lock-regexp-face
+      (:match "^[rR]$" @font-lock-regexp-face))
+     @font-lock-regexp-face
      (sigil
-      "~" @font-lock-string-face
       (sigil_name) @elixir-ts-font-sigil-name-face
-      (:match "^[rR]$" @elixir-ts-font-sigil-name-face))
-     @font-lock-regexp-face
+      (:match "^[^HF]$" @elixir-ts-font-sigil-name-face))
+     @elixir-ts-font-sigil-name-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)))
-
+      quoted_end: _ @font-lock-string-face))
    :language 'elixir
    :feature 'elixir-string-escape
    :override t
-- 
2.42.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* bug#64275: 30.0.50; [PATCH] Improve sigil font-lock match for elixir-ts-mode
  2023-10-07  9:59                     ` Wilhelm Kirschbaum
@ 2023-10-07 10:10                       ` Wilhelm Kirschbaum
  2023-10-21  7:39                         ` Wilhelm Kirschbaum
  0 siblings, 1 reply; 16+ messages in thread
From: Wilhelm Kirschbaum @ 2023-10-07 10:10 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: Basil Contovounesios, 64275


Wilhelm Kirschbaum <wkirschbaum@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.





^ permalink raw reply	[flat|nested] 16+ messages in thread

* bug#64275: 30.0.50; [PATCH] Improve sigil font-lock match for elixir-ts-mode
  2023-10-07 10:10                       ` Wilhelm Kirschbaum
@ 2023-10-21  7:39                         ` Wilhelm Kirschbaum
  2023-10-26  0:27                           ` Dmitry Gutov
  0 siblings, 1 reply; 16+ messages in thread
From: Wilhelm Kirschbaum @ 2023-10-21  7:39 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: Basil Contovounesios, 64275


[-- Attachment #1.1: Type: text/plain, Size: 1338 bytes --]

> >>>
> >>> 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.

[-- Attachment #1.2: Type: text/html, Size: 1907 bytes --]

[-- Attachment #2: 0001-Simplify-sigil-font-lock-match-for-elixir-ts-mode.patch --]
[-- Type: text/x-patch, Size: 1299 bytes --]

From ae432650261e60e2b045c46add2a8827e9965ce4 Mon Sep 17 00:00:00 2001
From: Wilhelm H Kirschbaum <wkirschbaum@gmail.com>
Date: Sat, 7 Oct 2023 10:37:49 +0200
Subject: [PATCH] Simplify sigil font-lock match for elixir-ts-mode

There is no need to match on specific sigils, except for regex.

* lisp/progmodes/elixir-ts-mode.el
(elixir-ts--font-lock-settings): Update sigil match.
---
 lisp/progmodes/elixir-ts-mode.el | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/lisp/progmodes/elixir-ts-mode.el b/lisp/progmodes/elixir-ts-mode.el
index 2ddce3de105..05edb4159a1 100644
--- a/lisp/progmodes/elixir-ts-mode.el
+++ b/lisp/progmodes/elixir-ts-mode.el
@@ -469,12 +469,11 @@ elixir-ts--font-lock-settings
    :override t
    `((sigil
       (sigil_name) @elixir-ts-font-sigil-name-face
-      (:match "^[sSwWpPUD]$" @elixir-ts-font-sigil-name-face))
+      (:match "^[^HF]$" @elixir-ts-font-sigil-name-face))
      @font-lock-string-face
      (sigil
-      "~" @font-lock-string-face
-      (sigil_name) @elixir-ts-font-sigil-name-face
-      (:match "^[rR]$" @elixir-ts-font-sigil-name-face))
+      (sigil_name) @font-lock-regexp-face
+      (:match "^[rR]$" @font-lock-regexp-face))
      @font-lock-regexp-face
      (sigil
       "~" @font-lock-string-face
-- 
2.42.0


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* bug#64275: 30.0.50; [PATCH] Improve sigil font-lock match for elixir-ts-mode
  2023-10-21  7:39                         ` Wilhelm Kirschbaum
@ 2023-10-26  0:27                           ` Dmitry Gutov
  0 siblings, 0 replies; 16+ messages in thread
From: Dmitry Gutov @ 2023-10-26  0:27 UTC (permalink / raw)
  To: Wilhelm Kirschbaum; +Cc: Basil Contovounesios, 64275-done

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.





^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2023-10-26  0:27 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-24 20:14 bug#64275: 30.0.50; [PATCH] Improve sigil font-lock match for elixir-ts-mode Wilhelm Kirschbaum
2023-06-25  8:53 ` Basil Contovounesios via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-06-25  9:00   ` Wilhelm Kirschbaum
2023-07-29 18:31     ` Wilhelm Kirschbaum
2023-07-30  2:06     ` Dmitry Gutov
2023-07-30  7:53       ` Wilhelm Kirschbaum
2023-07-30 12:09         ` Dmitry Gutov
2023-07-31  7:22           ` Wilhelm Kirschbaum
2023-08-01 11:59             ` Dmitry Gutov
2023-08-02  6:38               ` Wilhelm Kirschbaum
2023-08-16  2:11                 ` Dmitry Gutov
2023-10-07  8:46                   ` Wilhelm Kirschbaum
2023-10-07  9:59                     ` Wilhelm Kirschbaum
2023-10-07 10:10                       ` Wilhelm Kirschbaum
2023-10-21  7:39                         ` Wilhelm Kirschbaum
2023-10-26  0:27                           ` Dmitry Gutov

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.