emacs-languagetool / eglot-ltex

Eglot Clients for LTEX
GNU General Public License v3.0
32 stars 7 forks source link

How can I change servers? #12

Open maikol-solis opened 3 months ago

maikol-solis commented 3 months ago

Hi. Thanks for this package, it's very useful.

There is just a little glitch that I don't understand.

In these lines, https://github.com/emacs-languagetool/eglot-ltex/blob/b61e36fad79c03ef3c1acc3c3366df7fc223aed8/eglot-ltex.el#L94-L95

the eglot-ltex adds all the registered modes into eglot-server-programs.

However, I think is will be worthy using the eglot-alternatives command .

According to the documentation

If you have fools and phewls installed, the function produced by eglot-alternatives will prompt for the server to use in foo-mode buffers. Else it will use whichever is available.

So, for example, if I'm in a latex buffer, and start eglot I can choose between texlab or ltex depending on the task that I need to do.

WDYT?

maikol-solis commented 3 months ago

As temporary solution, I have this in my config.el

  (add-to-list 'eglot-server-programs
               `((latex-mode :language-id "latex")
                 . ,(eglot-alternatives '(("texlab")
                                          ("ltex-ls")))))
jcs090218 commented 3 months ago

It sounds like a great idea. What do you have in mind? 🤔 Feel free to open PRs for this.

maikol-solis commented 3 months ago

Nothing in concrete yet. I don't if we can modify any element on the list of servers in the eglot.el.

In the worst case, we need to copy all the servers for the affected modes (markdown, latex, etc.) and put them at the top of eglot-server-programs