[Geany-Devel] Improving FiF

Lex Trotman elextr at xxxxx
Thu Oct 10 02:15:15 UTC 2013


[...]

> 3. For non-recursive searches, grep does not allow a directory to be
>> specified instead of file. To work around that, we read the directory,
>> back-parse all --include=*.x patterns, and match them manually.
>>
>> Proposition: grep -rl --include=*.c --exclude-dir=[^.]*
>> --exclude-dir=.?* void . :)
>>
>> We pass our Directory as a workind  directory to spawn, and the
>> recursive search already uses . as a grep FILE argument.
>> --exclude-dir is supported since more than 5 years.
>>
>>
> Is there any reason we cannot just walk the directory/subdirectories
> ourselves and search the files using GRegex stuff? The pattern syntax would
> then be the exact same as the other search dialogs and it would save having
> to not only spawn a subprocess but also remove the dependency on grep (only
> a problem on Windows). Also, as a future optimization, if any of the files
> to search are open in Geany, we could search their document buffer directly
> from memory rather than having to do any file IO for them. GIO/GFile has
> all the stuff needed to walk a directory tree and open files both
> asynchronously and portably IIRC.
>

*Technically* the only issue I know of is that last time I looked PCRE was
much less optimised than grep (partly because PCRE is more general) so
searching a big tree of big files may be noticeably slower.

But this is more code that needs to be written, debugged and maintained.
 Pull requests (with an ongoing support pledge) are welcome.

The benefits of control and consistency (and as you pointed out on IRC to
search the buffers not the files for open documents) may not outweigh the
cost of doing it.

Cheers
Lex


>
> Cheers,
> Matthew Brush
>
> ______________________________**_________________
> Devel mailing list
> Devel at lists.geany.org
> https://lists.geany.org/cgi-**bin/mailman/listinfo/devel<https://lists.geany.org/cgi-bin/mailman/listinfo/devel>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.geany.org/pipermail/devel/attachments/20131010/ab804967/attachment.html>


More information about the Devel mailing list