emacs-diffs
[Top][All Lists]
Advanced

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

emacs-29 3d6f7553319: xref-search-program-alist: Fix searching larger fi


From: Dmitry Gutov
Subject: emacs-29 3d6f7553319: xref-search-program-alist: Fix searching larger file lists on MS Windows
Date: Tue, 18 Apr 2023 18:30:25 -0400 (EDT)

branch: emacs-29
commit 3d6f7553319b38bbc9a93d66cf7879926a695da1
Author: Dmitry Gutov <dmitry@gutov.dev>
Commit: Dmitry Gutov <dmitry@gutov.dev>

    xref-search-program-alist: Fix searching larger file lists on MS Windows
    
    * lisp/progmodes/xref.el (xref-search-program-alist):
    Add '-s 10000' to xargs' options when on Windows or DOS.
    Apparently the xargs port doesn't currently know how to obey the
    system-wide limits (https://debbugs.gnu.org/bug=61667#521).
---
 lisp/progmodes/xref.el | 28 +++++++++++++++++-----------
 1 file changed, 17 insertions(+), 11 deletions(-)

diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el
index 1ae60796601..0666b18cba1 100644
--- a/lisp/progmodes/xref.el
+++ b/lisp/progmodes/xref.el
@@ -1820,16 +1820,22 @@ IGNORES is a list of glob patterns for files to ignore."
 ;; Ripgrep gets jumbled output, though, even with --line-buffered.
 ;; But Grep seems to be stable. Even without --line-buffered.
 (defcustom xref-search-program-alist
-  '((grep
-     .
-     ;; '-s' because 'git ls-files' can output broken symlinks.
-     "xargs -0 grep <C> --null -snHE -e <R>")
-    (ripgrep
-     .
-     ;; '!*/' is there to filter out dirs (e.g. submodules).
-     "xargs -0 rg <C> --null -nH --no-heading --no-messages -g '!*/' -e <R>"
-     )
-    (ugrep . "xargs -0 ugrep <C> --null -ns -e <R>"))
+  (let ((xargs-max-chars
+         (and (memq system-type '(windows-nt ms-dos))
+              "-s 10000 ")))
+    `((grep
+       .
+       ;; '-s' because 'git ls-files' can output broken symlinks.
+       ,(concat "xargs -0 " xargs-max-chars "grep <C> --null -snHE -e <R>"))
+      (ripgrep
+       .
+       ;; '!*/' is there to filter out dirs (e.g. submodules).
+       ,(concat "xargs -0 "
+                xargs-max-chars
+                "rg <C> --null -nH --no-heading --no-messages -g '!*/' -e 
<R>"))
+      (ugrep
+       .
+       ,(concat "xargs -0 " xargs-max-chars "ugrep <C> --null -ns -e <R>"))))
   "Association list mapping program identifiers to command templates.
 
 Program identifier should be a symbol, named after the search program.
@@ -1844,7 +1850,7 @@ The template should have the following fields:
   :type '(repeat
           (cons (symbol :tag "Program identifier")
                 (string :tag "Command template")))
-  :version "28.1"
+  :version "29.1"
   :package-version '(xref . "1.0.4"))
 
 (defcustom xref-search-program 'grep



reply via email to

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