Subject: [bug#75597] [PATCH} gnu: emacs-eglot-x: Update to latest commit

From: Javier Olaechea <[email-masked]>
Date: Fri, 17 Jan 2025 02:09:30 +0000

Thanks for the quick response!

Btw. you reference commit 354150c in your patch but then build from a
> different commit.  Perhaps you could use that single commit as a patch
> instead?
>

I like that better, I've updated the patch to instead apply the patch for
that commit instead along with a note to drop the patch when the next
version of eglot-x is released.

On Thu, Jan 16, 2025 at 7:46 AM Liliana Marie Prikler <
[email-masked]> wrote:

> Yes, please use git-version.
>
> And for anyone else using random commits while coding version without
> it, let this be a reminder to use git-version.
>

Given that now we are using the commit for version 0.6 (which doesn't have
a tag) there is no need to to use git-version. t was only in the case that
we started shipping an unreleased commit as the version, correct?

-- 
"I object to doing things that computers can do." — Olin Shivers
From 0b7653371c0803e03fe04355f3d4e7a247811d51 Mon Sep 17 00:00:00 2001
Message-ID: <[email-masked]>
From: Javier Olaechea <[email-masked]>
Date: Wed, 15 Jan 2025 19:48:42 -0500
Subject: [PATCH v2] gnu: emacs-eglot-x: Backport an unreleased fix

* gnu/packages/emacs-xyz.scm (emacs-eglot-x): Backport an unreleased fix

The current emacs-eglot-x version we package is broken when used with an eglot
version higher than 1.16. We currently ship eglot 1.17. Upstream has fixed
this in the commit 354150, but still hasn't released a new version. We can
apply the fix as stand-alone patch while we wait for them to release a version.

354150c: https://github.com/nemethf/eglot-x/commit/354150c299e241df09c8b904b68177fd9b41fe0e
Change-Id: Id39f4805dc37902048139049785a4f7852202a8c
---
 gnu/packages/emacs-xyz.scm                    |  6 ++++-
 .../emacs-eglot-x-fix-apply-text-edits.patch  | 23 +++++++++++++++++++
 2 files changed, 28 insertions(+), 1 deletion(-)
 create mode 100644 gnu/packages/patches/emacs-eglot-x-fix-apply-text-edits.patch

diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index 9b3139dfa1..1347e73124 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -21480,7 +21480,11 @@ (define-public emacs-eglot-x
                 (file-name (git-file-name name version))
                 (sha256
                  (base32
-                  "0s17nv59gzgqgskid41lfacsqnzdiq2p3ds0vglcfqwypr3k898c"))))
+                  "0s17nv59gzgqgskid41lfacsqnzdiq2p3ds0vglcfqwypr3k898c"))
+                ;; Backporting an unreleased fix from
+                ;; https://github.com/nemethf/eglot-x/commit/354150c299e241df09c8b904b68177fd9b41fe0e
+                ;; Remove this patch once version 0.7 is released
+                (patches (search-patches "emacs-eglot-x-fix-apply-text-edits.patch"))))
       (build-system emacs-build-system)
       (inputs (list emacs-eglot))
       (home-page "https://github.com/nemethf/eglot-x")
diff --git a/gnu/packages/patches/emacs-eglot-x-fix-apply-text-edits.patch b/gnu/packages/patches/emacs-eglot-x-fix-apply-text-edits.patch
new file mode 100644
index 0000000000..b9dcebded3
--- /dev/null
+++ b/gnu/packages/patches/emacs-eglot-x-fix-apply-text-edits.patch
@@ -0,0 +1,23 @@
+diff --git a/eglot-x.el b/eglot-x.el
+index a694f90..221822d 100644
+--- a/eglot-x.el
++++ b/eglot-x.el
+@@ -659,10 +659,17 @@ (defun eglot-x--check-capability (&rest capabilities)
+ 
+ ;;; Snippet TextEdit
+ 
+-(defun eglot-x--apply-text-edits (edits &optional version)
++(defun eglot-x--apply-text-edits (edits &optional version silent)
+   "Apply EDITS for current buffer if at VERSION, or if it's nil.
+ This is almost a verbatim copy of `eglot--apply-text-edits', but
+ it handles the SnippetTextEdit format."
++  ;; NOTE: eglot--apply-text-edits changed a lot since this defun was
++  ;; imlemented.  Additionally, rust-analyzer has changed as well.
++  ;; Now it only sends one SnippetTextEdit.  Hence the implementation
++  ;; should be updated, but "if it ain't broke, don't fix it".  And
++  ;; this whole extension is going to be obsoleted soon:
++  ;; https://github.com/microsoft/language-server-protocol/issues/724#issuecomment-1850413029
++
+   ;; This is quite rust-analyzer specific.  It assumes there is at
+   ;; most one meaningful SnippetTextEdit and that can be identified by
+   ;; searching for "$0".

base-commit: 35d13aab7ebca187343c54b800711bfea02859b9
-- 
2.47.1