Subject: bug#64275: closed (Re: bug#64275: 30.0.50; [PATCH] Improve sigil font-lock match for elixir-ts-mode)

From: [email-masked] (GNU bug Tracking System)
Date: Thu, 26 Oct 2023 00:28:02 +0000

Your bug report

#64275: 30.0.50; [PATCH] Improve sigil font-lock match for elixir-ts-mode

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
64275: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=64275
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#64275: 30.0.50; [PATCH] Improve sigil font-lock match for elixir-ts-mode
From: Dmitry Gutov <[email-masked]>
To: Wilhelm Kirschbaum <[email-masked]>
Cc: Basil Contovounesios <[email-masked]>, [email-masked]
Date: Thu, 26 Oct 2023 03:27:13 +0300
List-Id: <debbugs-submit.debbugs.gnu.org>

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.

Subject: 30.0.50; [PATCH] Improve sigil font-lock match for elixir-ts-mode
From: Wilhelm Kirschbaum <[email-masked]>
To: [email-masked]
Date: Sat, 24 Jun 2023 22:14:17 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

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 <[email-masked]>
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

Wilhelm