Projectile search only part of the project - emacs

When using emacs Projectile and helm-projectile, I am used to search for text inside the whole project. However is there a way to search only part of the project?
Something like:
search inside a subfolder only
search while excluding a subfolder

Yes you can exclude (sub) folders. Add a line in your .projectile:
-/sub/folder
So search inside a subfolder, I don't see something automatic. You could put project files in some subfolders (https://projectile.readthedocs.io/en/latest/configuration/#file-local-project-root-definitions) and switch projects.

For now I am using rgrep, which prompts for a string and a directory to find.
I would be happy to hear about an equivalent solution using ag, and I should mention I haven't yet dug into the link from #goromlagche (https://github.com/ggreer/the_silver_searcher#emacs).

Install helm-ag, this requires silversearcher-ag package; for debian apt install silversearcher-ag. And then you can
helm-do-ag to search inside a sub-folder/directory inside project
to ignore sub-folders/directories add them to either .gitignore or .hgignore if it is git and hg project respectively or add then to .projectile file, details here.
references:
https://github.com/emacsorphanage/helm-ag
https://github.com/ggreer/the_silver_searcher

Related

NetBeans doesn't show git ignore files

I can't see my project's .gitignore files within my netbeans program.
Is there a way to make them appear within the list of files? I could not find a way.
Open the NetBeans Options
Click on the 'Files' tab
Under 'Ignored Files Pattern', the default is:
^(CVS|SCCS|vssver.?\.scc|#.*#|%.*%|_svn)$|~$|^\.(?!htaccess$).*$
This means that, by default, NetBeans ignores all files beginning with '.' except for .htaccess
You can update this regex to the following to also exclude .gitignore:
^(CVS|SCCS|vssver.?\.scc|#.*#|%.*%|_svn)$|~$|^\.(?!(htaccess|gitignore)$).*$
Click OK, and NetBeans will immediately begin displaying your .gitignore files.

How to clear the eclipse .project files from maven project

After I import my maven project to eclipse, it created eclipse project files in my maven project. How do I clear them out?
After your comment "if I dont clean the project files, how to I hand it over to someone else? If they dont use eclipse would they be appreciate all those extra files unrelated to the project?" I have understood your need.
The best way to achieve it is to use a version control system (VCS) like git, svn etc. and add inside your project tree a special file call .[VCSofYourChoice]ignore. For example for git this file would be .gitignore for svn it would be .svnignore.
Once you created this file you add rules to exclude files or directories you don't want to share on your version control system of your choice. To find the syntax to use google it with keywords ".[VCSofYourChoice]ignore syntax".
Eclipse and eventually every IDE create specific files, in order to save project structure and other internals. Some of them prompt you to select in which folder you want to save these files, for example IntelliJ, but I am sure eclipse as well. So you every time you use and IDE and you import a project, some files are going to be generated. The cleanest way is to 1) select to save them in a folder not related with the actual project, and as it already suggested do not commit them and add them in an ignore list, on your VCS of choice (e.g git)

Diff directories with content in Netbeans

I duplicated some folder with project's config to a new project a few days ago and made there some modifications (project name, paths, etc).
After few days a source config dir has changed and I am wondering how to diff that folders in 2 projects to apply that changes in new project.
If I select source file and then new file and select diff option in Netbeans - it works. But is it possible to make in on whole folder ?
I was looking for folder compare in NetBeans too. I found http://kenai.com/projects/netbeans-dircomp/downloads. I'll try that in a little while...
NetBeans does not have that feature.
You could probably hack together a shell script that would do this, based on find, etc. This search for 'diff a directory tree' looks like it has some good answer.
I would recommend that you put your source code under some sort of source code control system like CVS, SVN or Mercurial.
You could use those tools to generate a diff of the original project's config between the date you made the copy and 'now'... and then apply that diff onto the copy of the project...
Or, you could apply some of the strategies described in CVS manual for handling third party sources. I think the same concepts are available for svn and mercurial.
A very old question, but Netbeans does have a CVS feature now.
Go to Tools>Plugins and find CVS and install.
After that it is very easy to right click a directory, go to tools, then apply diff patch. That will patch all files in the diff file in that directory. Simple and smooth.
And You Can Also Use The
Total Commander
to Compare the folder and all type off your files
Its amazing in this situation

Resources check

hey I am frequently uploading my XCode iPhone projects to an svn repository to be build on another machine.
My problem is that when I add resources to my project sometimes I forget to add the resource as relative to the project.
I know one answer is to be more careful (not easy when your tired!) but if there was a way to run a script to check my resource paths are relative when I build and warn me if they are not it would be a great time saver for me.
How would I go about doing this?
Thanks
Chris
You can select all the files in your project and set the Path Type for all of them in one go. While this isn't a script this does save a lot of time over doing the files individually
I think the best approach to script this would be to look in the .xcodeproj file - the file paths are listed in there. If your project is called MyProject you need to open (either by using Show Package Contents in Finder or just the usual cd in Terminal) the MyProject.xcodeproj directory.
In here you'll find a file called project.pbxproj - open this in a editor that won't mess up your formatting and have a peek around the file. If you search for one of your files in the project you should be able to see how Xcode stores references to the project files.
Look for a section named /* Begin PBXFileReference section */. In here all your files are listed, along with where they are relative to the project, e.g.:
... path = Classes/MyClass.h; sourceTree = SOURCE_ROOT
If you can parse this file you should be able to acheive what you want - but remember to back up the file, otherwise you might corrupt your project.
How would it be if you instead write a script that asks the SCM if anything in the project is not committed? For example, think of this scenario
Project Root
Codex
Project.xcodeproj
…
Design
anImage.png
where anImage.png being outside of Codex, where the Xcode project sits (its path starts with a ../). A strong .pbxproj parser would have to support all the variants in which Xcode references files to know exactly if there are stray files.
OTOH, the SCM knows where everything is all the time (you mentioned up-ping to a SVN server), so why not ask it instead.
We have a Ruby script that prints a warning in Xcode’s Build Log if anything in the project is not committed.

How can I make Eclipse file search not include svn directories?

When I do a file search on eclipse it includes the .svn directories by default. I tried excluding them from the build path but they still appear on file search results.
Spaceman is right. With Helios, choose Project -> Properties -> Resource -> Resource Filters and then add an exclude filter for type "Folder" with name .svn.
If you install the subclipse plugin then it automatically excludes the .svn directories (plus provides some other cool stuff in the IDE).
http://subclipse.tigris.org/
If it does not work, simply restart Eclipse (sometimes it's needed on a fresh checkout)
Following up on Mark Ingram's excellent answer, simply installing the plugin won't get you there -- You'll still need to Share your project in order for the automatic Search filtering to take hold. After you set up the SVN repository location from within the Subeclipse view you may Share your project by doing the following:
From within Package Explorer, right-click the project name
Select the Team context menu option and then Share Project....
Step trough the wizard to tie your project to its location in the svn repository
Once you complete that and the workspace rebuilds you are all set to enjoy filtered search.
Excluding the .svn folders by making them derived stops then appearing in the search results, see here.
You have to do it manually for each folder, if you have a lot of .svn folders then it's not ideal.
If you are gonig down the plugin route, I tend to prefer subversive over subclipse.
Ah - OK. I don't use SubVersion per se, but would this be of any use? It claims it can do what you want...
Eclipse import would also contain file of type .java.svn-base, so its better to give as in below image
[[1]: https://i.stack.imgur.com/szDxP.png][1]
You can off course also select ALL the file name patterns to include in the file search dialog
Click on the drop-down triangle in the top-right corner of the Navigator and choose "Filters..".
By default Eclipse only offers you ".class" and ".".
If you choose ".*" you'll hide .svn files. Obviously all other .something files will also be hidden.