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

counsel--grep-mode-occur: remove column indicators for wgrep. #1835

Closed
wants to merge 1 commit into from

Conversation

@mookid
Copy link
Contributor

commented Dec 2, 2018

Fix #1800.

@zilongshanren: can you please test if this solves your issue?

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)

This comment has been minimized.

Copy link
@basil-conto

basil-conto Dec 2, 2018

Collaborator

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.)

This comment has been minimized.

Copy link
@mookid

mookid Dec 3, 2018

Author Contributor

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)

This comment has been minimized.

Copy link
@basil-conto

basil-conto Dec 2, 2018

Collaborator

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)

This comment has been minimized.

Copy link
@basil-conto

basil-conto Dec 2, 2018

Collaborator

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))))

This comment has been minimized.

Copy link
@basil-conto

basil-conto Dec 2, 2018

Collaborator

Nitpick: Please place ivy--all-candidates on a separate line, where it won't be hidden.

@zilongshanren

This comment has been minimized.

Copy link

commented Dec 3, 2018

@mookid thanks, I have tested the patch, it seems not fixing my problem.

I think this patch should be applied to the function counsel-grep-like-occur .

@mookid

This comment has been minimized.

Copy link
Contributor Author

commented Dec 3, 2018

@zilongshanren thanks for the feedback.

I think this patch should be applied to the function counsel-grep-like-occur .

Probably to all 3 callers of ivy--occur-insert-lines in counsel.el indeed.

@zilongshanren

This comment has been minimized.

Copy link

commented Dec 3, 2018

@mookid
I manually copy the patch code to counsel-grep-like-occur fun, but it is not working :(

@mookid

This comment has been minimized.

Copy link
Contributor Author

commented Dec 3, 2018

I will take a look at it later today.

@mookid mookid force-pushed the mookid:counsel-ag-wgrep branch from 31a328a to 1067748 Dec 4, 2018

@mookid

This comment has been minimized.

Copy link
Contributor Author

commented Dec 4, 2018

@zilongshanren could you please test again? thanks.

@zilongshanren

This comment has been minimized.

Copy link

commented Dec 5, 2018

@mookid Now it works, thanks. 👍

@mookid mookid force-pushed the mookid:counsel-ag-wgrep branch from 1067748 to 6d12ff0 Dec 8, 2018

@mookid mookid force-pushed the mookid:counsel-ag-wgrep branch from 6d12ff0 to 86de561 Dec 12, 2018

@abo-abo abo-abo closed this in fcbd944 Dec 13, 2018

@abo-abo

This comment has been minimized.

Copy link
Owner

commented Dec 13, 2018

Thanks all.

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

@mookid mookid deleted the mookid:counsel-ag-wgrep branch Dec 13, 2018

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