summaryrefslogtreecommitdiff
path: root/lisp/progmodes/grep.el
diff options
context:
space:
mode:
authorSimon Lang <Simon.lang@outlook.com>2020-09-27 14:55:22 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2020-09-27 14:55:29 +0200
commitcea06818a1e7462090df90d41d5298b975ee9b27 (patch)
tree09abfc47cd2efeeacae94270320b64549c38d382 /lisp/progmodes/grep.el
parent8bd233a7eb6bc4709d0adf0577d30aaf167e75bf (diff)
downloademacs-cea06818a1e7462090df90d41d5298b975ee9b27.tar.gz
Add a new grep-match-regexp variable
* doc/emacs/building.texi (Grep Searching): Document it. * lisp/progmodes/grep.el (grep-match-regexp): New variable (bug#41766). (grep-filter): Use it.
Diffstat (limited to 'lisp/progmodes/grep.el')
-rw-r--r--lisp/progmodes/grep.el9
1 files changed, 8 insertions, 1 deletions
diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el
index c71a90344ff..279eb4d54b1 100644
--- a/lisp/progmodes/grep.el
+++ b/lisp/progmodes/grep.el
@@ -100,6 +100,13 @@ 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"
+ "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'."
+ :type 'regexp
+ :version "28.1")
+
(defcustom grep-scroll-output nil
"Non-nil to scroll the *grep* buffer window as output appears.
@@ -590,7 +597,7 @@ This function is called from `compilation-filter-hook'."
(when (< (point) end)
(setq end (copy-marker end))
;; Highlight grep matches and delete marking sequences.
- (while (re-search-forward "\033\\[0?1;31m\\(.*?\\)\033\\[[0-9]*m" end 1)
+ (while (re-search-forward grep-match-regexp end 1)
(replace-match (propertize (match-string 1)
'face nil 'font-lock-face grep-match-face)
t t)