ripgrep.el
ripgrep.el copied to clipboard
Highlighting doesn't work with ripgrep 0.5.1
For me highlighting in ripgrep.el is not working with ripgrep 0.5.1 (I haven't tried significantly older versions) but I'm not sure what is the actual reason: if it's environment or ripgrep, but it might be the latter as it seems upstream ripgrep was introducing incompatible changes related to color handling.
I made ripgrep.el work with colors on my machine with the following changes:
configuration:
(setq ripgrep-executable "rg --color=always")
ripgrep-filter in ripgrep.el
- (while (re-search-forward "\033\\[30;43m\\(.*?\\)\033\\[[0-9]*m" end 1)
+ (while (re-search-forward "\033\\[m\033\\[31m\033\\[1m\\(.*?\\)\033\\[[0-9]*m" end 1)
I wonder if anyone has a similar issue?
Relying on colors escape sequences seems very fragile. There is a discussion on providing machine-parseable matching results in ripgrep: BurntSushi/ripgrep/issues/244
Same issue with ripgrep 0.5.1. The workaround works for me. I suggest to make a PR for it.
Sure, I'll create a PR if @nlamirault provides a feedback.
Any update for the PR?
@vlevit sure create a PR i will merge it. i'm on holiday :)
Thanks! I think the issue can be closed if someone can confirm the change is working.
This fix does not work for me. I still have this issue.
With test in command-line, rg
does have match highlighting for results.
Emacs version: GNU Emacs 27.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.28) of 2018-03-09 ripgrep version ripgrep 0.8.1 -SIMD -AVX ripgrep.el version: MELPA latest version. And here is my config:
(use-package ripgrep
:ensure t
:ensure-system-package (rg . "cargo install ripgrep")
:defer t
:bind (:map ripgrep-prefix ("r" . ripgrep-regexp))
:init
(add-to-list 'ripgrep-arguments "--color=auto")
(add-to-list 'display-buffer-alist
'("^\\*ripgrep-search\\*" (display-buffer-below-selected)))
)
It works for me. My config is below
(use-package rg
:init
(add-hook 'after-init-hook #'rg-enable-default-bindings)
(if (fboundp 'wgrep-ag-setup)
(add-hook 'rg-mode-hook #'wgrep-ag-setup))
:config
(setq rg-custom-type-aliases nil)
(setq rg-group-result t)
(setq rg-show-columns t))
@seagle0128 They are two different packages, rg
repo is here: https://github.com/dajva/rg.el
After testing rg.el
, it does support matching highlight. Thanks.
@stardiviner Sorry. It's different.