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

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

[elpa] externals/eglot 8d00f8b 32/49: Per #602: speed up glob matching 2


From: Stefan Monnier
Subject: [elpa] externals/eglot 8d00f8b 32/49: Per #602: speed up glob matching 2x
Date: Wed, 17 Mar 2021 18:41:48 -0400 (EDT)

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

    Per #602: speed up glob matching 2x
    
    with-temp-buffer was taking a lot of time, presumably because it kills
    the buffer.  Since emacs is single-threaded, we can safely reuse a
    single buffer.
    
    * eglot.el (eglot--glob-parse): Simplify grammar.
    (eglot--glob-compile): Don't with-temp-buffer.
---
 eglot.el | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/eglot.el b/eglot.el
index 44648ae..50fb695 100644
--- a/eglot.el
+++ b/eglot.el
@@ -2672,10 +2672,9 @@ at point.  With prefix argument, prompt for ACTION-KIND."
      with grammar = '((:**      "\\*\\*/?"              eglot--glob-emit-**)
                       (:*       "\\*"                   eglot--glob-emit-*)
                       (:?       "\\?"                   eglot--glob-emit-?)
-                      (:/       "/"                     eglot--glob-emit-self)
                       (:{}      "{[^][/*{}]+}"          eglot--glob-emit-{})
                       (:range   "\\[\\^?[^][/,*{}]+\\]" eglot--glob-emit-range)
-                      (:literal "[^][/,*?{}]+"          eglot--glob-emit-self))
+                      (:literal "[^][,*?{}]+"           eglot--glob-emit-self))
      until (eobp)
      collect (cl-loop
               for (_token regexp emitter) in grammar
@@ -2687,7 +2686,8 @@ at point.  With prefix argument, prompt for ACTION-KIND."
   "Convert GLOB into Elisp function.  Maybe BYTE-COMPILE it.
 If NOERROR, return predicate, else erroring function."
   (let* ((states (eglot--glob-parse glob))
-         (body `(with-temp-buffer
+         (body `(with-current-buffer (get-buffer-create " 
*eglot-glob-matcher*")
+                  (erase-buffer)
                   (save-excursion (insert string))
                   (cl-labels ,(cl-loop for (this that) on states
                                        for (self emit text) = this



reply via email to

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