Project file list support for the grepview part

Matthew Woehlke mwoehlke at tibco.com
Thu Oct 19 15:14:21 UTC 2006


Kris Wong wrote:
> One of the first things I noticed when I started using kdevelop was that
> the grep feature did not support only searching the files that are in a
> project.  This was a big weakness for me due to our project structure,
> so I added the feature.  By this point I have grown tired of re-adding
> the feature every time I upgrade, so I figured I'd submit it to the list
> and see what people thought.  I realize this isn't exactly the best
> timing, due to feature freeze on Monday, but I figured I'd give it a
> shot.  I'm new to this whole thing, so I hope this is the appropriate
> process.
>  
> Here's a quick overview of the feature: A checkbox has been added to the
> grep dialog that allows the user to specify that they would only like to
> search the files in a project.  This checkbox is enabled/disabled based
> on whether a project is open and has at least 1 file in its file list.
> If the user selects this option, when the grepviewwidget actually does
> its search, it will dump all of the files in the file list to a
> temporary file named ".grep.tmp" in the project directory, which it will
> then cat and pipe to xargs.

Um, why do you not 'cat <project>.filelist | sed 1d | xargs ...'? 
Wouldn't this be a lot simpler, and not need the extra (and redundant) 
temp file?

I see you disable files_combo (good), dir_combo (ditto), and 
no_find_err_box (also good), but why do you disable exclude_combo? This 
should work fine with cat'ing a file list, since it operates downstream 
of 'find'. (You'll have to move it outside your added if-block, of 
course.) Also removing the 'quote spaces before going into xargs' sed 
pipe looks like a bug waiting to happen. Both of these look like they 
would be resolved by restoring the original indentation and bumping your 
closing '}' up to just above the line 'QStringList excludelist = ...'.

> Otherwise it will behave as normal.  When
> the search is done or is killed, the temporary file is removed.  I first
> tried an implementation that did not use a temporary file using echo,
> but the command line became too long for large projects.  I have tested
> this using several qmake projects, an automake project
> (kdevelop.kdevelop), and a simple manual makefile type project.  It
> worked as expected in all 3 tests.  I have also been using this feature
> on a daily basis for quite some time.

I'm not sure what the policy here is, but I think it would be best if 
you either adjust your tab-vs-space settings to match existing code or 
at least strip from your patch changes that only replace tabs with 
spaces (I noticed a few of these).

-- 
Matthew
"Try to bring it back in one piece this time." -- Q (MI6)





More information about the KDevelop-devel mailing list