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: Thu, 24 Dec 2020 22:33:18 +0200 Organization: LINKOV.NET Message-ID: <87pn2zkkq9.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> <87mtyo3x1z.fsf@mail.linkov.net> <857088a6-fe90-d989-9115-2c159b2a02e6@yandex.ru> <87lfe6x1uf.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26089"; 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 Thu Dec 24 21:39:29 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 1ksXOS-0006gX-FT for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 24 Dec 2020 21:39:28 +0100 Original-Received: from localhost ([::1]:59898 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ksXOR-0007oF-FX for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 24 Dec 2020 15:39:27 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45128) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ksXO3-0007jj-Tt for bug-gnu-emacs@gnu.org; Thu, 24 Dec 2020 15:39:04 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:44521) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ksXO3-0007EO-Gy for bug-gnu-emacs@gnu.org; Thu, 24 Dec 2020 15:39:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ksXO3-0008J9-F3 for bug-gnu-emacs@gnu.org; Thu, 24 Dec 2020 15:39:03 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 24 Dec 2020 20:39:03 +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.160884231931881 (code B ref 44983); Thu, 24 Dec 2020 20:39:03 +0000 Original-Received: (at 44983) by debbugs.gnu.org; 24 Dec 2020 20:38:39 +0000 Original-Received: from localhost ([127.0.0.1]:56064 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ksXNe-0008I9-R9 for submit@debbugs.gnu.org; Thu, 24 Dec 2020 15:38:39 -0500 Original-Received: from relay4-d.mail.gandi.net ([217.70.183.196]:43541) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ksXNb-0008HU-EC for 44983@debbugs.gnu.org; Thu, 24 Dec 2020 15:38:37 -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 E124FE0003; Thu, 24 Dec 2020 20:38:27 +0000 (UTC) In-Reply-To: <87lfe6x1uf.fsf@mail.linkov.net> (Juri Linkov's message of "Wed, 09 Dec 2020 21:17:28 +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:196659 Archived-At: --=-=-= Content-Type: text/plain > Anyway, I found the shortest change needed to support ripgrep, > and pushed to master. Here is another patch needed to support rg because currently rg fails when --color is used without a value. OTOH, in grep --color is the same as --color=auto, so this is a win-win situation: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=grep-color-auto.patch diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el index 5dc99cc7e9..ef73dac4c0 100644 --- a/lisp/progmodes/grep.el +++ b/lisp/progmodes/grep.el @@ -79,7 +79,7 @@ grep-highlight-matches markers for highlighting and adds the --color option in front of any explicit grep options before starting the grep. -When this option is `auto', grep uses `--color' to highlight +When this option is `auto', grep uses `--color=auto' to highlight matches only when it outputs to a terminal (when `grep' is the last command in the pipe), thus avoiding the use of any potentially-harmful escape sequences when standard output goes to a file or pipe. @@ -95,7 +95,7 @@ grep-highlight-matches :type '(choice (const :tag "Do not highlight matches with grep markers" nil) (const :tag "Highlight matches with grep markers" t) (const :tag "Use --color=always" always) - (const :tag "Use --color" auto) + (const :tag "Use --color=auto" auto) (other :tag "Not Set" auto-detect)) :set #'grep-apply-setting :version "22.1") @@ -743,7 +743,7 @@ grep-compute-defaults `(nil nil nil "--color" "x" ,(null-device)) nil 1) (if (eq grep-highlight-matches 'always) - "--color=always" "--color")) + "--color=always" "--color=auto")) "") grep-options))) (unless grep-template @@ -1000,7 +1000,7 @@ grep-expand-template ((eq grep-highlight-matches 'always) (push "--color=always" opts)) ((eq grep-highlight-matches 'auto) - (push "--color" opts))) + (push "--color=auto" opts))) opts)) (excl . ,excl) (dir . ,dir) --=-=-=--