From mboxrd@z Thu Jan  1 00:00:00 1970
Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail
From: Pablo Barbachano <pablo.barbachano@gmail.com>
Newsgroups: gmane.emacs.bugs
Subject: bug#37814: [PATCH] Add an option to preserve ANSI sequences
Date: Fri, 01 Nov 2019 21:25:28 +0100
Message-ID: <87y2wz9wef.fsf@exupery.localdomain>
References: <20191018181813.21848-1-pablo.barbachano@gmail.com>
 <838sph8ds3.fsf@gnu.org>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226";
	logging-data="154514"; mail-complaints-to="usenet@blaine.gmane.org"
Cc: 37814@debbugs.gnu.org
To: Eli Zaretskii <eliz@gnu.org>
Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Nov 01 21:26:14 2019
Return-path: <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org>
Envelope-to: geb-bug-gnu-emacs@m.gmane.org
Original-Received: from lists.gnu.org ([209.51.188.17])
	by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
	(Exim 4.89)
	(envelope-from <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org>)
	id 1iQdUq-000e29-DT
	for geb-bug-gnu-emacs@m.gmane.org; Fri, 01 Nov 2019 21:26:12 +0100
Original-Received: from localhost ([::1]:42688 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org>)
	id 1iQdUo-0006Mf-NJ
	for geb-bug-gnu-emacs@m.gmane.org; Fri, 01 Nov 2019 16:26:10 -0400
Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44553)
 by lists.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1iQdUh-0006Kz-Ko
 for bug-gnu-emacs@gnu.org; Fri, 01 Nov 2019 16:26:04 -0400
Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1iQdUg-0007tk-Cb
 for bug-gnu-emacs@gnu.org; Fri, 01 Nov 2019 16:26:03 -0400
Original-Received: from debbugs.gnu.org ([209.51.188.43]:48491)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
 (Exim 4.71) (envelope-from <Debian-debbugs@debbugs.gnu.org>)
 id 1iQdUg-0007tB-8k
 for bug-gnu-emacs@gnu.org; Fri, 01 Nov 2019 16:26:02 -0400
Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2)
 (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1iQdUg-0005RT-4v
 for bug-gnu-emacs@gnu.org; Fri, 01 Nov 2019 16:26:02 -0400
X-Loop: help-debbugs@gnu.org
Resent-From: Pablo Barbachano <pablo.barbachano@gmail.com>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@gnu.org
Resent-Date: Fri, 01 Nov 2019 20:26:02 +0000
Resent-Message-ID: <handler.37814.B37814.157263994220874@debbugs.gnu.org>
Resent-Sender: help-debbugs@gnu.org
X-GNU-PR-Message: followup 37814
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: patch
Original-Received: via spool by 37814-submit@debbugs.gnu.org id=B37814.157263994220874
 (code B ref 37814); Fri, 01 Nov 2019 20:26:02 +0000
Original-Received: (at 37814) by debbugs.gnu.org; 1 Nov 2019 20:25:42 +0000
Original-Received: from localhost ([127.0.0.1]:57311 helo=debbugs.gnu.org)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <debbugs-submit-bounces@debbugs.gnu.org>)
 id 1iQdUM-0005Qb-2N
 for submit@debbugs.gnu.org; Fri, 01 Nov 2019 16:25:42 -0400
Original-Received: from mail-wr1-f66.google.com ([209.85.221.66]:33222)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <pablo.barbachano@gmail.com>) id 1iQdUH-0005QE-U4
 for 37814@debbugs.gnu.org; Fri, 01 Nov 2019 16:25:38 -0400
