counsel.el (counsel-ag, counsel-rg): store command persistently #1474
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
This adds a new variable
counsel-ag-command
which storescounsel-ag-base-command
including the optionalextra-ag-args
and is used bycounsel-ag-occur
. Also simplifiescounsel-rg
which now simply let-bindscounsel-ag-base-command
and callscounsel-ag
(similarly tocounsel-pt
andcounsel-ack
).This seem to solve issue #777 :
counsel-pt
andcounsel-ack
now work consistently whenivy-resume
orivy-occur
is called (counsel-rg
was not affected by this issue because it was duplicating the code fromcounsel-ag
rather than calling it inside a let-binding).It also solves issue #1462 which was closed because submitted about
counsel-projectile-rg
but actually affectedcounsel-rg
andcounsel-ag
: extra args are now remembered when callingivy-occur
.A couple of things to note:
counsel-rg
was not exactly duplicating the code fromcounsel-ag
, there were small differences in the way extra args were read or initial directory was set. I've resolved them in the way that made more sense to me, but maybe they were intentional. Also incounsel-rg
, the caller was set tocounsel-rg
but now it iscounsel-ag
, I don't know if that's an issue.counsel-ag
more similar tocounsel-grep
and it may be possible to make one rely on the other (egcounsel-ag-function
/counsel-grep-function
), but I didn't touch anything there. I noticed that the command used incounsel-grep-occur
is different fromcounsel-grep-base-command
, I don't know if that's on purpose.Let me know if you would like me to make further changes.