From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jim Porter Newsgroups: gmane.emacs.bugs Subject: bug#49609: [PATCH] Add option for handling SGR control sequences in compilation-mode Date: Sat, 17 Jul 2021 13:57:41 -0700 Message-ID: References: <87a6mkohob.fsf@ya.ru> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5561"; mail-complaints-to="usenet@ciao.gmane.io" To: 49609@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jul 17 22:58:15 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 1m4rO1-0001GD-2R for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 17 Jul 2021 22:58:13 +0200 Original-Received: from localhost ([::1]:58366 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m4rNz-0007CR-AX for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 17 Jul 2021 16:58:11 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:46808) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m4rNq-0007Ae-M5 for bug-gnu-emacs@gnu.org; Sat, 17 Jul 2021 16:58:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:43122) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m4rNq-0006lu-Dd for bug-gnu-emacs@gnu.org; Sat, 17 Jul 2021 16:58:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1m4rNq-0007hQ-BY for bug-gnu-emacs@gnu.org; Sat, 17 Jul 2021 16:58:02 -0400 X-Loop: help-debbugs@gnu.org In-Reply-To: <87a6mkohob.fsf@ya.ru> Resent-From: Jim Porter Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 17 Jul 2021 20:58:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 49609 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 49609-submit@debbugs.gnu.org id=B49609.162655547929588 (code B ref 49609); Sat, 17 Jul 2021 20:58:02 +0000 Original-Received: (at 49609) by debbugs.gnu.org; 17 Jul 2021 20:57:59 +0000 Original-Received: from localhost ([127.0.0.1]:54668 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m4rNn-0007hA-Ht for submit@debbugs.gnu.org; Sat, 17 Jul 2021 16:57:59 -0400 Original-Received: from mail-pf1-f182.google.com ([209.85.210.182]:41749) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m4rNl-0007gv-Vm for 49609@debbugs.gnu.org; Sat, 17 Jul 2021 16:57:58 -0400 Original-Received: by mail-pf1-f182.google.com with SMTP id u126so4787758pfb.8 for <49609@debbugs.gnu.org>; Sat, 17 Jul 2021 13:57:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=OYD/HlKFnBWnUMaGURNrwBk6xLFmHm0XraXBvXpxXNo=; b=ZTQakFt9XyRDno7cd3u1ewoBxrXTiKMknFHgEHX24ipkjZRNSlRLGJzRReGVmBSNrF YxwNYaMvONivwAFdJs5scyE6okLCLQjhSBN7o862lzK4VB4WPIE0TxItpAKeftXCn9VS vafOWDNc7mWr97CfV6GZ0zad6fWx/dbwFnsyQYeEdaoV11hyeAbfqWDqkW1z15Cu64zs /hSWw4toz3iaZAK3AfEG0iPYET/tvoIwMIaN7nF63hOrI92qyPuvpV7TgOzthxuu7LMa OOHYIUyZXFrLzEQjru5HhSAfedCsk4on/24Zkf62Yvf45FyiPXRQl5g0EoSf4nDtuOjx 1ZUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=OYD/HlKFnBWnUMaGURNrwBk6xLFmHm0XraXBvXpxXNo=; b=o6dFSUHlbRCGY/KOtW+KxWYkXCMuo30OLzfWXamgqYrm4Wa2+65FmbLumCjWO6THom daaAjVRFq8VlxapVNe/akZ7EM8rQgbxyFU/XDVIxpXNLFtQG9qda/viduQVsVH+nt4mU 4gkrW0YgWpYxAi2XpSdQ6rCil5Ba238mhEeJzJRxlILGEDUox4AjPPWRlULkrbhV8XmB tEKlOe/7ROJhG8q3pliQBdFTMqQt1BoyCpELURScems67nvCQxqS3/KrZGB08Mt47zQj +l9d5WH3m744/0mWYt9qE2VnMLx9lTDTo0cctYwiTzq2eZRG0GDb14sluhtiNDXGlYgt cMNA== X-Gm-Message-State: AOAM531QGKYoisxAkugWUZsSoYkwDj4EImqULOWJ4D1j163eUwX1ryvo PcEdXXIRXm0gOxu+FaGE4ZA8lo5AaOGKlkuBXcKScadullg= X-Google-Smtp-Source: ABdhPJz4ES/Z8nFXgnip8e5nT3Vc+gjdIv7Dc0p7NbV6Z3bqEth5GjOR2KVk6DLO3+jizA8qBSnQYmBgryaqh5jR22E= X-Received: by 2002:a62:8209:0:b029:32e:54d4:7e27 with SMTP id w9-20020a6282090000b029032e54d47e27mr17524090pfd.10.1626555471735; Sat, 17 Jul 2021 13:57:51 -0700 (PDT) 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:210147 Archived-At: One issue I've seen with handling SGR control sequences in compilation-mode is that it can sometimes cause issues with grep-mode and other similar modes in third-party packages. `grep-filter' also handles SGR control sequences, but only works with full lines; this is a simplification to (mostly) ensure that both the start and end of a "match" highlight are present at the same time, so that `grep-filter' can just use a simple regexp. However, as far as I understand it, `ansi-color-apply-on-region' has no such limitation and can handle parsing the *start* of some highlighted text in one call to the function, and then handle the end of it in another call. If, when grep is printing results, the output is flushed in the middle of a match highlight, this results in the SGR sequence to start a highlight being stripped by the time `grep-filter' runs, so it's not able to fontify the match. It might be nice if `grep-filter' were smart enough to work with the output as-is rather than only operating on whole lines. That would probably be more robust. However, for this patch, maybe it would be enough to locally set `ansi-color-for-compilation-mode' to nil for grep-mode.