emacs-31 b86b9c195b6 1/2: Eglot: support commas in globs (bug#81425)

João Távora <[email protected]>
Newsgroups gmane.emacs.diffs
Message-ID <[email protected]>
branch: emacs-31
commit b86b9c195b60a413b9f34a1adbe111b620c44206
Author: João Távora <[email protected]>
Commit: João Távora <[email protected]>

    Eglot: support commas in globs (bug#81425)
    
    * lisp/progmodes/eglot.el (eglot--glob-parse): Tweak.
    
    * test/lisp/progmodes/eglot-tests.el (eglot-test-glob-test): Add
    some comma-cases.
---
 lisp/progmodes/eglot.el            | 4 ++--
 test/lisp/progmodes/eglot-tests.el | 6 +++++-
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
index 3eca8196540..2595a3b6294 100644
--- a/lisp/progmodes/eglot.el
+++ b/lisp/progmodes/eglot.el
@@ -4967,8 +4967,8 @@ not watching some directories" eglot-max-file-watches)
                       (:*       "\\*"                   eglot--glob-emit-*)
                       (:?       "\\?"                   eglot--glob-emit-?)
                       (:{}      "{[^{}]+}"              eglot--glob-emit-{})
-                      (:range   "\\[\\^?[^][/,*{}]+\\]" eglot--glob-emit-range)
-                      (:literal "[^][,*?{}]+"           eglot--glob-emit-self))
+                      (:range   "\\[\\^?[^][/*{}]+\\]"  eglot--glob-emit-range)
+                      (:literal "[^][*?{}]+"            eglot--glob-emit-self))
      until (eobp)
      collect (cl-loop
               for (_token regexp emitter) in grammar
diff --git a/test/lisp/progmodes/eglot-tests.el b/test/lisp/progmodes/eglot-tests.el
index ee99e421fe3..79132d7f3f5 100644
--- a/test/lisp/progmodes/eglot-tests.el
+++ b/test/lisp/progmodes/eglot-tests.el
@@ -1492,7 +1492,11 @@ GUESSED-MAJOR-MODES-SYM are bound to the useful return values of
   (should (eglot--glob-match "prefix/{**/*.js,**/foo.[0-9]}.suffix"
                              "prefix/a/b/c/d/foo.5.suffix"))
   (should (eglot--glob-match "prefix/{**/*.js,**/foo.[0-9]}.suffix"
-                             "prefix/a/b/c/d/foo.js.suffix")))
+                             "prefix/a/b/c/d/foo.js.suffix"))
+  ;; bug#81425
+  (should (eglot--glob-match "foo/**/notes,extra.py" "foo/bar/notes,extra.py"))
+  (should (eglot--glob-match "foo,bar.txt" "foo,bar.txt"))
+  (should (eglot--glob-match "example.[a,b]" "example.,")))
 
 (defvar tramp-histfile-override)
 (defun eglot--call-with-tramp-test (fn)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.