mhayashi1120 / Emacs-wgrep

Writable grep buffer and apply the changes to files
GNU General Public License v3.0
661 stars 43 forks source link

wgrep-ag footer search is unreliable on large buffers #41

Closed OleLaursen closed 5 years ago

OleLaursen commented 7 years ago

wgrep-ag-prepare-header/footer uses a search for compilation-message text properties to determine the footer (and header?).

Unfortunately, this relies on the buffer being - I don't know... fontified?

So when I try wgrep-ag on a large result buffer, only about the first 500 lines get text properties, so wgrep-ag-prepare-header/footer ends up concluding that the end is at line 497, so I can't edit anything below that mark.

It is pretty confusing to do a search and replace and not have everything be replaced.

PS: In case others have the same problem - as a workaround, it works for me to just scroll down to the bottom of the buffer before envoking wgrep, then everything has been parsed and the footer detection works as intended.

dsedivec commented 7 years ago

Hmm, I didn't try this but it totally makes sense. I'll see if I can carve some time off to look at this soon-ish (but someone else can certainly jump in sooner).

dajva commented 6 years ago

Any plans to merge this to master? I rely on this package for rg.el (the rg binary produces almost identical results as ag) and have seen this problem in this context as well.

@dsedivec: Do you use any specific ag.el package variables or similar in your fix? Seems to me that it was only depending on the format of the output from a quick glance. I might have missed something though.

dajva commented 5 years ago

FYI: I have merged the wgrep-ag.el code into https://github.com/dajva/rg.el, applied this patch and made specific adjustments to match rg.el.