GNU bug report logs - #41766
Make it possible to change regexp to identify and highlight grep matches via customization

Previous Next

Package: emacs;

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

From: Simon Lang <Simon.lang <at> outlook.com>
To: Juri Linkov <juri <at> linkov.net>, Simon Lang <simon.lang <at> yellowfrog.io>
Cc: "Basil L. Contovounesios" <contovob <at> tcd.ie>, "41766 <at> debbugs.gnu.org" <41766 <at> debbugs.gnu.org>, Dmitry Gutov <dgutov <at> yandex.ru>
Subject: bug#41766: Make it possible to change regexp to identify and highlight grep matches via customization
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 <juri <at> linkov.net>
Sent: 15 June 2020 00:08
To: Simon Lang
Cc: Simon Lang; Dmitry Gutov; Basil L. Contovounesios; 41766 <at> debbugs.gnu.org
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.




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.