[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#41766: Make it possible to change regexp to identify and highlight g
From: |
Juri Linkov |
Subject: |
bug#41766: Make it possible to change regexp to identify and highlight grep matches via customization |
Date: |
Mon, 15 Jun 2020 02:08:12 +0300 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) |
>> Or for a completely new tool:
>>
>> (nconc (get 'grep-program 'custom-type) '((const :tag "ripgrep" "rg")))
>
> Maybe still fine to merge my patch now and look at this later?
> One would not contradict the other, I would think?
Yes, your patch is a good starting point, thanks.
A minor worry is that you put back defcustom instead of leaving defvar.
I can't imagine a user who might want to customize it using literal
escape characters in the customization input field.
Maybe this is fine for now, but in the long run it would be better to
allow an alist of mappings from the grep program name to its escape sequences
like
(defvar grep-match-regexp
'(("grep" . "\033\\[0?1;31m\\(.*?\\)\033\\[[0-9]*m")
("ripgrep" .
""\033\\[[0-9]*m\033\\[[0-9]*1m\033\\[[0-9]*1m\\(.*?\\)\033\\[[0-9]*0m"")))
Then you can easily switch between grep and ripgrep without losing
information about their escape sequences.
But of course this could be improved after installing your current patch.
bug#41766: Make it possible to change regexp to identify and highlight grep matches via customization, Eli Zaretskii, 2020/06/09
bug#41766: Make it possible to change regexp to identify and highlight grep matches via customization, Simon Lang, 2020/06/14
- bug#41766: Make it possible to change regexp to identify and highlight grep matches via customization,
Juri Linkov <=