From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Random832 Newsgroups: gmane.emacs.help Subject: Re: Commands like ls(1) does not emits color sequences in 25.0.50.1 Date: Mon, 07 Sep 2015 17:58:03 -0400 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1441663121 3756 80.91.229.3 (7 Sep 2015 21:58:41 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 7 Sep 2015 21:58:41 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Sep 07 23:58:32 2015 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ZZ4Qo-0002ZB-Ja for geh-help-gnu-emacs@m.gmane.org; Mon, 07 Sep 2015 23:58:30 +0200 Original-Received: from localhost ([::1]:58951 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZZ4Qo-0003qz-88 for geh-help-gnu-emacs@m.gmane.org; Mon, 07 Sep 2015 17:58:30 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34875) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZZ4Qe-0003qu-VI for help-gnu-emacs@gnu.org; Mon, 07 Sep 2015 17:58:21 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZZ4QZ-0008Cu-Uy for help-gnu-emacs@gnu.org; Mon, 07 Sep 2015 17:58:20 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:60813) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZZ4QZ-0008Cm-OP for help-gnu-emacs@gnu.org; Mon, 07 Sep 2015 17:58:15 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1ZZ4QV-0002CW-2J for help-gnu-emacs@gnu.org; Mon, 07 Sep 2015 23:58:11 +0200 Original-Received: from c-68-39-72-44.hsd1.in.comcast.net ([68.39.72.44]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 07 Sep 2015 23:58:11 +0200 Original-Received: from random832 by c-68-39-72-44.hsd1.in.comcast.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 07 Sep 2015 23:58:11 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 37 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: c-68-39-72-44.hsd1.in.comcast.net User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (darwin) Cancel-Lock: sha1:wIwNecn9Xrpk86SK96K9cuAusWE= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:107073 Archived-At: Dmitry Igrishin writes: > To workaround this problem I've tried to add > (setenv "TERM" "ansi") to the init.el, but Emacs resets the TERM > variable to "dumb" upon the startup. Is this expected? Yes, it is expected. You can see where it does this in the comint-exec-1 function. You can test for the EMACS environment variable in your shell (it will be set to "t" if running within emacs) and reset the TERM in your e.g. bashrc file. if [ "$TERM" = dumb ] && [ "$EMACS" = t ]; then TERM=dumb-emacs-ansi fi I would tend to use a handcrafted terminfo entry (provided below) that has only the color codes (and bold, italic, underline), and nothing else, so that full-screen apps don't think they will work. Many applications (top and vim both do on my machine) will assume they can anyway, though. dumb-emacs-ansi|Emacs dumb terminal with ANSI color codes, am, colors#8, it#8, ncv#13, pairs#64, bold=\E[1m, cud1=^J, ht=^I, ind=^J, op=\E[39;49m, ritm=\E[23m, rmul=\E[24m, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, sgr0=\E[m, sitm=\E[3m, smul=\E[4m, Note: 'ncv' is set to disallow reverse, blink, and standout, since these are mapped by default to faces that set the foreground color (C-h v ansi-color-faces-vector), but also does not provide codes to use them in the first place - only color, bold, italic, and underline are provided. I couldn't find any way to actually indicate the behavior that emacs has when given a backspace or carriage return (it actually deletes characters, rather than moving backwards to overtype them), so I omitted these codes. So, in that sense, this entry is even dumber than dumb.