]> git.eshelyaron.com Git - emacs.git/commitdiff
Eglot: unbreak completion in Emacs 26.3 (at least)
authorJoão Távora <joaotavora@gmail.com>
Wed, 22 Jan 2025 21:52:56 +0000 (21:52 +0000)
committerEshel Yaron <me@eshelyaron.com>
Thu, 23 Jan 2025 10:28:40 +0000 (11:28 +0100)
For reasons yet to be investigated, in some Emacs older versions,
callers of the completion table created by eglot-completion-at-point
will destroy text properties in the strings returned by the
"all-completions" call (destroy here means completely erase).  This
completely breaks Eglot completion.

(eglot-completion-at-point): Copy substrings in all-completions
call.

(cherry picked from commit 7e2f6ce0cb1e5eb2c686451836275acf234bc354)

lisp/progmodes/eglot.el

index 4b022ca0ebdb66788882aea1bd248525c29ab909..8e889e3363f89a6dbfe0064f9e55d233ac54581c 100644 (file)
@@ -3302,7 +3302,9 @@ for which LSP on-type-formatting should be requested."
              (dolist (c comps) (eglot--dumb-flex pattern c completion-ignore-case))
              (all-completions
               ""
-              comps
+              ;; copy strings, as some older emacs
+              ;; versions will destroy properties.
+              (mapcar #'substring comps)
               (lambda (proxy)
                 (let* ((item (get-text-property 0 'eglot--lsp-item proxy))
                        (filterText (plist-get item :filterText)))