ericdanan / counsel-projectile

Ivy UI for Projectile
286 stars 39 forks source link

counsel-projectile command takes $HOME as a root directory when there is no project #105

Closed ChoppinBlockParty closed 6 years ago

ChoppinBlockParty commented 6 years ago

When I call counsel-projectile and there is no project, it burns 100% CPU and eats a lot of RAM (~1GB). Then I am offered to chose from my $HOME directory. Is it possible to fallback to usual ivy-switch-buffer?

ericdanan commented 6 years ago

I can't reproduce this. When I call counsel-projectile and there is no project, it falls back to counsel-projectile-switch-project, which is the intended behavior. Do you have any customization of projectile and/or counsel-projectile?

ChoppinBlockParty commented 6 years ago

My bad, typed projectile-project-info and it showed me make, I had a Makefile inside my home. Though to fix it I had to rename Makefile to something like my-Makefile. How can I tell projectile to ignore this Makefile, or ignore this directory to be a project at all?

ericdanan commented 6 years ago

I guess adding the directory to projectile-ignored-projects should work (this is a projectile-feature, not specifically related to counsel-projectile).

ChoppinBlockParty commented 6 years ago

No, that did not stop projectile to consider this a project, and make a full indexing of my home directory.

ericdanan commented 6 years ago

Indeed, I found this projectile issue in which it is explained that although the project is not added to projectile-known-projects, it is still indexed.

Then I'm not sure how to get the behavior you want from projectile, you should ask @bbatsov about that. It would seem natural to me that projectile-project-root systematically filters the roots it finds through projectile-project-root-files-functions against projectile-ignored-projects. Alternatively, each function in projectile-project-root-files-functions could be modified to do this filtering (you could use a :filter-return advice to this end).

Or perhaps a simpler (and uglier) solution would be to add a .projectile file in your directory containing only * so as to exclude everything. But I'm not sure if that would prevent projectile from wasting time and resources checking each file against the exclusion patterm. If not, perhaps adding +/some-small-subdir before * could help.

ericdanan commented 6 years ago

Sorry about the bad link, the projectile issue is bbatsov/projectile/issues/962

ChoppinBlockParty commented 6 years ago

Thank you very much, I will try to find a way out there.