[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Question about dired-do-find-regexp and xref-collect-matches
From: |
Drew Adams |
Subject: |
RE: Question about dired-do-find-regexp and xref-collect-matches |
Date: |
Tue, 9 Jul 2019 16:33:35 -0700 (PDT) |
> I noticed that marking files in Dired and using "A"
> (dired-do-find-regexp) to search them was extraordinarily slow. Going up
> a level to the parent directory and only marking the child directory,
> the search was nearly instantaneous. But that meant I had to search all
> the files in the child directory.
>
> I suspected it was something to do with fish, and indeed setting
> shell-file-name to "/usr/bin/bash" sped it up a little -- but that's a
> bug report for another day.
>
> While poking around I also noticed that dired-do-find-regexp calls
> xref-collect-matches once per marked file. That means a full find+grep
> call for each file, when a single find+grep call (or even just a single
> grep call!) would do the trick.
>
> The search hits are collected as:
>
> (mapcan
> (lambda (file)
> (xref-collect-matches regexp "*" file
> (and (file-directory-p file)
> ignores)))
> files)
>
> But the second argument to `xref-collect-matches' can be a
> space-separated string of file names -- wouldn't it be easier just to
> call `xref-collect-matches' once?
Meanwhile (fortunately), you can still use
`dired-do-search' (which used to be bound to `A').
If that wasn't "extraordinarily slow" for you
before, it still might not be. Maybe try it.