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
Robustify counsel occur #1845
Conversation
This reverts commit be98b75.
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))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be string-match-p
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hum I don't want to match a path such as "foo./bar"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh got it. string-prefix-p does not handle regexps
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.
Thanks. |
Either Re: #1846 |
@basil-conto Thanks. |
(ivy--dirname-p, ivy--magic-file-slash): Simplify now that Ivy requires Emacs 24.5 or later by using string-suffix-p instead of slower regexp matching. (ivy--occur-insert-lines): Escape leading dot in regexp by using existing helper ivy--starts-with-dotslash. Re: abo-abo#1817, abo-abo#1845, abo-abo#1846
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.