From 44ebd9cbd56b820ad5b014b442b5a9142e8cac89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20T=C3=A1vora?= Date: Thu, 27 Apr 2023 21:08:17 +0100 Subject: [PATCH] Eglot: explain how to update Eglot in manual (bug#62720) * lisp/progmodes/eglot.el (eglot-update): New command. * doc/misc/eglot.texi (Troubleshooting): Rework. --- doc/misc/eglot.texi | 32 +++++++++++++++++++++++++++++++- lisp/progmodes/eglot.el | 13 +++++++++++-- 2 files changed, 42 insertions(+), 3 deletions(-) diff --git a/doc/misc/eglot.texi b/doc/misc/eglot.texi index fc5449b0e8d..4599b78ba56 100644 --- a/doc/misc/eglot.texi +++ b/doc/misc/eglot.texi @@ -1265,7 +1265,7 @@ is serialized by Eglot to the following JSON text: @chapter Troubleshooting Eglot @cindex troubleshooting Eglot -This section documents commands and variables that can be used to +This chapter documents commands and variables that can be used to troubleshoot Eglot problems. It also provides guidelines for reporting Eglot bugs in a way that facilitates their resolution. @@ -1275,6 +1275,8 @@ pop up special buffers that can be used to inspect the communications between the Eglot and language server. In many cases, this will indicate the problems or at least provide a hint. +@node Performance +@section Performance @cindex performance A common and easy-to-fix cause of performance problems is the length of the Eglot events buffer because it represent additional work that @@ -1289,6 +1291,30 @@ techniques to improve their performance. Often, this can be tweaked by changing the server configuration (@pxref{Advanced server configuration}). +@node Getting the latest version +@section Getting the latest version +@cindex updating Eglot + +To install the latest Eglot on an Emacs version that does not bundle +Eglot, use @kbd{M-x package-install}. + +Often, a newer Eglot version exists that has fixed a longstanding bug, +has more LSP features, or just better support for a particular +language server. Recent Eglot versions can self-update via the +command @kbd{M-x eglot-update}. This will replace any currently +installed version with the newest one available from the ELPA archives +configured in @code{package-archives}. + +You may update though other methods, such as @code{package-install}, +@code{use-package}, @code{list-packages} or the newer +@code{package-update}. However, do read the docstrings of these +commands, as some may not work in exactly the same way across Emacs +versions, meaning your configuration may be not portable. + +@node Reporting bugs +@section Reporting bugs +@cindex bug reports + If you think you have found a bug, we want to hear about it. Before reporting a bug, keep in mind that interaction with language servers represents a large quantity of unknown variables. Therefore, it is @@ -1332,6 +1358,10 @@ public Git repository. Include versions of the software used. The Emacs version can be obtained with @kbd{M-x emacs-version}. +We welcome bug reports about all Eglot versions, but it is helpful to +first check if the problem isn't already fixed in the latest version +(@pxref{Getting the latest version}). + It's also essential to include the version of ELPA packages that are explicitly or implicitly loaded. The optional but popular Company or Markdown packages are distributed as GNU ELPA packages, not to mention diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index 0fab8db0e83..f005c4858e7 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -1966,6 +1966,16 @@ If it is activated, also signal textDocument/didOpen." (declare (obsolete info "29.1")) (interactive) (info "(eglot)")) +;;;###autoload +(defun eglot-update (&rest _) "Update Eglot." + (interactive) + (with-no-warnings + (require 'package) + (unless package-archive-contents (package-refresh-contents)) + (when-let ((existing (cadr (assoc 'eglot package-alist)))) + (package-delete existing t)) + (package-install (cadr (assoc 'eglot package-archive-contents))))) + (easy-menu-define eglot-menu nil "Eglot" `("Eglot" ;; Commands for getting information and customization. @@ -3056,8 +3066,7 @@ for which LSP on-type-formatting should be requested." (funcall snippet-fn (or insertText label)))) (when (cl-plusp (length additionalTextEdits)) (eglot--apply-text-edits additionalTextEdits))) - (eglot--signal-textDocument/didChange) - (eldoc))))))))) + (eglot--signal-textDocument/didChange))))))))) (defun eglot--hover-info (contents &optional _range) (mapconcat #'eglot--format-markup