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

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

[elpa] externals/eglot fadf7594e9: Fix #633, #1067: Don't exceed max-spe


From: ELPA Syncer
Subject: [elpa] externals/eglot fadf7594e9: Fix #633, #1067: Don't exceed max-specdl-size in big Go projects
Date: Sun, 18 Sep 2022 05:57:38 -0400 (EDT)

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

    Fix #633, #1067: Don't exceed max-specdl-size in big Go projects
    
    When invoking client/registerCapability for
    workspace/didChangeWatchedFiles, Gopls lists each file to watch
    separately.  This makes eglot--glob-emit-{} emit a closure with an
    'or' form containing a potentially large number of 're-search-forward'
    forms.
    
    For large Go project such as "Kubernetes", this list becomes so large
    that -- for some reason I don't understand -- it triggers the
    'max-specdl-size' limit.
    
    An alternative using `regexp` opt doesn't seem to trigger the error.
    
    * eglot.el (eglot--glob-emit-{}): Use regexp-opt.
---
 eglot.el | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/eglot.el b/eglot.el
index 493bfcc7d6..038847c78f 100644
--- a/eglot.el
+++ b/eglot.el
@@ -3260,8 +3260,7 @@ If NOERROR, return predicate, else erroring function."
 (defun eglot--glob-emit-{} (arg self next)
   (let ((alternatives (split-string (substring arg 1 (1- (length arg))) ",")))
     `(,self ()
-            (or ,@(cl-loop for alt in alternatives
-                           collect `(re-search-forward ,(concat "\\=" alt) nil 
t))
+            (or (re-search-forward ,(concat "\\=" (regexp-opt alternatives)) 
nil t)
                 (error "Failed matching any of %s" ',alternatives))
             (,next))))
 



reply via email to

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