projectile icon indicating copy to clipboard operation
projectile copied to clipboard

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

Open matthew-piziak opened this issue 8 years ago • 12 comments

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

matthew-piziak avatar Mar 21 '18 17:03 matthew-piziak

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!

stale[bot] avatar May 08 '19 17:05 stale[bot]

bump

matthew-piziak avatar May 08 '19 21:05 matthew-piziak

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?

stoeckley avatar May 24 '19 19:05 stoeckley

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!

stale[bot] avatar Aug 22 '19 20:08 stale[bot]

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

stoeckley avatar Aug 22 '19 21:08 stoeckley

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!

stale[bot] avatar Feb 18 '20 21:02 stale[bot]

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

matthew-piziak avatar Feb 18 '20 22:02 matthew-piziak

Is this getting looked into? I have the same issue

cammil avatar Mar 25 '20 14:03 cammil

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!

stale[bot] avatar Sep 24 '20 04:09 stale[bot]

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.

bbatsov avatar Sep 24 '20 06:09 bbatsov

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?

matthew-piziak avatar Sep 24 '20 12:09 matthew-piziak

Hey, just bumping this, the behaviour seems strange as it tries to replace instances in large binary files that I don't want it to look into, this either takes ages or crashes emacs.

wkenyon avatar Oct 24 '22 12:10 wkenyon