diff options
author | João Távora <joaotavora@gmail.com> | 2023-11-07 09:09:30 -0600 |
---|---|---|
committer | João Távora <joaotavora@gmail.com> | 2023-11-07 09:09:44 -0600 |
commit | 3ab99e977db01939cc42f285d5ce58807cf2e7d0 (patch) | |
tree | 3f3e12f65d5dbc4be018d26a125a33563a4bd90a /lisp | |
parent | 361f9fe4152f8dbb2a8c36c97bae13f689b606f0 (diff) | |
download | emacs-3ab99e977db01939cc42f285d5ce58807cf2e7d0.tar.gz emacs-3ab99e977db01939cc42f285d5ce58807cf2e7d0.tar.bz2 emacs-3ab99e977db01939cc42f285d5ce58807cf2e7d0.zip |
Eglot: Demote errors to warnings in eglot-ensure
Github-reference: https://github.com/joaotavora/eglot/discussions/1318
* doc/misc/eglot.texi (Quick Start): Reword.
(Starting Eglot): Reword.
* lisp/progmodes/eglot.el (eglot-ensure): Demote errors to warnings.
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/progmodes/eglot.el | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index eba66503bf7..816f6952d2e 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -1366,7 +1366,18 @@ INTERACTIVE is t if called interactively." ;;;###autoload (defun eglot-ensure () - "Start Eglot session for current buffer if there isn't one." + "Start Eglot session for current buffer if there isn't one. + +Only use this function (in major mode hooks, etc) if you are +confident that Eglot can be started safely and efficiently for +*every* buffer visited where these hooks may execute. + +Since it is difficult to establish this confidence fully, it's +often wise to use the interactive command `eglot' instead. This +command only needs to be invoked once per project, as all other +files of a given major mode visited within the same project will +automatically become managed with no further user intervention +needed." (let ((buffer (current-buffer))) (cl-labels ((maybe-connect @@ -1374,7 +1385,9 @@ INTERACTIVE is t if called interactively." (eglot--when-live-buffer buffer (remove-hook 'post-command-hook #'maybe-connect t) (unless eglot--managed-mode - (apply #'eglot--connect (eglot--guess-contact)))))) + (condition-case-unless-debug oops + (apply #'eglot--connect (eglot--guess-contact)) + (error (eglot--warn (error-message-string oops)))))))) (when buffer-file-name (add-hook 'post-command-hook #'maybe-connect 'append t))))) |