bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#60570: 29.0.60; Eglot+pyright freeze Emacs when edit a single file


From: Yuan Fu
Subject: bug#60570: 29.0.60; Eglot+pyright freeze Emacs when edit a single file in Home director
Date: Thu, 5 Jan 2023 23:17:41 -0700

João Távora <joaotavora@gmail.com> writes:

> 5. Stop opening Python scripts in your $HOME *and* auto-activating Eglot
>    in them.  You may be auto-activating Eglot with eglot-ensure, but this
>    is not recommended precisely because it carries with risks like this.
[...]
>
> I recommend restricting your use of eglot-ensure. It's very overrated
> functionality. M-x eglot will probably only need to be typed once 
> or twice in a typical Emacs session.

I use a custom function eglot-soft-ensure which only enables eglot if
there is already a LSP server running for the current project. This way
eglot doesn’t auto-start in which files that I don’t want it to start.

(defun eglot-soft-ensure ()
  "Turn on eglot when there is an exising server for the current project."
  (require 'eglot)
  (when-let* ((project (project-current))
              (eglot-server (gethash project eglot--servers-by-project)))
    (eglot-ensure)))

Yuan





reply via email to

[Prev in Thread] Current Thread [Next in Thread]