Subject: Re: bug#72701: eglot crash when project-files-relative-names t

From: Dmitry Gutov <[email-masked]>
Date: Sun, 8 Sep 2024 05:24:17 +0300

On 07/09/2024 10:20, Eli Zaretskii wrote:
> Ping!  Is this issue resolved and can be closed, or do we need to do
> anything else here?

I suggest installing the following. Not a hard necessity, but seems like 
an improvement:

diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
index acc197754db..e5b14ce9f80 100644
--- a/lisp/progmodes/eglot.el
+++ b/lisp/progmodes/eglot.el
@@ -3813,6 +3813,7 @@ eglot--code-action
  (cl-defmethod eglot-register-capability
    (server (method (eql workspace/didChangeWatchedFiles)) id &key watchers)
    "Handle dynamic registration of workspace/didChangeWatchedFiles."
+  (defvar project-files-relative-names)
    (eglot-unregister-capability server method id)
    (let* (success
           (globs (mapcar
@@ -3823,6 +3824,7 @@ eglot-register-capability
                           ;; (2), WatchKind.Delete (4)
                           (or kind 7)))
                   watchers))
+         (project-files-relative-names nil)
           (dirs-to-watch
            (delete-dups (mapcar #'file-name-directory
                                 (project-files
diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index c38d3f0048a..78f5c127900 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -331,7 +331,10 @@ project-files-relative-names
  The file names should be relative to the project root.  And this can
  only happen when all returned files are in the same directory.
  In other words, the DIRS argument of `project-files' has to be nil or a
-list of only one element.")
+list of only one element.
+
+This variable is only meant to be set by Lisp code, not customized by
+the user.")

  (cl-defgeneric project-files (project &optional dirs)
    "Return a list of files in directories DIRS in PROJECT.