Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Robustify counsel occur #1845

Closed
wants to merge 2 commits into from

Conversation

@mookid
Copy link
Contributor

commented Dec 8, 2018

see be98b75

the implemented strategy: always prefix matches with ./ or ., regardless of whether the tool (ie, ag or rg or git-grep or pt or......) adds it.

As mentioned, this fixes the broken navigation from the results of ag-based ivy-occur buffers.

counsel.el Outdated
@@ -1491,6 +1491,9 @@ If NO-ASYNC is non-nil, do it synchronously instead."
nil " *counsel-gg-count*")
nil))))

(defun counsel--normalize-grep-match (str)
(if (string-prefix-p "\\.[/\\]" str) str (concat "./" str)))

This comment has been minimized.

Copy link
@basil-conto

basil-conto Dec 8, 2018

Collaborator

Should this be string-match-p?

This comment has been minimized.

Copy link
@mookid

mookid Dec 8, 2018

Author Contributor

hum I don't want to match a path such as "foo./bar"

This comment has been minimized.

Copy link
@mookid

mookid Dec 8, 2018

Author Contributor

oh got it. string-prefix-p does not handle regexps

counsel.el: robustify grep-like ivy-occur.
counsel--normalize-grep-match: new function.
counsel-git-grep-occur: use the new function.
counsel--grep-mode-occur: use the new function.
counsel-grep-like-occur: force normalization of completion candidates.

@mookid mookid force-pushed the mookid:robustify_counsel_occur branch from 3300391 to 812137d Dec 8, 2018

@abo-abo abo-abo closed this in 588a190 Dec 12, 2018

abo-abo added a commit that referenced this pull request Dec 12, 2018
@abo-abo

This comment has been minimized.

Copy link
Owner

commented Dec 12, 2018

Thanks.

@mookid mookid deleted the mookid:robustify_counsel_occur branch Dec 12, 2018

@basil-conto

This comment has been minimized.

Copy link
Collaborator

commented Dec 14, 2018

Either counsel--normalize-grep-match should call ivy--starts-with-dotslash or the latter function should be deleted along with its tests. At the moment it's not being used anywhere.

Re: #1846

abo-abo added a commit that referenced this pull request Dec 17, 2018
@abo-abo

This comment has been minimized.

Copy link
Owner

commented Dec 17, 2018

@basil-conto Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.