emacs-diffs
[Top][All Lists]
Advanced

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

emacs-29 86cf9fd932c: Eglot: don't watch directories that don't exist


From: João Távora
Subject: emacs-29 86cf9fd932c: Eglot: don't watch directories that don't exist
Date: Sun, 2 Apr 2023 18:01:04 -0400 (EDT)

branch: emacs-29
commit 86cf9fd932c654cc502bedf634458a918ee5e9cb
Author: João Távora <joaotavora@gmail.com>
Commit: João Távora <joaotavora@gmail.com>

    Eglot: don't watch directories that don't exist
    
    project-files isn't guaranteed to return existing files, so better
    check if they exist because placing a watcher on them.
    
    Originally reported at:
    https://github.com/joaotavora/eglot/issues/1198
    
    * lisp/progmodes/eglot.el (eglot-register-capability
    workspace/didChangeWatchedFiles): Check if directories exist.
---
 lisp/progmodes/eglot.el | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
index 8f64f849d72..4a9209ab9b4 100644
--- a/lisp/progmodes/eglot.el
+++ b/lisp/progmodes/eglot.el
@@ -3433,8 +3433,9 @@ at point.  With prefix argument, prompt for ACTION-KIND."
       (unwind-protect
           (progn
             (dolist (dir dirs-to-watch)
-              (push (file-notify-add-watch dir '(change) #'handle-event)
-                    (gethash id (eglot--file-watches server))))
+              (when (file-readable-p dir)
+                (push (file-notify-add-watch dir '(change) #'handle-event)
+                      (gethash id (eglot--file-watches server)))))
             (setq
              success
              `(:message ,(format "OK, watching %s directories in %s watchers"



reply via email to

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