emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/eglot 25d20c73cf 05/33: Fix #697, #645: Again speed up


From: Stefan Kangas
Subject: [elpa] externals/eglot 25d20c73cf 05/33: Fix #697, #645: Again speed up directory watching
Date: Sat, 8 Jan 2022 12:30:48 -0500 (EST)

branch: externals/eglot
commit 25d20c73cf317f7d629dd215c8c22b185631551f
Author: João Távora <joaotavora@gmail.com>
Commit: João Távora <joaotavora@gmail.com>

    Fix #697, #645: Again speed up directory watching
    
    Previously, given a number of globs, Eglot would try to place system
    watchers only in those subdirectories that could potentially be
    matched by a glob.  This meant traversing the whole tree, which could
    be impractical.  Just place watchers in every subdirectory of the
    project (you may run out of watchers).
    
    * eglot.el (eglot-register-capability): Simplify.
    (eglot--files-recursively): Delete.
    (eglot--directories-recursively): Fix.
---
 eglot.el | 29 +++--------------------------
 1 file changed, 3 insertions(+), 26 deletions(-)

diff --git a/eglot.el b/eglot.el
index a739419e9d..706fa92522 100644
--- a/eglot.el
+++ b/eglot.el
@@ -2777,7 +2777,7 @@ at point.  With prefix argument, prompt for ACTION-KIND."
                    (eglot--glob-compile globPattern t t))
                  watchers))
          (dirs-to-watch
-          (eglot--directories-matched-by-globs default-directory globs)))
+          (eglot--directories-recursively default-directory)))
     (cl-labels
         ((handle-event
           (event)
@@ -2878,37 +2878,14 @@ If NOERROR, return predicate, else erroring function."
   (when (eq ?! (aref arg 1)) (aset arg 1 ?^))
   `(,self () (re-search-forward ,(concat "\\=" arg)) (,next)))
 
-(defun eglot--files-recursively (&optional dir)
-  "Because `directory-files-recursively' isn't complete in 26.3."
-  (cons (setq dir (expand-file-name (or dir default-directory)))
-        (cl-loop with default-directory = dir
-                 with completion-regexp-list = '("^[^.]")
-                 for f in (file-name-all-completions "" dir)
-                 if (file-directory-p f) append (eglot--files-recursively f)
-                 else collect (expand-file-name f))))
-
 (defun eglot--directories-recursively (&optional dir)
   "Because `directory-files-recursively' isn't complete in 26.3."
   (cons (setq dir (expand-file-name (or dir default-directory)))
         (cl-loop with default-directory = dir
                  with completion-regexp-list = '("^[^.]")
                  for f in (file-name-all-completions "" dir)
-                 if (file-directory-p f) append (eglot--files-recursively f)
-                 else collect (expand-file-name f))))
-
-(defun eglot--directories-matched-by-globs (dir globs)
-  "Discover subdirectories of DIR with files matched by one of GLOBS.
-Each element of GLOBS is either an uncompiled glob-string or a
-compiled glob."
-  (setq globs (cl-loop for g in globs
-                       collect (if (stringp g) (eglot--glob-compile g t t) g)))
-  (cl-loop for f in (eglot--files-recursively dir)
-           for fdir = (file-name-directory f)
-           when (and
-                 (not (member fdir dirs))
-                 (cl-loop for g in globs thereis (funcall g f)))
-           collect fdir into dirs
-           finally (cl-return (delete-dups dirs))))
+                 if (file-directory-p f)
+                 append (eglot--directories-recursively f))))
 
 
 ;;; Rust-specific



reply via email to

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