From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Gregory Heytings Newsgroups: gmane.emacs.bugs Subject: bug#46859: 28.0.50; [PATCH]: Add option to truncate long lines in xref.el Date: Wed, 03 Mar 2021 13:53:56 +0000 Message-ID: <4119ea30557ef84ca190@heytings.org> References: <87im69uzlt.fsf@mail.linkov.net> <878s74fv27.fsf@mail.linkov.net> <4119ea3055ef8f306fc0@heytings.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="rQ53CY9bon" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="25237"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 46859@debbugs.gnu.org To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Mar 03 14:59:12 2021 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 1lHS1u-0006OL-Mw for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 03 Mar 2021 14:59:10 +0100 Original-Received: from localhost ([::1]:56216 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lHS1t-0004Wi-Lg for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 03 Mar 2021 08:59:09 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56422) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lHRxu-0006kA-Ab for bug-gnu-emacs@gnu.org; Wed, 03 Mar 2021 08:55:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:43876) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lHRxu-0002cJ-13 for bug-gnu-emacs@gnu.org; Wed, 03 Mar 2021 08:55:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lHRxt-0004ex-UH for bug-gnu-emacs@gnu.org; Wed, 03 Mar 2021 08:55:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Gregory Heytings Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 03 Mar 2021 13:55:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 46859 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 46859-submit@debbugs.gnu.org id=B46859.161477964817832 (code B ref 46859); Wed, 03 Mar 2021 13:55:01 +0000 Original-Received: (at 46859) by debbugs.gnu.org; 3 Mar 2021 13:54:08 +0000 Original-Received: from localhost ([127.0.0.1]:55422 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lHRwy-0004dU-B2 for submit@debbugs.gnu.org; Wed, 03 Mar 2021 08:54:08 -0500 Original-Received: from heytings.org ([95.142.160.155]:41388) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lHRws-0004d1-AW for 46859@debbugs.gnu.org; Wed, 03 Mar 2021 08:54:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=heytings.org; s=20210101; t=1614779636; bh=zy8Ydqx+6csVq8aAuj3N7PorcTaHh4gT6va1uhwBl9w=; h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References:From; b=c6zTzzPdzJEorR59ACOP6g9Du7pa2RYTRmc7VvRkQayxWLdBu+f3dJ4HIVeDjWUCO KwuEOR84QzAT3/081Gr7jPcEkwzkYtSsiMQHoajbP1UdU/55fk+LyZnsxK/4J3JaW3 LjjI81rJuXU8ebRv8IUnNoin10fP7wukA3KYovZJGq3aeQKzAA/lIzPLVJWBdJvGgC Dgj9MKOqfWo6n5EODbbYC6/0Bmq01ukMBDhnVMcMiLhii3xy4I96Z/rdu8mtnsQZ0m W5zu77dzYXmArNOL9a7omRNbyGl2C13HQ8t3OJ7jzpMuhk9M7qf98IWfgWJXywFUDc aRnFz4Xa/lmrg== In-Reply-To: Content-ID: <4119ea3055caa77083e0@heytings.org> 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:201274 Archived-At: --rQ53CY9bon Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Content-ID: <4119ea3055f423fb8702@heytings.org> >> Actually, it is possible to truncate output with GNU grep: >>=20 >> grep -oE '.{0,100}PATTERN.{0,100}' >>=20 >> prints at most 100 characters before and after PATTERN.=C2=A0 I find thi= s=20 >> much better than ripgrep -M. > > I'm not sure how to parse that output (it would be quite different from= =20 > what we get now), > How so? AFAICS, it's the exact same kind of output, except that it gets=20 truncated. And it's (obviously?) better to see the context of the pattern= =20 you are searching for, instead of the first characters of the lines on=20 which the pattern is found, in which the pattern might not be present. > > and if the one-long-line file has many matches inside, we'll still get=20 > them all, which we might or might not want. > Indeed, if one-long-line has many matches inside, you'll get them all,=20 which IMO makes perfect sense. Note that this does not happen when all matches are inside the boundaries.= =20 For example, if your search for '.{0,100}b.{0,100}' on "aaaabbbbcccc", you= =20 get a single match; if you search for '.{0,1}b.{0,1}' on that same string= =20 you get two matches. --rQ53CY9bon--