From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#44983: Truncate long lines of grep output Date: Thu, 03 Dec 2020 16:47:51 +0200 Message-ID: <83pn3reyjs.fsf@gnu.org> 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> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="38292"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 44983@debbugs.gnu.org, dgutov@yandex.ru To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Dec 03 15:49:11 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 1kkpux-0009re-EV for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 03 Dec 2020 15:49:11 +0100 Original-Received: from localhost ([::1]:58614 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kkpuv-0007zp-RB for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 03 Dec 2020 09:49:09 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:42680) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kkpuo-0007zh-6a for bug-gnu-emacs@gnu.org; Thu, 03 Dec 2020 09:49:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:55721) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kkpun-0005lm-Tx for bug-gnu-emacs@gnu.org; Thu, 03 Dec 2020 09:49:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kkpun-0000vK-QF for bug-gnu-emacs@gnu.org; Thu, 03 Dec 2020 09:49:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 03 Dec 2020 14:49:01 +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.16070069023503 (code B ref 44983); Thu, 03 Dec 2020 14:49:01 +0000 Original-Received: (at 44983) by debbugs.gnu.org; 3 Dec 2020 14:48:22 +0000 Original-Received: from localhost ([127.0.0.1]:39034 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kkpu9-0000uQ-I3 for submit@debbugs.gnu.org; Thu, 03 Dec 2020 09:48:21 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:52514) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kkpu7-0000uB-Kh for 44983@debbugs.gnu.org; Thu, 03 Dec 2020 09:48:20 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:44553) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kkpu0-0005Um-MT; Thu, 03 Dec 2020 09:48:12 -0500 Original-Received: from [176.228.60.248] (port=4053 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1kkpu0-0000JO-2z; Thu, 03 Dec 2020 09:48:12 -0500 In-Reply-To: <87zh2w7ww1.fsf@mail.linkov.net> (message from Juri Linkov on Wed, 02 Dec 2020 22:53:18 +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:194902 Archived-At: > From: Juri Linkov > Cc: dgutov@yandex.ru, 44983@debbugs.gnu.org > Date: Wed, 02 Dec 2020 22:53:18 +0200 > > > Does it help to set bidi-inhibit-bpa non-nil? > > This helped to open the file with a lot of '{'. > But on minified files grep.el is still very slow. What are "minified files"? And when you say "slow" do you mean slow in receiving Grep output, slow in displaying the received output, or slow in moving though the *grep* buffer after everything was displayed? > Then instead of hiding long lines using font-lock, > I tried to do the same using the process filter: > > (defun grep-filter () > (save-excursion > (let ((end (point-marker))) > (goto-char compilation-filter-start) > (forward-line 0) > (while (< (point) end) > (let ((eol (line-end-position))) > (when (> (- eol (point)) 64) > (put-text-property (+ 64 (point)) (line-end-position) > 'display "[…]")) > (forward-line 1)))))) > > Still very slow. Same question as above. > Then tried to delete the excessive parts of long lines: > > (defun grep-filter-try () > (save-excursion > (let ((end (point-marker))) > (goto-char compilation-filter-start) > (forward-line 0) > (while (< (point) end) > (let ((eol (line-end-position))) > (when (> (- eol (point)) 64) > (delete-region (min (+ 64 (point)) (point-max)) (line-end-position))) > (forward-line 1)))))) > > Now Emacs becomes more responsive. But still output processing > takes too much time. What is "output processing", and how did you measure the time it takes? > Finally, the last thing to try was the same solution that Richard > showed in bug#44941: > > grep -a "$@" | cut -c -200 > > that gives the best possible result. > > I doubt that it would be possible to invent something better. > > So the question is should this be customizable for adding > `cut -c` automatically to the end of the grep command line, > possibly with `stdbuf -oL` suggested by Andreas. I suggested to request the equivalent of "cut -c" to be a feature added to Grep. Failing that, I don't think Emacs should do something like that, especially since 'cut' is not guaranteed to be available. Users who have such problems can, of course, modify the Grep command to do that.