-
-
Notifications
You must be signed in to change notification settings - Fork 339
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
counsel--grep-mode-occur: remove column indicators for wgrep. #1835
Conversation
counsel.el
Outdated
(save-match-data | ||
(if (string-match | ||
;; Remove column indicators if present | ||
"\\(?1:[^\n:]+?[^\n/:]\\):[\t ]*\\(?3:[1-9][0-9]*\\)[\t ]*:\\(?3:[1-9][0-9]*:\\)" cand) |
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.
Why are there three explicitly numbered groups, when only the last one is going to be used? (When there are multiple capture groups with the same number, only the right-most one is used.)
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.
I borrowed that from grep.el. let's rework the code after confirmation that the fix works.
counsel.el
Outdated
(if (string-match | ||
;; Remove column indicators if present | ||
"\\(?1:[^\n:]+?[^\n/:]\\):[\t ]*\\(?3:[1-9][0-9]*\\)[\t ]*:\\(?3:[1-9][0-9]*:\\)" cand) | ||
(replace-match "" nil nil cand 3) |
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.
The replace-match
arguments FIXEDCASE
and LITERAL
should be t
.
counsel.el
Outdated
;; Remove column indicators if present | ||
"\\(?1:[^\n:]+?[^\n/:]\\):[\t ]*\\(?3:[1-9][0-9]*\\)[\t ]*:\\(?3:[1-9][0-9]*:\\)" cand) | ||
(replace-match "" nil nil cand 3) | ||
cand) |
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.
I wonder if this can be simplified using replace-regexp-in-string
?
counsel.el
Outdated
"\\(?1:[^\n:]+?[^\n/:]\\):[\t ]*\\(?3:[1-9][0-9]*\\)[\t ]*:\\(?3:[1-9][0-9]*:\\)" cand) | ||
(replace-match "" nil nil cand 3) | ||
cand) | ||
(concat "./" prepend cand))) ivy--all-candidates)))) |
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.
Nitpick: Please place ivy--all-candidates
on a separate line, where it won't be hidden.
@mookid thanks, I have tested the patch, it seems not fixing my problem. I think this patch should be applied to the function |
@zilongshanren thanks for the feedback.
Probably to all 3 callers of |
@mookid |
I will take a look at it later today. |
31a328a
to
1067748
Compare
@zilongshanren could you please test again? thanks. |
@mookid Now it works, thanks. 👍 |
1067748
to
6d12ff0
Compare
6d12ff0
to
86de561
Compare
Thanks all. |
Remove print statement. Re #1835
…for wgrep. Fixes abo-abo#1800 Fixes abo-abo#1835
Remove print statement. Re abo-abo#1835
Fix #1800.
@zilongshanren: can you please test if this solves your issue?