Subject: Re: bug#41766: Make it possible to change regexp to identify and highlight grep matches via customization

From: Simon Lang <[email-masked]>
Date: Mon, 22 Jun 2020 19:09:12 +0000

I changed it to defcustom because this is how I currently use it and no one had strong feelings about it. 
Do you want me to change it to devfar again? Or is it fine as it is? 

Thanks,

Simon

________________________________________
From: Juri Linkov <[email-masked]>
Sent: 15 June 2020 00:08
To: Simon Lang
Cc: Simon Lang; Dmitry Gutov; Basil L. Contovounesios; [email-masked]
Subject: Re: bug#41766: Make it possible to change regexp to identify and highlight grep matches via customization

>> 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.