Original-Received: by mail-wr1-f66.google.com with SMTP id s1so10789733wro.0
 for <37814@debbugs.gnu.org>; Fri, 01 Nov 2019 13:25:37 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; 
 h=from:to:cc:subject:in-reply-to:references:date:message-id
 :mime-version; bh=9nhfMH/Qrm3B+E9daFIC/SxJprr81hFX+6jfpC906RY=;
 b=Hsox2A6orG9AKKxD+hKR92SbCiSGd4Pw8R6LtOwskaZYTLwb9VKeUp0kipaKQzWDdl
 opi+CGyPp84+bRcRzJIa/loPeZ3cOD3/+JPcEQMKjTELg5ZK1sIXS580S4FV2/lW9fXi
 igGndOXDIyuBVcOivlbr7B6FItBNIF2bscUmdkgLPhBT4saj9tdqydGdwWNi7hVtiQDg
 IgeJLUSwNWCcqDf1NLGCRy1OhPZfz59PKoHwRIYoq5C/tNZ4gMN8gPVwUTECoLVdPgwg
 RJQxb0YJ+xgi2lbGwfS48UdRA1CZknIx5k8BW8h5vBOwHwD4U9d+19RcMG/v0yadVnrY
 ei8Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date
 :message-id:mime-version;
 bh=9nhfMH/Qrm3B+E9daFIC/SxJprr81hFX+6jfpC906RY=;
 b=IMRUMqlgLfTmHZBeR4HfomyxRyQwyQvM6xNuBSJ1Jbq75bUH0kWFUR24N7+trA7C/Y
 Nc9O/7H+474b8P0xIu9qskQ/n8hBPYKybbnoNIa47pOAHBJPQyt3Cqr58fsBwDhvDi+b
 ajRbtwNYh8pG5uHnpBWdcRlfN7Z2HdA/xSYwfsICrszTnjPc8kgpGSlOYkV/MbvaFDLa
 vCbRLG6yq2k91BzIbvFFWLg/JH92tL0P9boAa9qmj36c/d4Z4ID/dzU1Bsy09sglfjzm
 6G2o0aa+EIibCCXwKfIf4BXUWojxhwmk8oLrlxy0mJcDb2/p5adSL7w/9nvS8EauJ5SZ
 fznQ==
X-Gm-Message-State: APjAAAVqy4wu87lmT1vAOQWQt5N9GU+LnGv1Qc+X4FimI6j9CaghA4i+
 fvveDb5sKXpoU3yF9ZnEua2DKgnHFrc=
X-Google-Smtp-Source: APXvYqzKytCwX528mSVaKCjTToIJyck7isl+jJRbPHn6WPNGSKLQUMRVoWYblMHzoXE06OuJYurk1Q==
X-Received: by 2002:adf:9f43:: with SMTP id f3mr12320728wrg.76.1572639931038; 
 Fri, 01 Nov 2019 13:25:31 -0700 (PDT)
Original-Received: from exupery (x4d0d3293.dyn.telefonica.de. [77.13.50.147])
 by smtp.gmail.com with ESMTPSA id 26sm7338274wmi.17.2019.11.01.13.25.29
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 01 Nov 2019 13:25:30 -0700 (PDT)
In-Reply-To: <838sph8ds3.fsf@gnu.org>
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 209.51.188.43
X-BeenThere: bug-gnu-emacs@gnu.org
List-Id: "Bug reports for GNU Emacs,
 the Swiss army knife of text editors" <bug-gnu-emacs.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-gnu-emacs>,
 <mailto:bug-gnu-emacs-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/archive/html/bug-gnu-emacs>
List-Post: <mailto:bug-gnu-emacs@gnu.org>
List-Help: <mailto:bug-gnu-emacs-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-gnu-emacs>,
 <mailto:bug-gnu-emacs-request@gnu.org?subject=subscribe>
Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org
Original-Sender: "bug-gnu-emacs"
 <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org>
Xref: news.gmane.org gmane.emacs.bugs:170677
Archived-At: <http://permalink.gmane.org/gmane.emacs.bugs/170677>


Hi,

> Could you please elaborate on the use case(s) that could benefit from
> this change?

My use case is when running shell code in org-babel and capturing the resulting output. I can get it to interpret the ANSI sequences, but when I save the org buffer, the ANSI information would get lost.

This is actually what I'm trying to do: https://emacs.stackexchange.com/questions/35364/how-do-i-attach-a-custom-function-to-process-org-mode-babel-shell-output

> Also, using overlays would mean that copying the text elsewhere will
> reveal the SGR sequences, is that intended?  If not, perhaps using
> text properties would be better?

So far I haven't had a need for that. Also, since the rest of the code uses overlays, would it be OK to mix text properties and overlays?

> Did you consider using some non-trivial invisibility spec instead of
> just t?  It's hard to say if this would make sense without knowing the
> use cases you had in mind.

I didn't think of it. But I can see now that a keyword argument would allow for different behaviors:

- nil - delete the sequences (default)
- 'invisible - invisible overlay over the sequences
- 'keep - don't delete the sequences

I will rework the patch to allow that.

> The commit log message is not formatted according to our conventions;
> see CONTRIBUTE in the Emacs sources for the details.

Thanks. I will look at it.

> Finally, these changes are too large for us to accept them without a
> copyright assignment.  Would you like to start the legal paperwork to
> that end?  If so, I will send you the form to fill.

Yes, please, send me the form.

> Thanks again for your interest in Emacs.

Thank you for the fast review!

--
Pablo