emacs-grammarly / eglot-grammarly

Eglot Clients for Grammarly
GNU General Public License v3.0
29 stars 6 forks source link

avoid auto start eglot? #12

Closed uliw closed 8 months ago

uliw commented 8 months ago

Currently, I have

:hook ((text-mode markdown-mode). (lambda ()
                      (require 'eglot-grammarly)
                      (eglot-ensure)))

However, eglot-ensure will start the server whenever I enter a markdown buffer. However, that is only sometimes desirable. Is there a way to associate eglot-grammarly with a given mode without starting it right away?

jcs090218 commented 8 months ago

You would have to call it manually M-x eglot.

uliw commented 8 months ago

yep, but then I get:

[eglot] Couldn't guess LSP server for `org-mode'
Enter program to execute (or <host>:<port>): 

So how to make the connection between the mode and the server without starting it right away?

jcs090218 commented 8 months ago

You would need this only then:

(require 'eglot-grammarly)
uliw commented 8 months ago

splendid, the following works as hoped. Thx!

(use-package eglot-grammarly
  :straight (:host github :repo "emacs-grammarly/eglot-grammarly")
  :defer t  ; defer package loading
  :hook ((text-mode markdown-mode). (lambda ()
                      (require 'eglot-grammarly)))
  :hook ((text-mode org-mode). (lambda ()
                 (require 'eglot-grammarly)))
  )