From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#44983: Truncate long lines of grep output Date: Tue, 08 Dec 2020 21:41:28 +0200 Organization: LINKOV.NET Message-ID: <87mtyo3x1z.fsf@mail.linkov.net> References: <87v9dlc3ti.fsf_-_@mail.linkov.net> <83ft4pik35.fsf@gnu.org> <87sg8p5kw0.fsf@mail.linkov.net> <83eek8hoyx.fsf@gnu.org> <87h7p4r1n9.fsf@mail.linkov.net> <62EB4762-278D-43E7-8699-BBDC47818A50@gnu.org> <87zh2w7ww1.fsf@mail.linkov.net> <83pn3reyjs.fsf@gnu.org> <87y2ie7for.fsf@mail.linkov.net> <87h7p0f611.fsf@mail.linkov.net> <87a6uqafmk.fsf@mail.linkov.net> <87zh2q61n6.fsf@mail.linkov.net> <3620abd0-ce79-cc9d-3fb2-255e91f13da1@yandex.ru> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="2631"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) Cc: 44983@debbugs.gnu.org To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Dec 08 21:52:48 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kmjyZ-0000Z0-RP for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 08 Dec 2020 21:52:47 +0100 Original-Received: from localhost ([::1]:56358 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kmjyY-0004Cu-Sc for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 08 Dec 2020 15:52:46 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52562) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kmiys-0001Dl-Nl for bug-gnu-emacs@gnu.org; Tue, 08 Dec 2020 14:49:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:48339) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kmiys-0000yh-DE for bug-gnu-emacs@gnu.org; Tue, 08 Dec 2020 14:49:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kmiys-0005N8-BV for bug-gnu-emacs@gnu.org; Tue, 08 Dec 2020 14:49:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 08 Dec 2020 19:49:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 44983 X-GNU-PR-Package: emacs Original-Received: via spool by 44983-submit@debbugs.gnu.org id=B44983.160745690420603 (code B ref 44983); Tue, 08 Dec 2020 19:49:02 +0000 Original-Received: (at 44983) by debbugs.gnu.org; 8 Dec 2020 19:48:24 +0000 Original-Received: from localhost ([127.0.0.1]:59885 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kmiyF-0005MF-TC for submit@debbugs.gnu.org; Tue, 08 Dec 2020 14:48:24 -0500 Original-Received: from relay4-d.mail.gandi.net ([217.70.183.196]:36245) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kmiyC-0005Lx-DV for 44983@debbugs.gnu.org; Tue, 08 Dec 2020 14:48:22 -0500 X-Originating-IP: 91.129.99.98 Original-Received: from mail.gandi.net (m91-129-99-98.cust.tele2.ee [91.129.99.98]) (Authenticated sender: juri@linkov.net) by relay4-d.mail.gandi.net (Postfix) with ESMTPSA id 02150E000C; Tue, 8 Dec 2020 19:48:12 +0000 (UTC) In-Reply-To: <3620abd0-ce79-cc9d-3fb2-255e91f13da1@yandex.ru> (Dmitry Gutov's message of "Mon, 7 Dec 2020 04:41:09 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:195436 Archived-At: > Alternatively, xref--collect-matches-1 could apply the limit itself, no > matter whether grep or rg is used. And it could make sure to only do that > after the last match. This might be the slower option, but hard to say in > advance, some comparison benchmark could help here. I think until a long string is inserted to the buffer, truncating the string in the variable in xref--collect-matches-1 should be much faster. >> But this also requires customizing grep-match-regexp to the value >> "\033\\[[0-9]*m\033\\[[0-9]*1m\033\\[[0-9]*1m\\(.*?\\)\033\\[[0-9]*0m" >> provided by Simon in bug#41766. > > It's odd your last suggestion in that bug was not applied (adding :type > '(choice) to grep-match-regexp). Perhaps do that now? > > Although, personally, I've found a symbolic value to work better for a var > like that (example: xref-search-program). This way we can ultimately > consolidate info about a particular program in one place (some alist). > > That aside, could you explain the difference between the regexps? Do grep > and rg use different colors or something like that? Ideally, of course, > that would be just 1 regexp (if that's possible without loss in > performance, or significant loss in clarify). They should be merged into one regexp indeed. Because after customizing it to the rg regexp, grep output doesn't highlight matches anymore (I use both grep and rg interchangeably by different commands). Currently their separate regexps are: grep: "\033\\[0?1;31m \\(.*?\\) \033\\[[0-9]*m" rg: "\033\\[[0-9]*m \033\\[[0-9]*1m \033\\[[0-9]*1m \\(.*?\\) \033\\[[0-9]*0m" That could be combined into one regexp: "\033\\[[0-9?;]*m \\(?:\033\\[[0-9]*1m\\)\\{0,2\\} \\(.*?\\) \033\\[[0-9]*0?m"