GNU bug report logs -
#41766
Make it possible to change regexp to identify and highlight grep matches via customization
Previous Next
Reported by: Simon Lang <simon.lang <at> outlook.com>
Date: Mon, 8 Jun 2020 21:32:02 UTC
Severity: normal
Fixed in version 28.1
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Hi,
I changed grep-regexp-match to grep-match-regexp.
Pls note that ripgrep knows about ignore files etc. hence the more fair comparison would probably be git grep (e.g. vc-git-grep). But ripgrep is still considerably faster and does not only work for git repositories.
Thanks!
________________________________________
From: DG <raaahh <at> gmail.com> on behalf of Dmitry Gutov <dgutov <at> yandex.ru>
Sent: 09 June 2020 01:44
To: Simon Lang; 41766 <at> debbugs.gnu.org
Subject: Re: bug#41766: Make it possible to change regexp to identify and highlight grep matches via customization
On 08.06.2020 23:25, Simon Lang wrote:
> For example:
>
> change grep command to
>
> "rg -n -H -S --no-heading --color always -e"
I wonder if we can use a similar customization more generally. For
instance, in my testing Grep searches the full Emacs checkout in ~230ms,
whereas RipGrep does that in ~40ms. The difference is perceptible.
The obvious idea is to use grep-template, but we're passing -s and -E to
it. rg would interpret these options differently.
Here's a perftest patch if someone was personally curious about the
difference:
diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el
index 5b5fb4bc47..2c6ed4da7d 100644
--- a/lisp/progmodes/xref.el
+++ b/lisp/progmodes/xref.el
@@ -1262,7 +1262,7 @@ xref-matches-in-files
(dir (file-name-directory (car files)))
(remote-id (file-remote-p dir))
;; 'git ls-files' can output broken symlinks.
- (command (format "xargs -0 grep %s -snHE -e %s"
+ (command (format "xargs -0 rg %s -nH -e %s"
(if (and case-fold-search
(isearch-no-upper-case-p regexp t))
"-i"
@@ -1275,6 +1275,7 @@ xref-matches-in-files
#'tramp-file-local-name
#'file-local-name)
files)))
+ (setq tt (time-to-seconds))
(with-current-buffer output
(erase-buffer)
(with-temp-buffer
@@ -1289,6 +1290,7 @@ xref-matches-in-files
shell-command-switch
command)))
(goto-char (point-min))
+ (message "%s" (- (time-to-seconds) tt))
(when (and (/= (point-min) (point-max))
(not (looking-at grep-re))
;; TODO: Show these matches as well somehow?
[0001-Make-regexp-used-to-highlight-grep-matches-customiza.patch (application/octet-stream, attachment)]
This bug report was last modified 4 years and 240 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.