From: João Távora Date: Sun, 18 Sep 2022 09:15:43 +0000 (+0100) Subject: Don't exceed max-specdl-size in big go projects X-Git-Tag: emacs-29.0.90~1616^2~524^2~4^2~16 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=14586fedcf9ac4aafe119b89a72d0b438f6a4d04;p=emacs.git 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. GitHub-reference: fix https://github.com/joaotavora/eglot/issues/633 GitHub-reference: fix https://github.com/joaotavora/eglot/issues/1067 --- diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index 493bfcc7d6c..038847c78f6 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/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))))