aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJavier Olaechea <pirata@gmail.com>2025-01-15 19:48:42 -0500
committerLiliana Marie Prikler <liliana.prikler@gmail.com>2025-01-19 13:06:09 +0100
commit5aa63d06a9348c9fcd907916488e8840b6d21bc2 (patch)
treee78c84f10d18a9ed5d78e545264c076c003dd3f6
parent56dff9d30386bea657975550a07a4871bf31114d (diff)
downloadguix-5aa63d06a9348c9fcd907916488e8840b6d21bc2.tar.gz
guix-5aa63d06a9348c9fcd907916488e8840b6d21bc2.zip
gnu: emacs-eglot-x: Fix compatibility with emacs-eglot.
The current emacs-eglot-x version we package is broken when used with an eglot version higher than 1.16 (emacs-eglot is currently at version 1.17). Upstream has an as-of-yet unreleased fix, so let's backport that to our package. * gnu/packages/patches/emacs-eglot-x-fix-apply-text-edits.patch: New file. * gnu/local.mk (dist_patch_DATA): Register it here. * gnu/packages/emacs-xyz.scm (emacs-eglot-x)[patches]: Use it here. Change-Id: Id39f4805dc37902048139049785a4f7852202a8c Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
-rw-r--r--gnu/local.mk1
-rw-r--r--gnu/packages/emacs-xyz.scm6
-rw-r--r--gnu/packages/patches/emacs-eglot-x-fix-apply-text-edits.patch23
3 files changed, 29 insertions, 1 deletions
diff --git a/gnu/local.mk b/gnu/local.mk
index 080d3e2c22..e06a605712 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1207,6 +1207,7 @@ dist_patch_DATA = \
%D%/packages/patches/emacs-deferred-fix-number-of-arguments.patch \
%D%/packages/patches/emacs-elpy-dup-test-name.patch \
%D%/packages/patches/emacs-disable-jit-compilation.patch \
+ %D%/packages/patches/emacs-eglot-x-fix-apply-text-edits.patch \
%D%/packages/patches/emacs-exec-path.patch \
%D%/packages/patches/emacs-fix-scheme-indent-function.patch \
%D%/packages/patches/emacs-helpful-fix-tests.patch \
diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index 5b26f13497..0d808a2bff 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -21505,7 +21505,11 @@ one if it fails.")
(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".