emacs-languagetool / lsp-ltex

lsp-mode ❤️ LTEX
GNU General Public License v3.0
53 stars 8 forks source link

Activating lsp-ltex in other modes #42

Open wehlutyk opened 5 months ago

wehlutyk commented 5 months ago

First of all thanks for lsp-ltex!

I got it running in mu4e's mu4e-compose-mode on doomemacs with the following steps:

Before (use-package! lsp-ltex ...), pre-defining lsp-ltex-active-modes makes lsp-ltex take the change. In my case:

(defcustom lsp-ltex-active-modes
  '(text-mode
    bibtex-mode context-mode
    latex-mode LaTeX-mode ;; AUCTeX 14+ has renamed latex-mode to LaTeX-mode
    markdown-mode org-mode
    rst-mode
    mu4e-compose-mode)
  "List of major mode that work with LTEX Language Server."
  :type 'list
  :group 'lsp-ltex)

At that point lsp works when composing, with the following warning:

Warning (lsp-mode): Unable to calculate the languageId for buffer ‘XXX’. Take a look at ‘lsp-language-id-configuration’. The ‘major-mode’ is mu4e-compose-mode

So adding

(after! lsp-ltex
  (appendq! lsp-language-id-configuration
            '((mu4e-compose-mode . "plaintext"))))

gets that solved.

Could there be a more generic setting for the list of modes activated?

jcs090218 commented 5 months ago

Not as I am aware of. The closest thing I can think of is going through lsp-activate-on. 🤔

wehlutyk commented 5 months ago

Could that change the user config into a one-liner? It's okay as it is otherwise, I can close this.

jcs090218 commented 5 months ago

No, unfortunately. I'll return to this thread once I figure out how.