Projectile: `projectile-replace` does not respect `.projectile` file

Created on 21 Mar 2018  路  11Comments  路  Source: bbatsov/projectile

Expected behavior

I have - *~ in my .projectile file. projectile-find-file correctly ignores my emacs backup files ending with ~. I expect that projectile-replace follows the same behavior, and ignores backup files.

Actual behavior

Projectile hops into my backup files, I don't notice, and then when I hit y it tells me that the file is readonly (true) and kills my replace session (frustrating).

Steps to reproduce the problem

Copy a file in your project and append a ~. Add - *~ to your .projectile file. Notice that projectile-find-file (With prefix argument, to clear cache) ignores these files. However, projectile-replace will still enter them.

Environment & Version information

Projectile version information

Projectile version: 20180227.1743

Emacs version

GNU Emacs 27.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.26) of 2018-02-12

Operating system

Arch Linux

Good First Issue Help Wanted Improvement

Most helpful comment

That's a shame, and I'm sorry to hear that Mr. Bot.

All 11 comments

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contribution and understanding!

bump

I've noticed this as well and came here to open an issue about this, but see I don't have to. I use projectile-grep and projectile-replace all the time. The former respects the .projectile file, the latter does not. Why is that?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contribution and understanding!

That's a shame, and I'm sorry to hear that Mr. Bot.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contribution and understanding!

In our age robots perform all actions, but we humans are hired to do nothing.

Is this getting looked into? I have the same issue

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contribution and understanding!

The former respects the .projectile file, the latter does not. Why is that?

Because projectile-replace doesn't use any file filtering for performance reasons - it just finds all files that contain the replacement string in the project directory. That's fairly easy to change, but will make the replacement slow on very big projects. See projectile-files-from-cmd and you'll understand what I'm talking about.

That's illuminating, thank you. But I'm having trouble thinking of the fundamental limitation. Are grep/rg/etc. slower when you ask them to filter files?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rrudakov picture rrudakov  路  4Comments

Compro-Prasad picture Compro-Prasad  路  7Comments

levicole picture levicole  路  3Comments

andrematheus picture andrematheus  路  3Comments

ghost picture ghost  路  4Comments