]> git.eshelyaron.com Git - emacs.git/commitdiff
Eglot: explain how to update Eglot in manual (bug#62720)
authorJoão Távora <joaotavora@gmail.com>
Thu, 27 Apr 2023 20:08:17 +0000 (21:08 +0100)
committerJoão Távora <joaotavora@gmail.com>
Thu, 27 Apr 2023 23:39:08 +0000 (00:39 +0100)
* lisp/progmodes/eglot.el (eglot-update): New command.

* doc/misc/eglot.texi (Troubleshooting): Rework.

doc/misc/eglot.texi
lisp/progmodes/eglot.el

index fc5449b0e8d40ef190dfaa760a98edfb59e78903..4599b78ba560e572747aed84c8dd8f4c34e7f93a 100644 (file)
@@ -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
index 0fab8db0e8354fad5fca2ae51031f6a39dd5a78c..f005c4858e75d083e2181ccf1b75c6eea1d5e52f 100644 (file)
@@ -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