From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: npostavs@users.sourceforge.net Newsgroups: gmane.emacs.bugs Subject: bug#27407: 25.2; SGR reset is ignored if it terminates Eshell's output Date: Sun, 18 Jun 2017 15:34:11 -0400 Message-ID: <87mv95qedo.fsf@users.sourceforge.net> References: <20170617113103.GB7315@gmail.com> <87a856schh.fsf@users.sourceforge.net> <20170618064917.GB3761@gmail.com> <87poe1qj6r.fsf@users.sourceforge.net> <20170618180742.GC2617@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1497814393 23593 195.159.176.226 (18 Jun 2017 19:33:13 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 18 Jun 2017 19:33:13 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2.50 (gnu/linux) Cc: 27407@debbugs.gnu.org To: Pierre Neidhardt Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Jun 18 21:33:09 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dMfwb-0005g8-2p for geb-bug-gnu-emacs@m.gmane.org; Sun, 18 Jun 2017 21:33:09 +0200 Original-Received: from localhost ([::1]:39348 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dMfwc-00054T-Sv for geb-bug-gnu-emacs@m.gmane.org; Sun, 18 Jun 2017 15:33:10 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35426) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dMfwX-00054I-B7 for bug-gnu-emacs@gnu.org; Sun, 18 Jun 2017 15:33:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dMfwU-0008Fe-8B for bug-gnu-emacs@gnu.org; Sun, 18 Jun 2017 15:33:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:52740) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dMfwU-0008FV-3R for bug-gnu-emacs@gnu.org; Sun, 18 Jun 2017 15:33:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dMfwT-0006u3-U5 for bug-gnu-emacs@gnu.org; Sun, 18 Jun 2017 15:33:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: npostavs@users.sourceforge.net Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 18 Jun 2017 19:33:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 27407 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 27407-submit@debbugs.gnu.org id=B27407.149781436326506 (code B ref 27407); Sun, 18 Jun 2017 19:33:01 +0000 Original-Received: (at 27407) by debbugs.gnu.org; 18 Jun 2017 19:32:43 +0000 Original-Received: from localhost ([127.0.0.1]:55417 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dMfwA-0006tQ-V0 for submit@debbugs.gnu.org; Sun, 18 Jun 2017 15:32:43 -0400 Original-Received: from mail-io0-f169.google.com ([209.85.223.169]:32843) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dMfw9-0006tB-FP for 27407@debbugs.gnu.org; Sun, 18 Jun 2017 15:32:41 -0400 Original-Received: by mail-io0-f169.google.com with SMTP id t87so53121722ioe.0 for <27407@debbugs.gnu.org>; Sun, 18 Jun 2017 12:32:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=Y21dO8/y9voqb9co5E00dIBV3Srz7fK3ky9cPfHHCqU=; b=S43smYeGXNZi4e4UAs2PcjtFG06jJGjXJzSXp55moArsbhPFXccaIGm0kHADVNlsWG u3VfGG88q3WyEpRxEXChZLCkFnI9fsoCGD9k5gSzhigDtMtdBh+yLo2O8lIzxQi9jIpP 73NgivFCqgHZ4w8CnZlkxifVfJbkKR/C4std6+KQZxT9UP7fgH6FcwMqBziUOhM6vW7P 5SFcyJ70lZUrmCcM3n+FSDOBZmW+beWrWef7zKwg5xPJxWZts9vGaBMfcSt1NurES3w3 DZJ8EvYmFFIUK9x2aEBUcVvaIKyOgpu9/jVOAuROWxGRZ0h5mHAZMaR+h77Vo/mvgigz l2kA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=Y21dO8/y9voqb9co5E00dIBV3Srz7fK3ky9cPfHHCqU=; b=FkOezXr3vUrNAun4erSRKwedUjDltIL2lHi1diLE5e+715s8HPG174yTzesb6nrFSN N+tcQnddcgaSLZ5o11CFbtt6fJv2zTtC/RA7dYMMpBsOqYWgG2sRcjK/gchU/sWPtTXq 4ioNdssxDx7mpoibX/mk7X6ggJl4ys7XAGEU2QNGhpJw8jtQwWOSBjkOzOao9Rn0pJGn elmLpKBw0pfHCFZvaAJdU0kJ64qmyNka4eXiMYkwGXI3bWeYfZow4MNu+hSJXTeA0Zsh tXaSbKxuur83j+l8Qbt+ngSQvYb72bRD2LKLhPeQG2/y48N6aaMBMfQ6l3kw4MTUqugz Dg7Q== X-Gm-Message-State: AKS2vOyjUIGfba4p2+NVVQr7o2QZNXztgJjFNMuJhfpE6uGKVfMOaEyV afvCvUl/s8+12mkO X-Received: by 10.107.170.99 with SMTP id t96mr19714313ioe.113.1497814355674; Sun, 18 Jun 2017 12:32:35 -0700 (PDT) Original-Received: from zony ([45.2.7.65]) by smtp.googlemail.com with ESMTPSA id 137sm5190895itw.14.2017.06.18.12.32.34 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 18 Jun 2017 12:32:34 -0700 (PDT) In-Reply-To: <20170618180742.GC2617@gmail.com> (Pierre Neidhardt's message of "Sun, 18 Jun 2017 19:07:42 +0100") 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: 208.118.235.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:133734 Archived-At: --=-=-= Content-Type: text/plain Pierre Neidhardt writes: >> My patch does not solve this scenario, but on the other hand, when I try >> this experiment in a terminal with bash, not putting a reset does give a >> coloured prompt, i.e., in the following the 2nd "~/src$" is in yellow: >> >> ~/src$ echo $'\e[33mhello' >> hello >> ~/src$ >> >> So should eshell really be any different? > > Yes. Definitely. Eshell _already_ is very different and that's why we use > it. Bash is hardly a role model in the world of shells. > > In the case of bash, the issue probably stems back from historical limitations > of VT* terminals. Something that does not make sense to emulate in modern > computers. > > I don't see any use case for letting the SGR color the shell. If you want to > change you shell from a command, Elisp is your friend... Hmm, seems easy enough to fix: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=v1-0001-Reset-ansi-escape-context-before-printing-eshell-.patch Content-Description: patch >From 34f41c8573936285076b4e24c2e7ff4d34a48b8d Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Sun, 18 Jun 2017 15:29:55 -0400 Subject: [PATCH v1] Reset ansi escape context before printing eshell prompt (Bug#27407) * lisp/eshell/em-prompt.el (eshell-emit-prompt): Reset `ansi-color-context-region'. --- lisp/eshell/em-prompt.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lisp/eshell/em-prompt.el b/lisp/eshell/em-prompt.el index 53a83e6a67..8c81b43b1f 100644 --- a/lisp/eshell/em-prompt.el +++ b/lisp/eshell/em-prompt.el @@ -117,6 +117,8 @@ (defun eshell-prompt-initialize () (defun eshell-emit-prompt () "Emit a prompt if eshell is being used interactively." + (when (boundp 'ansi-color-context-region) + (setq ansi-color-context-region nil)) (run-hooks 'eshell-before-prompt-hook) (if (not eshell-prompt-function) (set-marker eshell-last-output-end (point)) -- 2.11.1 --=-=-=--