summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuri Linkov <juri@linkov.net>2020-12-09 21:16:03 +0200
committerJuri Linkov <juri@linkov.net>2020-12-09 21:16:03 +0200
commit303f0a19cc6b819dd4dc750aa278ca8563d3b64b (patch)
tree757e3c7404ac9b814b0656b2fce63470f518fce8
parentef5e0785aee978c55abaecf44ba63867ff3598c4 (diff)
downloademacs-303f0a19cc6b819dd4dc750aa278ca8563d3b64b.tar.gz
Support highlighting of ripgrep output (bug#44983)
* etc/grep.txt: Add ripgrep samples. * lisp/progmodes/grep.el (grep-match-regexp): Highlight ripgrep matches too. (grep-regexp-alist): Remove $ to highlight ripgrep binary file matches.
-rw-r--r--etc/grep.txt6
-rw-r--r--lisp/progmodes/grep.el4
-rw-r--r--test/README3
3 files changed, 10 insertions, 3 deletions
diff --git a/etc/grep.txt b/etc/grep.txt
index 19a3b4b47b7..3dc4aac3c89 100644
--- a/etc/grep.txt
+++ b/etc/grep.txt
@@ -85,6 +85,12 @@ git --no-pager grep -inH -p -e "org-element-map"
lisp/org/org.el=20969=(defun org-fill-paragraph (&optional justify)
lisp/org/org.el:21047: (org-element-map
+* ripgrep
+
+rg -nH --color always --no-heading -e grep-match-regexp
+lisp/progmodes/grep.el:608: (while (re-search-forward grep-match-regexp end 1)
+Binary file emacs.info matches (found "\u{0}" byte around offset 2222525)
+
* unknown greps
grep -nH -e "xyzxyz" ../info/*
diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el
index 7c8acedaf3d..5dc99cc7e93 100644
--- a/lisp/progmodes/grep.el
+++ b/lisp/progmodes/grep.el
@@ -100,7 +100,7 @@ To change the default value, use \\[customize] or call the function
:set #'grep-apply-setting
:version "22.1")
-(defcustom grep-match-regexp "\033\\[0?1;31m\\(.*?\\)\033\\[[0-9]*m"
+(defcustom grep-match-regexp "\033\\[\\(?:0?1;\\)?31m\\(.*?\\)\033\\[[0-9]*m"
"Regular expression matching grep markers to highlight.
It matches SGR ANSI escape sequences which are emitted by grep to
color its output. This variable is used in `grep-filter'."
@@ -412,7 +412,7 @@ Notice that using \\[next-error] or \\[compile-goto-error] modifies
(- mend beg))))))
nil nil
(3 '(face nil display ":")))
- ("^Binary file \\(.+\\) matches$" 1 nil nil 0 1))
+ ("^Binary file \\(.+\\) matches" 1 nil nil 0 1))
"Regexp used to match grep hits.
See `compilation-error-regexp-alist' for format details.")
diff --git a/test/README b/test/README
index d0da89d1c2c..3365f18cf7e 100644
--- a/test/README
+++ b/test/README
@@ -113,7 +113,8 @@ $EMACS_HYDRA_CI indicates the hydra environment, and $EMACS_EMBA_CI
indicates the emba environment, respectively.
-(Also, see etc/compilation.txt for compilation mode font lock tests.)
+(Also, see etc/compilation.txt for compilation mode font lock tests
+and etc/grep.txt for grep mode font lock tests.)
This file is part of GNU Emacs.