GNU bug report logs - #79290
30.2; eglot-alternatives doesn't support re-use of same program with different subcommands

Previous Next

Package: emacs;

Reported by: Doug Davis <ddavis <at> ddavis.io>

Date: Fri, 22 Aug 2025 15:39:02 UTC

Severity: normal

Found in version 30.2

Full log


Message #14 received at 79290 <at> debbugs.gnu.org (full text, mbox):

From: Doug Davis <ddavis <at> ddavis.io>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: João Távora <joaotavora <at> gmail.com>,
 79290 <at> debbugs.gnu.org
Subject: Re: bug#79290: 30.2; eglot-alternatives doesn't support re-use of
 same program with different subcommands
Date: Sat, 23 Aug 2025 12:38:17 -0500
Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: Doug Davis <ddavis <at> ddavis.io>
>> Date: Fri, 22 Aug 2025 10:37:38 -0500
>>
>> When writing an `eglot-alternatives' that looks like this:
>>
>>   (add-to-list 'eglot-server-programs
>>                `(python-base-mode
>>                  . ,(eglot-alternatives '(("basedpyright-langserver" "--stdio")
>>                                           ("uv" "run" "pyright-langserver" "--stdio")
>>                                           ("uv" "run" "ty" "server")
>>                                           "jedi-language-server"
>>                                           ("pyright-langserver" "--stdio")))))
>>
>> an invocation of M-x eglot will fail to show the second instance of
>> using uv in the resulting list that appears to be passed on to
>> `completing-read'. (Notice the repeated use of `uv run`
>> https://docs.astral.sh/uv/reference/cli/#uv-run)
>>
>> more info: the benefit of using `uv run` unloads the burden of using
>> emacs to property setup a virtual environment; uv automatically handles
>> running the correct installation of the invoked subcommand.
>
> João, any comments or suggestions?

Below is a patch on master that resolves

  ("server-program" "arg1" "arg2")

to appear as

  "server-program arg1 arg2"

in the completing read; just an idea

diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
index 29e6c269fdf..d97624a33b9 100644
--- a/lisp/progmodes/eglot.el
+++ b/lisp/progmodes/eglot.el
@@ -214,7 +214,7 @@ eglot-alternatives
                                          (let ((found (eglot--executable-find
                                                        (car a) t)))
                                            (and found
-                                                (cons (car a) (cons found (cdr a))))))
+                                                (cons (mapconcat #'identity a " ") (cons found (cdr a))))))
                                        listified))
                     (available (remove nil augmented)))
                (cond ((cdr available)




This bug report was last modified 26 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.