dajva / rg.el

Emacs search tool based on ripgrep
https://rgel.readthedocs.io
GNU General Public License v3.0
475 stars 41 forks source link

Add line grouping option #5

Closed s-d-m closed 7 years ago

s-d-m commented 7 years ago

Provides a way to user to group lines belonging to the same file

Instead of showing e.g.

filename1:11:3: line that match filename1:14:5: other matching line filename2:3:4: random line filename2:4:5: not so random line

the output will now look like

File: filename1 11:3: line that match 14:5: other matching line

File: filename2 3:4: random line 4:5: not so random line

The variable rg-group-result can be set to nil to get the old behaviour

s-d-m commented 7 years ago

The latest four commits basically makes it that the former behaviour is preserved, including the rg command executed. This is to keep the tests passing.

The consequence being that when grouping the matches by filename the executed command will be something along the lines of 'rg --no-heading ... --heading' which makes it a bit illogic.

Also, the latest commit provide the ability to see the column number in the output or not. It is off by default as otherwise the tests won't pass.

The best would be imho to update the tests instead (and write new ones for the grouping options). But sadly I will not to it myself.

s-d-m commented 7 years ago

General comments:

Please don't merge this PR, I don't like the history. I would rather have this one closed and then create a new one with a clean history. Actually three PR:

Just let me know when you are happy with the end result

s-d-m commented 7 years ago

If you want to create new pr:s for each commit that's fine but a history rewrite works just as well for me. Just do it in the easiest way for you.

I'm going for the three PR:

I like having a clean history with a branch per feature

s-d-m commented 7 years ago

I splitted this PR into two smaller ones with clear history. It seems that github won't let me propose a PR that can only be merged after another one. Hence I decided in the end to have the 'add grouping' and 'add columns' in the same PR (but each feature on a separate commit).

Feel free to pick these commits as you see fit, rename the branch name or whatever.

dajva commented 7 years ago

Thanks for your effort on this one. The "feature" branch looks as it wasn't merged unfortunately since I had to close it manually. I suspect that github doesn't really support a rebase based workflow or possibly need the commits to be merged to master.